Class CommandManager

java.lang.Object
me.hsgamer.hscore.bukkit.command.CommandManager

public class CommandManager extends Object
The command manager
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.bukkit.plugin.java.JavaPlugin
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CommandManager(@NotNull org.bukkit.plugin.java.JavaPlugin plugin)
    Create a new command manager
  • Method Summary

    Modifier and Type
    Method
    Description
    final @NotNull Map<String,org.bukkit.command.Command>
    Get registered commands
    final void
    register(@NotNull org.bukkit.command.Command command)
    Register the command
    static void
    registerCommandToCommandMap(@NotNull String label, @NotNull org.bukkit.command.Command command)
    Register the command to the command map
    static void
    Sync the commands to the server.
    final void
    unregister(@NotNull String command)
    Unregister the command
    final void
    unregister(@NotNull org.bukkit.command.Command command)
    Unregister the command
    final void
    Unregister all commands
    static void
    unregisterFromKnownCommands(@NotNull org.bukkit.command.Command command)
    Unregister a command from the known commands

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • plugin

      protected final org.bukkit.plugin.java.JavaPlugin plugin
  • Constructor Details

    • CommandManager

      public CommandManager(@NotNull @NotNull org.bukkit.plugin.java.JavaPlugin plugin)
      Create a new command manager
      Parameters:
      plugin - the plugin
  • 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(@NotNull @NotNull org.bukkit.command.Command command)
      Unregister a command from the known commands
      Parameters:
      command - the command
    • registerCommandToCommandMap

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

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

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

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

      public final void unregisterAll()
      Unregister all commands
    • getRegistered

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