Command Builder
Create commands faster and easier
Overview
The CommandBuilder
class simplifies the creation and management of custom commands in a Minecraft Bukkit server environment. It provides methods for setting command properties such as cooldown, permission, aliases, arguments, command function, and messages, allowing for flexible and customizable command behavior.
Constructor
CommandBuilder
CommandBuilder
Initializes a new instance of the CommandBuilder
class with the specified JavaPlugin instance.
Parameters
plugin
: The JavaPlugin instance associated with the command builder.
Static Factory Method
create
create
Creates a new CommandBuilder
instance with the specified JavaPlugin instance and command name.
Parameters
plugin
: The JavaPlugin instance associated with the command builder.commandName
: The name of the command to be created.
Methods
setCooldown
setCooldown
Sets the cooldown (in seconds) for the command.
setPermission
setPermission
Sets the permission required to execute the command.
setArguments
setArguments
Sets the names of the arguments expected by the command.
setArgumentMapper
setArgumentMapper
Sets the function to map command arguments to a result message.
setCommandFunction
setCommandFunction
Sets the function to execute when the command is executed.
setMessages
setMessages
Sets the messages to be sent in response to various command conditions.
addAliases
addAliases
Adds aliases for the command.
build
build
Builds and registers the command with the Bukkit server.
Notes
The
CommandBuilder
class allows for the creation of custom commands with configurable properties and behavior.Developers can specify cooldown, permission, arguments, command function, and messages to tailor the command to their specific requirements.
Custom commands created using this builder pattern can enhance server functionality and provide players with additional gameplay features and interactions.
Last updated