Skip to Content
⚠ Under Construction
ReferenceC++ APICommand

endstone::Command

Represents a Command , which executes various tasks upon user input.

Functions:

Command

Command(std::string name, std::string description = "", std::vector<std::string> usages = {}, std::vector<std::string> aliases = {}, std::vector<std::string> permissions = {})

asPluginCommand

PluginCommand *asPluginCommand() const

execute

bool execute(CommandSender &sender, const std::vector<std::string> &args) const

Executes the command, returning its success

Parameters:

  • sender Source of the command
  • args Arguments passed to the command

Returns:

true if the execution was successful, otherwise false

getAliases

std::vector<std::string> getAliases() const

Returns a list of aliases of this command

Returns:

List of aliases

getDescription

std::string getDescription() const

Gets a brief description of this command

Returns:

Description of this command

getName

std::string getName() const

Returns the name of this command

Returns:

Name of this command

getPermissions

std::vector<std::string> getPermissions() const

Gets the permissions required by users to be able to perform this command

Returns:

List of permission names, or empty if none

getUsages

std::vector<std::string> getUsages() const

Returns a list of usages of this command

Returns:

List of usages

isRegistered

bool isRegistered() const

Returns the current registered state of this command

Returns:

true if this command is currently registered false otherwise

registerTo

bool registerTo(const CommandMap &command_map)

Registers this command to a CommandMap.

Parameters:

Returns:

true if the registration was successful, false otherwise

setAliases

template <typename... Alias> void setAliases(Alias... aliases)

Sets the list of aliases to request on registration for this command.

Parameters:

  • aliases aliases to register to this command

setDescription

void setDescription(std::string description)

Sets a brief description of this command.

Parameters:

  • description new command description

setName

void setName(std::string name)

Sets the name of this command.

May only be used before registering the command.

Parameters:

  • name New command name

setPermissions

template <typename... Permission> void setPermissions(Permission... permissions)

Sets the permissions required by users to be able to perform this command

Parameters:

  • permissions List of permission names

setUsages

template <typename... Usage> void setUsages(Usage... usages)

Sets the usages of this command

Parameters:

  • usages List of usages

testPermission

bool testPermission(const CommandSender &target) const

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:

  • target User to test

Returns:

true if they can use it, otherwise false

testPermissionSilently

bool testPermissionSilently(const CommandSender &target) const

Tests the given CommandSender to see if they can perform this command. No error is sent to the sender.

Parameters:

  • target User to test

Returns:

true if they can use it, otherwise false

unregisterFrom

bool unregisterFrom(const CommandMap &command_map)

Unregisters this command from a CommandMap

Parameters:

Returns:

true if the unregistration was successful, false otherwise

Last updated on