-
Notifications
You must be signed in to change notification settings - Fork 1
Annotations and you
The annotations in this API are critical for 2 things:
The @RegisterCommand
or @CommandName
Annotations handle the automatic command registration. When you initialize the API using your plugin's main class
the API will search for classes extending ApiCommand
that have one of these 2 Annotations, once it has that it will search for aliases, description, and usage message.
Very simple:
If you are using the @RegisterCommand
Annotation, you can simply add these fields to it:
@RegisterCommand(
name = "yourcommandnamehere",
description = "A command that does something",
usageMessage = "/<command>",
aliases = {"alias1", "alias2"}
)
These are pretty self-explanatory, hopefully. Do note, that everything but the name
field is optional, if not set they will simply be empty.
If you want to use the @CommandName
Annotation, you need to add the other Annotations:
@CommandName(name = "help")
@CommandDescription(description = "A command that does something")
@CommandUsage(usageMessage = "/<command>")
@CommandAliases(aliases = { "alias1", "alias2"})
These are pretty self-explanatory, hopefully. Do note, that everything but the @CommandName
interface is optional.
While there is code to handle when a mix of both Annotation methods exists, it's highly recommended you either use @RegisterCommand
or the second option using a combination of @CommandName
and the other Annotations. Both methods work the same way, just some users may prefer one option over the other.
Page written by: Dalton Burchard
- Your main class and you
- Editing API Settings (Optional)
- Creating an PluginInventory
- Creating Clickable items
- (Not added yet) Examples