Class endstone::CommandSenderWrapper¶
ClassList > endstone > CommandSenderWrapper
Represents a wrapper that forwards commands to the wrapped CommandSender and captures its output.
#include <endstone/command/command_sender_wrapper.h>
Inherits the following classes: endstone::CommandSender
Public Types¶
| Type | Name |
|---|---|
| typedef std::function< void(const Message &)> | Callback |
Public Functions¶
| Type | Name |
|---|---|
| CommandSenderWrapper (CommandSender & sender, Callback on_message={}, Callback on_error={}) |
|
| virtual PermissionAttachment * | addAttachment (Plugin & plugin, const std::string & name, bool value) override Adds a new PermissionAttachment with a single permission by name and value. |
| virtual PermissionAttachment * | addAttachment (Plugin & plugin) override Adds a new empty PermissionAttachment to this object. |
| virtual const std::type_info & | getClassTypeId () override const |
| virtual std::unordered_set< PermissionAttachmentInfo * > | getEffectivePermissions () override const Gets a set containing all the permissions currently in effect by this object. |
| virtual std::string | getName () override const Gets the name of this command sender. |
| virtual PermissionLevel | getPermissionLevel () override const Gets the permission level of this object. |
| virtual Server & | getServer () override const Returns the server instance that this command is running on. |
| CommandSender & | getWrapped () Returns a reference to the wrapped CommandSender . |
| const CommandSender & | getWrapped () const Returns a reference to the wrapped CommandSender . |
| virtual bool | hasPermission (std::string name) override const Gets the value of the specified permission, if set. If a permission override is not set on this object, the default value of the permission will be returned. |
| virtual bool | hasPermission (const Permission & perm) override const Gets the value of the specified permission, if set. If a permission override is not set on this object, the default value of the permission will be returned. |
| virtual bool | isInstanceOf (const std::type_info & target) override const |
| virtual bool | isPermissionSet (std::string name) override const Checks if this object contains an override for the specified permission, by fully qualified name. |
| virtual bool | isPermissionSet (const Permission & perm) override const Checks if this object contains an override for the specified Permission . |
| virtual void | recalculatePermissions () override Recalculates the permissions for this object, if the attachments have changed values. This should very rarely need to be called from a plugin. |
| virtual bool | removeAttachment (PermissionAttachment & attachment) override Removes the given PermissionAttachment from this object. |
| virtual void | sendErrorMessage (const Message & message) override const Sends this sender a error message. |
| virtual void | sendMessage (const Message & message) override const Sends this sender a message. |
Public Functions inherited from endstone::CommandSender¶
| Type | Name |
|---|---|
| virtual std::string | getName () const = 0 Gets the name of this command sender. |
| virtual Server & | getServer () const = 0 Returns the server instance that this command is running on. |
| virtual void | sendErrorMessage (const Message & message) const = 0 Sends this sender a error message. |
| void | sendErrorMessage (const fmt::format_string< Args... > format, Args &&... args) const |
| virtual void | sendMessage (const Message & message) const = 0 Sends this sender a message. |
| void | sendMessage (const fmt::format_string< Args... > format, Args &&... args) const |
Public Functions inherited from endstone::Permissible¶
| Type | Name |
|---|---|
| virtual PermissionAttachment * | addAttachment (Plugin & plugin, const std::string & name, bool value) = 0 Adds a new PermissionAttachment with a single permission by name and value. |
| virtual PermissionAttachment * | addAttachment (Plugin & plugin) = 0 Adds a new empty PermissionAttachment to this object. |
| virtual std::unordered_set< PermissionAttachmentInfo * > | getEffectivePermissions () const = 0 Gets a set containing all the permissions currently in effect by this object. |
| virtual PermissionLevel | getPermissionLevel () const = 0 Gets the permission level of this object. |
| virtual bool | hasPermission (std::string name) const = 0 Gets the value of the specified permission, if set. If a permission override is not set on this object, the default value of the permission will be returned. |
| virtual bool | hasPermission (const Permission & perm) const = 0 Gets the value of the specified permission, if set. If a permission override is not set on this object, the default value of the permission will be returned. |
| virtual bool | isPermissionSet (std::string name) const = 0 Checks if this object contains an override for the specified permission, by fully qualified name. |
| virtual bool | isPermissionSet (const Permission & perm) const = 0 Checks if this object contains an override for the specified Permission . |
| virtual void | recalculatePermissions () = 0 Recalculates the permissions for this object, if the attachments have changed values. This should very rarely need to be called from a plugin. |
| virtual bool | removeAttachment (PermissionAttachment & attachment) = 0 Removes the given PermissionAttachment from this object. |
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 Types Documentation¶
typedef Callback¶
Public Functions Documentation¶
function CommandSenderWrapper¶
inline explicit endstone::CommandSenderWrapper::CommandSenderWrapper (
CommandSender & sender,
Callback on_message={},
Callback on_error={}
)
function addAttachment [½]¶
Adds a new PermissionAttachment with a single permission by name and value.
inline virtual PermissionAttachment * endstone::CommandSenderWrapper::addAttachment (
Plugin & plugin,
const std::string & name,
bool value
) override
Parameters:
pluginPlugin responsible for this attachment, may not be null or disablednameName of the permission to attachvalueValue of the permission
Returns:
The PermissionAttachment that was just created
Implements endstone::Permissible::addAttachment
function addAttachment [2/2]¶
Adds a new empty PermissionAttachment to this object.
inline virtual PermissionAttachment * endstone::CommandSenderWrapper::addAttachment (
Plugin & plugin
) override
Parameters:
pluginPlugin responsible for this attachment, may not be null or disabled
Returns:
The PermissionAttachment that was just created
Implements endstone::Permissible::addAttachment
function getClassTypeId¶
inline virtual const std::type_info & endstone::CommandSenderWrapper::getClassTypeId () override const
Implements endstone::Object::getClassTypeId
function getEffectivePermissions¶
Gets a set containing all the permissions currently in effect by this object.
inline virtual std::unordered_set< PermissionAttachmentInfo * > endstone::CommandSenderWrapper::getEffectivePermissions () override const
Returns:
Set of currently effective permissions
Implements endstone::Permissible::getEffectivePermissions
function getName¶
Gets the name of this command sender.
Returns:
Name of the sender
Implements endstone::CommandSender::getName
function getPermissionLevel¶
Gets the permission level of this object.
Returns:
The permission level
Implements endstone::Permissible::getPermissionLevel
function getServer¶
Returns the server instance that this command is running on.
Returns:
Server instance
Implements endstone::CommandSender::getServer
function getWrapped [½]¶
Returns a reference to the wrapped CommandSender .
Returns:
The underlying command sender
function getWrapped [2/2]¶
Returns a reference to the wrapped CommandSender .
Returns:
The underlying command sender
function hasPermission [½]¶
Gets the value of the specified permission, if set. If a permission override is not set on this object, the default value of the permission will be returned.
inline virtual bool endstone::CommandSenderWrapper::hasPermission (
std::string name
) override const
Parameters:
nameName of the permission
Returns:
Value of the permission
Implements endstone::Permissible::hasPermission
function hasPermission [2/2]¶
Gets the value of the specified permission, if set. If a permission override is not set on this object, the default value of the permission will be returned.
inline virtual bool endstone::CommandSenderWrapper::hasPermission (
const Permission & perm
) override const
Parameters:
permPermission to get
Returns:
Value of the permission
Implements endstone::Permissible::hasPermission
function isInstanceOf¶
inline virtual bool endstone::CommandSenderWrapper::isInstanceOf (
const std::type_info & target
) override const
Implements endstone::Object::isInstanceOf
function isPermissionSet [½]¶
Checks if this object contains an override for the specified permission, by fully qualified name.
inline virtual bool endstone::CommandSenderWrapper::isPermissionSet (
std::string name
) override const
Parameters:
nameName of the permission
Returns:
true if the permission is set, otherwise false
Implements endstone::Permissible::isPermissionSet
function isPermissionSet [2/2]¶
Checks if this object contains an override for the specified Permission .
inline virtual bool endstone::CommandSenderWrapper::isPermissionSet (
const Permission & perm
) override const
Parameters:
permPermission to check
Returns:
true if the permission is set, otherwise false
Implements endstone::Permissible::isPermissionSet
function recalculatePermissions¶
Recalculates the permissions for this object, if the attachments have changed values. This should very rarely need to be called from a plugin.
Implements endstone::Permissible::recalculatePermissions
function removeAttachment¶
Removes the given PermissionAttachment from this object.
inline virtual bool endstone::CommandSenderWrapper::removeAttachment (
PermissionAttachment & attachment
) override
Parameters:
attachmentAttachment to remove
Returns:
true if the specified attachment was removed successfully, false when it isn't part of this object
Implements endstone::Permissible::removeAttachment
function sendErrorMessage¶
Sends this sender a error message.
inline virtual void endstone::CommandSenderWrapper::sendErrorMessage (
const Message & message
) override const
Parameters:
messageError message to be displayed
Implements endstone::CommandSender::sendErrorMessage
function sendMessage¶
Sends this sender a message.
inline virtual void endstone::CommandSenderWrapper::sendMessage (
const Message & message
) override const
Parameters:
messageMessage to be displayed
Implements endstone::CommandSender::sendMessage
The documentation for this class was generated from the following file include/endstone/command/command_sender_wrapper.h