Class CommandComponent

java.lang.Object
io.github.projectunified.minelib.plugin.command.CommandComponent
All Implemented Interfaces:
Loadable

public class CommandComponent extends Object implements Loadable
A component that manages the commands
  • Constructor Details

    • CommandComponent

      public CommandComponent(BasePlugin plugin, List<org.bukkit.command.Command> commands)
      Create a new instance
      Parameters:
      plugin - the plugin
      commands - the commands
    • CommandComponent

      public CommandComponent(BasePlugin plugin, org.bukkit.command.Command... commands)
      Create a new instance
      Parameters:
      plugin - the plugin
      commands - the commands
    • CommandComponent

      public CommandComponent(BasePlugin plugin, Supplier<List<org.bukkit.command.Command>> commandSupplier)
      Create a new instance
      Parameters:
      plugin - the plugin
      commandSupplier - the command supplier
  • Method Details

    • syncCommand

      public static void syncCommand()
      Sync the commands to the server. Mainly used to make tab completer work in 1.13+
    • unregisterFromKnownCommands

      public static void unregisterFromKnownCommands(org.bukkit.command.Command command)
      Unregister a command from the known commands
      Parameters:
      command - the command
    • registerCommandToCommandMap

      public static void registerCommandToCommandMap(String label, org.bukkit.command.Command command)
      Register the command to the command map
      Parameters:
      label - the label of the command
      command - the command
    • register

      public void register(org.bukkit.command.Command command)
      Register the command
      Parameters:
      command - the command object
    • unregister

      public void unregister(org.bukkit.command.Command command)
      Unregister the command
      Parameters:
      command - the command object
    • unregister

      public void unregister(String command)
      Unregister the command
      Parameters:
      command - the command label
    • unregisterAll

      public void unregisterAll()
      Unregister all commands
    • getRegistered

      public Map<String,org.bukkit.command.Command> getRegistered()
      Get registered commands
      Returns:
      the map contains the name and the command object
    • enable

      public void enable()
      Description copied from interface: Loadable
      Called when the component is enabled
      Specified by:
      enable in interface Loadable
    • disable

      public void disable()
      Description copied from interface: Loadable
      Called when the component is disabled
      Specified by:
      disable in interface Loadable