Class endstone::Command¶
ClassList > endstone > Command
Represents a Command , which executes various tasks upon user input.
#include <endstone/command/command.h>
Inherits the following classes: endstone::Object
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 bool | execute (CommandSender & sender, const std::vector< std::string > & args) const Executes the command, returning its success. |
| std::vector< std::string > | getAliases () const Returns a list of aliases of this command. |
| virtual const std::type_info & | getClassTypeId () override const |
| std::string | getDescription () const Gets a brief description of this command. |
| std::string | getName () const Returns the name of this command. |
| std::vector< std::string > | getPermissions () const Gets the permissions required by users to be able to perform this command. |
| std::vector< std::string > | getUsages () const Returns a list of usages of this command. |
| virtual bool | isInstanceOf (const std::type_info & target) override const |
| bool | isRegistered () const Returns the current registered state of this command. |
| bool | registerTo (const CommandMap & command_map) Registers this command to a CommandMap . |
| void | setAliases (Alias... aliases) Sets the list of aliases to request on registration for this command. |
| void | setDescription (std::string description) Sets a brief description of this command. |
| void | setName (std::string name) Sets the name of this command. |
| void | setPermissions (Permission... permissions) Sets the permissions required by users to be able to perform this command. |
| void | setUsages (Usage... usages) Sets the usages of this command. |
| bool | testPermission (const CommandSender & target) const Tests the given CommandSender to see if they can perform this command. |
| bool | testPermissionSilently (const CommandSender & target) const Tests the given CommandSender to see if they can perform this command. |
| bool | unregisterFrom (const CommandMap & command_map) Unregisters this command from a CommandMap . |
| virtual | ~Command () = default |
Public Functions inherited from endstone::Object¶
See endstone::Object
| Type | Name |
|---|---|
| T * | as () Attempts to cast this object to the given type T. |
| const T * | as () const Attempts to cast this object to the given type T. |
| virtual const std::type_info & | getClassTypeId () const = 0 |
| bool | is () const Checks if this object is an instance of the given type T (or a subclass of T). |
| virtual bool | isInstanceOf (const std::type_info & target) const = 0 |
| virtual | ~Object () = 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 execute¶
Executes the command, returning its success.
inline virtual bool endstone::Command::execute (
CommandSender & sender,
const std::vector< std::string > & args
) const
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 getClassTypeId¶
Implements endstone::Object::getClassTypeId
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 isInstanceOf¶
inline virtual bool endstone::Command::isInstanceOf (
const std::type_info & target
) override const
Implements endstone::Object::isInstanceOf
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¶
Sets the permissions required by users to be able to perform this command.
template<typename... Permission>
inline void endstone::Command::setPermissions (
Permission... permissions
)
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