Skip to content

Creating your command class

Dalton edited this page Apr 24, 2022 · 8 revisions

Creating the ApiCommand instance

Instead of using Spigot/Paper's built-in Command Handling system, you may use the command handling system provided by BurchAPI! It offers a smooth functional interface API (Just like the PluginInventory!)

Creating an ApiCommnd requires you to have the 4 arguments:

  • String - command name (Eg /commandNameHere)
  • String - usage message (Eg Invalid syntax! Usage: /command )
  • String - Description of the command
  • ArrayList of Strings - This is for the aliases, this can be an empty ArrayList

The best way to register command is by extending the ApiCommand class:

public class HelpCommand extends ApiCommand {

}

The next step is to add either one of these annotations:

@RegisterCommand(
    name = "helpcommand"
)

// OR

@CommandName( name = "helpcommand")

This Annotation sets the mandatory Command-Name for the command to be registered

To view more about the Annotations for commands this plugin provides view ThisPage to view more about them!

The Annotation you choose goes on the top of the class file itself like so:

@RegisterCommand( name = "helpcommand" )
public class TestCommand extends ApiCommand {

}
Clone this wiki locally