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 entrypoint
Command Annotations:
Choice- Defines predefined choices for command optionsCommandOption- Defines command options/parametersContextMenu- Declares a context menu handlerSlashCommand- Declares a slash command handlerSubcommand- Defines subcommands for slash commandsTextCommand- Declares a text (prefix) command handler
Interaction Handler Annotations:
ButtonHandler- Handles button interactionsModalHandler- Handles modal submissionsSelectMenuHandler- Handles select menu interactions
Lifecycle Annotations:
OnDisable- Called when plugin is disabledOnEnable- Called when plugin is enabledOnShutdown- 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.