kraftlinCommand
fun kraftlinCommand(name: String, description: String? = null, aliases: List<String> = emptyList(), overrideAliases: Boolean = false, block: PaperLiteralNode.() -> Unit): KraftlinPaperCommand
Declares a new Kraftlin command for Paper.
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 KraftlinPaperCommand that can be registered via registerKraftlinCommands.
Example:
val demo = kraftlinCommand(
name = "demo",
description = "Demo command",
aliases = listOf("d")
) {
player("target") {
executes { sender, context ->
val target = context.player("target")
target.sendMessage("Hello")
sender.sendMessage("Sent hello to ${target.name}")
}
}
}Content copied to clipboard
Return
a KraftlinPaperCommand 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