Class endstone::Command¶
ClassList > endstone > Command
Represents a Command , which executes various tasks upon user input.
#include <endstone/command/command.h>
Inherited by the following classes: endstone::PluginCommand
Public Functions¶
| Type | Name |
|---|---|
| Command (std::string name, std::string description="", std::vector< std::string > usages={}, std::vector< std::string > aliases={}, std::vector< std::string > permissions={}) |
|
| virtual PluginCommand * | asPluginCommand () |
| virtual bool | execute (CommandSender & sender, const std::vector< std::string > & args) const |
| std::vector< std::string > | getAliases () const |
| std::string | getDescription () const |
| std::string | getName () const |
| std::vector< std::string > | getPermissions () const |
| std::vector< std::string > | getUsages () const |
| bool | isRegistered () const |
| bool | registerTo (CommandMap & command_map) |
| void | setAliases (Alias... aliases) |
| void | setDescription (std::string description) |
| void | setName (std::string name) |
| void | setPermissions (Permission... permissions) |
| void | setUsages (Usage... usages) |
| bool | testPermission (const CommandSender & target) const |
| bool | testPermissionSilently (const CommandSender & target) const |
| bool | unregisterFrom (CommandMap & command_map) |
| virtual | ~Command () = default |
Public Functions Documentation¶
function Command¶
inline explicit endstone::Command::Command (
std::string name,
std::string description="",
std::vector< std::string > usages={},
std::vector< std::string > aliases={},
std::vector< std::string > permissions={}
)
function asPluginCommand¶
function execute¶
inline virtual bool endstone::Command::execute (
CommandSender & sender,
const std::vector< std::string > & args
) const
Executes the command, returning its success
Parameters:
senderSource of the commandargsArguments passed to the command
Returns:
true if the execution was successful, otherwise false
function getAliases¶
Returns a list of aliases of this command
Returns:
List of aliases
function getDescription¶
Gets a brief description of this command
Returns:
Description of this command
function getName¶
Returns the name of this command
Returns:
Name of this command
function getPermissions¶
Gets the permissions required by users to be able to perform this command
Returns:
List of permission names, or empty if none
function getUsages¶
Returns a list of usages of this command
Returns:
List of usages
function isRegistered¶
Returns the current registered state of this command
Returns:
true if this command is currently registered false otherwise
function registerTo¶
Registers this command to a CommandMap.
Parameters:
command_mapthe CommandMap to register to
Returns:
true if the registration was successful, false otherwise
function setAliases¶
Sets the list of aliases to request on registration for this command.
Parameters:
aliasesaliases to register to this command
function setDescription¶
Sets a brief description of this command.
Parameters:
descriptionnew command description
function setName¶
Sets the name of this command.
May only be used before registering the command.
Parameters:
nameNew command name
function setPermissions¶
template<typename... Permission>
inline void endstone::Command::setPermissions (
Permission... permissions
)
Sets the permissions required by users to be able to perform this command
Parameters:
permissionsList of permission names
function setUsages¶
Sets the usages of this command
Parameters:
usagesList of usages
function testPermission¶
Tests the given CommandSender to see if they can perform this command. If they do not have permission, they will be informed that they cannot do this.
Parameters:
targetUser to test
Returns:
true if they can use it, otherwise false
function testPermissionSilently¶
Tests the given CommandSender to see if they can perform this command. No error is sent to the sender.
Parameters:
targetUser to test
Returns:
true if they can use it, otherwise false
function unregisterFrom¶
Unregisters this command from a CommandMap
Parameters:
command_mapthe CommandMap to unregister from
Returns:
true if the unregistration was successful, false otherwise
function ~Command¶
The documentation for this class was generated from the following file include/endstone/command/command.h