Class StandaloneCommandManager
java.lang.Object
io.github.projectunified.craftcommand.CommandManager<Object>
io.github.projectunified.craftcommand.standalone.StandaloneCommandManager
CommandManager implementation for standalone applications.
Handles registration and retrieval of standalone commands.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a StandaloneCommandManager with a default error handler that propagates exceptions.StandaloneCommandManager(ErrorHandler<Object> errorHandler) Constructs a StandaloneCommandManager with a custom error handler. -
Method Summary
Modifier and TypeMethodDescriptiongetCommand(String label) Gets a registered command by its label or alias.Gets all registered commands.voidRegisters an annotated command class instance.voidregisterCommand(StandaloneCommand command) Registers a StandaloneCommand instance and its aliases.Methods inherited from class io.github.projectunified.craftcommand.CommandManager
formatMessage, getCommandInfo, getErrorHandler, getResolver, registerExposer, registerProvider, registerResolver, setErrorHandler
-
Constructor Details
-
StandaloneCommandManager
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
Registers an annotated command class instance. Generates and registers the corresponding StandaloneCommand wrapper.- Parameters:
commandInstance- the annotated command class instance
-
registerCommand
Registers a StandaloneCommand instance and its aliases.- Parameters:
command- the standalone command instance
-
getCommand
Gets a registered command by its label or alias.- Parameters:
label- the command label or alias- Returns:
- the command instance, or
nullif not found
-
getCommands
Gets all registered commands.- Returns:
- a map of command labels to command instances
-