-
Notifications
You must be signed in to change notification settings - Fork 1
Creating your command class
This CommandAPI provides 3 major functions:
- Auto registration of command just by adding an Annotation
- FunctionalInterface methods for Player and Console command sender
- FunctionalInterface methods for handling tab completion
To get started, create your command class and extend ApiCommand
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, these annotations make it so you're ApiCommand gets registered without you ever need to call it!
To view more about the Annotations for commands this plugin provides view This Page 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 {
}
If you don't know what this is, read this article Here
As you notice, this Command API library auto registers your commands, and you may want to access other managers/sub-systems from your main JavaPlugin class. Well, do not worry! The API will automatically inject your plugin's class extending JavaPlugin
just by passing it through the constructor:
@RegisterCommand( name = "helpcommand" )
public class HelpCommand extends ApiCommand {
public HelpCommand(YourPluginsMainCLass pluginInstance) {
}
}
Just by adding that to your constructor, when the auto registration runs your class extending JavaPlugin
will automatically get provided!
Page written by: Dalton Burchard
- Your main class and you
- Editing API Settings (Optional)
- Creating an PluginInventory
- Creating Clickable items
- (Not added yet) Examples