Add brigardier example to the guide
This commit is contained in:
19
guide/docs/commands/brigardier_example.md
Normal file
19
guide/docs/commands/brigardier_example.md
Normal file
@@ -0,0 +1,19 @@
|
||||
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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user