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() = default
CommandMap(const CommandMap &) = delete
CommandMap(CommandMap &&) = default
clearCommands
void clearCommands()
Clears all registered commands.
dispatch
bool dispatch(CommandSender &sender, std::string command_line) const
Looks for the requested command and executes it if found.
Parameters:
sender
The command’s sendercommand_line
command + arguments. Example: “/test abc 123”
Returns:
true if execution is successful, false otherwise
getCommand
std::shared_ptr<Command> getCommand(std::string name) const
Gets the command registered to the specified name
Parameters:
name
Name 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:
command
the command to register
Returns:
true on success, false if a command with the same name is already registered
Last updated on