endstone::CommandMap
Represents a command map that manages all commands of the Server .
Functions:
| Name | Description |
|---|---|
CommandMap | |
CommandMap | |
CommandMap | |
clearCommands | |
dispatch | Looks for the requested command and executes it if found. |
getCommand | |
registerCommand |
CommandMap
CommandMap() = defaultCommandMap(const CommandMap &) = deleteCommandMap(CommandMap &&) = default clearCommands
void clearCommands()Clears all registered commands.
dispatch
bool dispatch(CommandSender &sender, std::string command_line) constLooks for the requested command and executes it if found.
Parameters:
senderThe command’s sendercommand_linecommand + arguments. Example: “/test abc 123”
Returns:
true if execution is successful, false otherwise
getCommand
std::shared_ptr<Command> getCommand(std::string name) constGets the command registered to the specified name
Parameters:
nameName of the command to retrieve
Returns:
Command with the specified name or nullptr if a command with that label doesn’t exist
registerCommand
bool registerCommand(std::shared_ptr<Command> command)Registers a command.
Parameters:
commandthe command to register
Returns:
true on success, false if a command with the same name is already registered
Last updated on