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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
@@ -43,5 +43,6 @@ nav:
|
||||
- Compounds: gui/compounds.md
|
||||
- Commands:
|
||||
- Brigardier: commands/brigardier.md
|
||||
- Brigardier example: commands/brigardier_example.md
|
||||
- Migration:
|
||||
- "1.16 -> 1.17": migration/1_16_to_1_17.md
|
||||
|
Reference in New Issue
Block a user