Class CommandHandler

java.lang.Object
me.hackware.api.command.CommandHandler

public class CommandHandler extends Object
Singleton command manager. Handles dispatching chat input to registered commands and providing tab-completion suggestions.
  • Method Details

    • bootstrap

      public static void bootstrap(Supplier<String> readPrefix, Consumer<String> writePrefix)
      Installed once by the client at startup.
    • get

      public static CommandHandler get()
    • unregister

      public void unregister(Command command)
      Removes a command — used to roll back a plugin's commands on unload.
    • register

      public void register(Command command)
    • getCommands

      public List<Command> getCommands()
    • getPrefix

      public String getPrefix()
      The prefix lives on the ClickGUI module (persisted in its config file).
    • setPrefix

      public void setPrefix(String prefix)
    • dispatch

      public boolean dispatch(String message)
      Attempt to handle a chat message as a command.
      Parameters:
      message - the raw chat message (without leading /)
      Returns:
      true if the message was handled as a command, false otherwise
    • getSuggestions

      public List<String> getSuggestions(String input)
      Get tab-completion suggestions for the current chat input.
      Parameters:
      input - the full chat input string
      Returns:
      list of full suggestion strings (including prefix)