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(BiConsumer<Object, Exception> 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.getCommandInfo(Object commandInstance) Gets command metadata for a registered command instance.Gets all registered commands.voidRegisters a command.voidregisterCommand(StandaloneCommand command) Registers a StandaloneCommand instance and its aliases.Methods inherited from class io.github.projectunified.craftcommand.CommandManager
filterSuggestions, formatMessage, getErrorHandler, getResolver, registerProvider, registerResolver, registerSenderResolver, resolveParameter, resolveSender, 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
Description copied from class:CommandManagerRegisters a command.- Specified by:
registerin classCommandManager<Object>
-
getCommandInfo
Description copied from class:CommandManagerGets command metadata for a registered command instance.- Specified by:
getCommandInfoin classCommandManager<Object>- Parameters:
commandInstance- the original command instance passed toCommandManager.register(Object)- Returns:
- the command info list, or empty list if not found
-
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
-