Skip to main content
The CommandsManager handles registration and management of custom sub-commands for both player and admin commands.

Methods

registerCommand

void registerCommand(SuperiorCommand superiorCommand)
Register a sub-command.
superiorCommand
SuperiorCommand
required
The sub command to register

unregisterCommand

void unregisterCommand(SuperiorCommand superiorCommand)
Unregister a sub-command.
superiorCommand
SuperiorCommand
required
The sub command to unregister

registerAdminCommand

void registerAdminCommand(SuperiorCommand superiorCommand)
Register a sub-command to the admin command.
superiorCommand
SuperiorCommand
required
The sub command to register

unregisterAdminCommand

void unregisterAdminCommand(SuperiorCommand superiorCommand)
Unregister a sub-command from the admin command.
superiorCommand
SuperiorCommand
required
The sub command to unregister

getSubCommands

List<SuperiorCommand> getSubCommands()
List<SuperiorCommand> getSubCommands(boolean includeDisabled)
Get all the registered sub-commands.
includeDisabled
boolean
Whether to include disabled commands (optional)
return
List<SuperiorCommand>
List of all registered sub-commands

getCommand

SuperiorCommand getCommand(String commandLabel)
Get a sub command by its label.
commandLabel
String
required
The label of the sub command
return
SuperiorCommand
The sub command if exists or null

getAdminSubCommands

List<SuperiorCommand> getAdminSubCommands()
Get all the registered admin sub-commands.
return
List<SuperiorCommand>
List of all registered admin sub-commands

getAdminCommand

SuperiorCommand getAdminCommand(String commandLabel)
Get an admin sub command by its label.
commandLabel
String
required
The label of the sub command
return
SuperiorCommand
The sub command if exists or null

dispatchSubCommand

void dispatchSubCommand(CommandSender sender, String subCommand)
void dispatchSubCommand(CommandSender sender, String subCommand, @Nullable String args)
Dispatch a sub command. If the sub command does not exist, Bukkit#dispatchCommand is executed.
sender
CommandSender
required
The sender to dispatch the command
subCommand
String
required
The sub-command to dispatch
args
String
The argument to use for the command (nullable)