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(ErrorHandler<Object> errorHandler)
      Constructs a StandaloneCommandManager with a custom error handler.
      Parameters:
      errorHandler - the error handler
    • StandaloneCommandManager

      public StandaloneCommandManager()
      Constructs a StandaloneCommandManager with a default error handler that propagates exceptions.
  • Method Details

    • register

      public void register(Object commandInstance)
      Registers an annotated command class instance. Generates and registers the corresponding StandaloneCommand wrapper.
      Parameters:
      commandInstance - the annotated command class instance
    • 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:
      a map of command labels to command instances