Files
KSpigot/guide/docs/commands/brigardier_example.md
2021-06-28 13:16:12 +02:00

20 lines
637 B
Markdown

The following command illustrates how to use commands, subcommands, arguments and the command context.
```kotlin
command("gaming") {
literal("set") {
argument("state", BoolArgumentType.bool()) {
simpleSuggests { listOf(true, false) }
simpleExecutes {
if (it.getArgument("state"))
it.source.bukkitSender.sendMessage("yoo gaming has been activated")
else {
it.source.player.kill()
it.source.player.sendText("gaming disabled") { color = KColors.INDIANRED }
}
}
}
}
}
```