Class CommandManager
java.lang.Object
org.reprogle.honeypot.common.commands.CommandManager
- All Implemented Interfaces:
org.bukkit.command.CommandExecutor,org.bukkit.command.TabCompleter,org.bukkit.command.TabExecutor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a list of all subcommands for tab completionbooleanonCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) Called by Bukkit when a player runs a command registered to our plugin.onTabComplete(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String alias, String[] args) This function is responsible for tab completion of our pluign.
-
Constructor Details
-
CommandManager
public CommandManager()Registers all commands
-
-
Method Details
-
onCommand
public boolean onCommand(@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.command.Command command, @NotNull String label, @NotNull String[] args) Called by Bukkit when a player runs a command registered to our plugin. When called, the plugin will check if the sender is a player. If it is, it will first verify permissions, then verify if there were any subcommands. If not, show the GUI. If there were subcommands, but they aren't valid, show the usage.If the sender is not a player, it will check if the command was reload. If it was, it'll allow the command to be run, otherwise it will throw an error.
- Specified by:
onCommandin interfaceorg.bukkit.command.CommandExecutor- Parameters:
sender- The Sender sending the command. Not necessarily a player, could be console or a plugincommand- The Command being executedlabel- The label of the commandargs- Any arguments passed to the command- Returns:
- True if it ran successfully, false if it errored at any point. Defaults as false
-
getSubcommands
Returns a list of all subcommands for tab completion- Returns:
- List of all subcommands
-
onTabComplete
@Nullable public List<String> onTabComplete(@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.command.Command command, @NotNull String alias, @NotNull String[] args) This function is responsible for tab completion of our pluign. It will check if the tab completer is at the first arg. If it is, return partial matches for the tab completer. If it's longer than one arg, return partial matches for the subcommand (such as create)- Specified by:
onTabCompletein interfaceorg.bukkit.command.TabCompleter- Parameters:
sender- The sender of the commandcommand- The command being tab completedalias- The alias of the commandargs- The arguments passed to the tab completer (Required for tab completion)- Returns:
- A list of valid tab completed commands
-