kraftlinCommand
fun kraftlinCommand(name: String, description: String? = null, aliases: List<String> = emptyList(), block: VelocityLiteralNode.() -> Unit): KraftlinVelocityCommand
Declares a new Kraftlin command for Velocity.
This is the main entry point for defining commands using the Kraftlin DSL. It creates the root literal node, applies the DSL block, and returns a KraftlinVelocityCommand that can be registered via registerKraftlinCommands.
Example:
val demo = kraftlinCommand(
name = "demo",
description = "Demo command",
aliases = listOf("d")
) {
executes { sender, context ->
sender.sendMessage(Component.text("Hello from Velocity!"))
}
}Content copied to clipboard
Return
a KraftlinVelocityCommand that can be registered via registerKraftlinCommands
Parameters
name
the root command literal (e.g. "demo")
description
optional description shown in help output
aliases
optional alternative labels for the command
block
DSL block used to build the command tree