Declare command
First of all, you need to create a function with the first parameter - CommandSender (also you can use my typealias - Sender) (if you want the command to be used from the console) or Player (if the command is intended only for players). Annotate it with @Command annotation. In parameter of annotation write name of command:
@Command("testCommand")
fun testCommand(sender: Sender) {
}Now you can add arguments of command. Library handle it by parameters of function:
@Command("testCommand")
fun testCommand(sender: Sender, arg1: Int, arg2: String) {
}More about command arguments Command arguments
Register it by CommandManager:
commandManager.register(::testCommand)Done!
Command customization
Also you can add some annotations to your command to customize it (for example usage or description)
Check Annotations
Last updated