Skip to content

Class endstone::PluginCommand

ClassList > endstone > PluginCommand

Represents a Command belonging to aPlugin .

  • #include <endstone/command/plugin_command.h>

Inherits the following classes: endstone::Command

Public Functions

Type Name
PluginCommand (const Command & command, Plugin & owner)
virtual bool execute (CommandSender & sender, const std::vector< std::string > & args) override const
Executes the command, returning its success.
virtual const std::type_info & getClassTypeId () override const
virtual CommandExecutor & getExecutor () const
Gets the CommandExecutor associated with this command.
Plugin & getPlugin () const
Gets the owner of this PluginCommand .
virtual bool isInstanceOf (const std::type_info & target) override const
virtual void setExecutor (std::shared_ptr< CommandExecutor > executor)
Sets the CommandExecutor to run when parsing this command.

Public Functions inherited from endstone::Command

See endstone::Command

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 PluginCommand

inline endstone::PluginCommand::PluginCommand (
    const  Command & command,
    Plugin & owner
) 

function execute

Executes the command, returning its success.

inline virtual bool endstone::PluginCommand::execute (
    CommandSender & sender,
    const std::vector< std::string > & args
) override const

Parameters:

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

Returns:

true if the execution was successful, otherwise false

Implements endstone::Command::execute


function getClassTypeId

inline virtual const std::type_info & endstone::PluginCommand::getClassTypeId () override const

Implements endstone::Command::getClassTypeId


function getExecutor

Gets the CommandExecutor associated with this command.

inline virtual CommandExecutor & endstone::PluginCommand::getExecutor () const

Returns:

CommandExecutor object linked to this command


function getPlugin

Gets the owner of this PluginCommand .

inline Plugin & endstone::PluginCommand::getPlugin () const

Returns:

Plugin that owns this command


function isInstanceOf

inline virtual bool endstone::PluginCommand::isInstanceOf (
    const std::type_info & target
) override const

Implements endstone::Command::isInstanceOf


function setExecutor

Sets the CommandExecutor to run when parsing this command.

inline virtual void endstone::PluginCommand::setExecutor (
    std::shared_ptr< CommandExecutor > executor
) 

Parameters:

  • executor New executor to run


The documentation for this class was generated from the following file include/endstone/command/plugin_command.h