Package group.worldstandard.pudel.api.annotation
package group.worldstandard.pudel.api.annotation
Annotations for declaring plugin metadata, commands, and event handlers.
This package contains all annotations used to declaratively define plugin behavior. Using annotations is the preferred approach for plugin development as it simplifies registration and lifecycle management.
Plugin Declaration:
Plugin- Marks a class as a plugin
Command Annotations:
SlashCommand- Declares a slash command handlerTextCommand- Declares a text (prefix) command handlerSubcommand- Defines subcommands for slash commandsCommandOption- Defines command options/parametersChoice- Defines predefined choices for command optionsContextMenu- Declares a context menu handler
Interaction Handler Annotations:
ButtonHandler- Handles button interactionsSelectMenuHandler- Handles select menu interactionsModalHandler- Handles modal submissions
Lifecycle Annotations:
OnEnable- Called when plugin is enabledOnDisable- Called when plugin is disabledOnShutdown- Called when bot is shutting down
Example Usage:
@Plugin(name = "MyPlugin", version = "1.0.0", author = "Author")
public class MyPlugin {
@OnEnable
public void onEnable(PluginContext context) {
// Plugin initialization
}
@SlashCommand(name = "ping", description = "Check latency")
public void ping(SlashCommandInteractionEvent event) {
event.reply("Pong!").queue();
}
}
- Since:
- 2.3.0
-
Annotation InterfacesClassDescriptionMarks a method as a button interaction handler.Defines a choice for command options.Defines a command option for slash commands.Marks a method as a context menu handler.Marks a method as a modal submission handler.Marks a method to be called when the plugin is disabled.Marks a method to be called when the plugin is enabled.Marks a method to be called when the plugin is being unloaded/shutdown.Marks a class as a Pudel plugin.Marks a method as a select menu handler.Marks a method as a slash command handler.Defines a subcommand for slash commands.Marks a method as a text command handler.