Class StandaloneCommandManager

java.lang.Object
io.github.projectunified.craftcommand.CommandManager<Object>
io.github.projectunified.craftcommand.standalone.StandaloneCommandManager

public class StandaloneCommandManager extends CommandManager<Object>
CommandManager implementation for standalone applications. Handles registration and retrieval of standalone commands.
  • Constructor Details

    • StandaloneCommandManager

      public StandaloneCommandManager()
  • Method Details

    • sendMessage

      protected void sendMessage(Object sender, String message)
      Description copied from class: CommandManager
      Sends an already formatted message. Implemented by each platform manager.
      Specified by:
      sendMessage in class CommandManager<Object>
      Parameters:
      sender - the message recipient
      message - the formatted message
    • handleException

      public void handleException(Object sender, Exception exception)
      Description copied from class: CommandManager
      Handles an exception thrown by a command. Default: send its message.
      Overrides:
      handleException in class CommandManager<Object>
      Parameters:
      sender - the command sender
      exception - the exception
    • register

      public void register(Object commandInstance)
      Description copied from class: CommandManager
      Registers a command.
      Specified by:
      register in class CommandManager<Object>
    • registerCommand

      public void registerCommand(StandaloneCommand command)
      Registers a StandaloneCommand instance and its aliases.
      Parameters:
      command - the standalone command instance
    • getCommand

      public StandaloneCommand getCommand(String label)
      Gets a registered command by its label or alias.
      Parameters:
      label - the command label or alias
      Returns:
      the command instance, or null if not found
    • getCommands

      public Map<String,StandaloneCommand> getCommands()
      Gets all registered commands.
      Returns:
      an unmodifiable map of command labels to command instances