Class CommandCollection

java.lang.Object
redempt.redlib.commandmanager.CommandCollection

public class CommandCollection extends Object
Represents a collection of commands which can be mass-registered. Can contain any amount of commands, including 0
  • Constructor Details

    • CommandCollection

      public CommandCollection(List<Command> commands)
  • Method Details

    • register

      public void register(org.bukkit.plugin.Plugin plugin, String prefix, Object... listeners)
      Register all commands in this CommandCollection
      Parameters:
      plugin - the plugin that owns the commands
      prefix - The fallback prefix of the commands
      listeners - The list of listener objects which contain hooks for the commands in this collection
    • register

      public void register(String prefix, Object... listeners)
      Register all commands in this CommandCollection
      Parameters:
      prefix - The fallback prefix of the commands
      listeners - The list of listener objects which contain hooks for the commands in this collection
    • getCommands

      public List<Command> getCommands()
      Returns:
      The commands in this CommandCollection
    • showHelp

      public void showHelp(String hookName, org.bukkit.command.CommandSender sender)
      Recursively searches this CommandCollection for a command by a given hook, then shows the help to the given sender
      Parameters:
      hookName - The hook name of the command
      sender - The sender to be shown the help menu for this command
      Throws:
      IllegalArgumentException - if no command by that hook name was found
    • getByHookName

      public Command getByHookName(String hookName)
      Recurseively searches this CommandCollection for a command with a given hook name
      Parameters:
      hookName - The hook name of the command
      Returns:
      The command in this CommandCollection by that hook name, or null if none found