Skip to content

Class endstone::Permissible

ClassList > endstone > Permissible

Represents an object that may become a server operator and can be assigned permissions.

  • #include <endstone/permissions/permissible.h>

Inherits the following classes: endstone::Object, std::enable_shared_from_this< Permissible >

Inherited by the following classes: endstone::CommandSender

Public Functions

Type Name
virtual NotNull< PermissionAttachment > addAttachment (Plugin & plugin, const std::string & name, bool value) = 0
Adds a new PermissionAttachment with a single permission by name and value.
virtual NotNull< PermissionAttachment > addAttachment (Plugin & plugin) = 0
Adds a new empty PermissionAttachment to this object.
virtual std::unordered_set< NotNull< 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.
virtual bool hasPermission (const NotNull< Permission > & perm) const = 0
Gets the value of the specified permission, if set.
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 NotNull< 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.
virtual bool removeAttachment (const NotNull< 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 ClassInfo getClassInfo () 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 (ClassInfo target) const = 0
virtual ~Object () = default

Public Functions Documentation

function addAttachment [½]

Adds a new PermissionAttachment with a single permission by name and value.

virtual NotNull < PermissionAttachment > endstone::Permissible::addAttachment (
    Plugin & plugin,
    const std::string & name,
    bool value
) = 0

Parameters:

  • plugin Plugin responsible for this attachment; must not be disabled.
  • name Name of the permission to attach
  • value Value of the permission

Returns:

The PermissionAttachment that was just created

Exception:

  • std::invalid_argument if the name is empty or the plugin is disabled

function addAttachment [2/2]

Adds a new empty PermissionAttachment to this object.

virtual NotNull < PermissionAttachment > endstone::Permissible::addAttachment (
    Plugin & plugin
) = 0

Parameters:

  • plugin Plugin responsible for this attachment; must not be disabled.

Returns:

The PermissionAttachment that was just created

Exception:

  • std::invalid_argument if the plugin is disabled

function getEffectivePermissions

Gets a set containing all the permissions currently in effect by this object.

virtual std::unordered_set< NotNull < PermissionAttachmentInfo > > endstone::Permissible::getEffectivePermissions () const = 0

Returns:

Set of currently effective permissions


function getPermissionLevel

Gets the permission level of this object.

virtual PermissionLevel endstone::Permissible::getPermissionLevel () const = 0

Returns:

The permission level


function hasPermission [½]

Gets the value of the specified permission, if set.

virtual bool endstone::Permissible::hasPermission (
    std::string name
) const = 0

If a permission override is not set on this object, the default value of the permission will be returned.

Parameters:

  • name Name of the permission

Returns:

Value of the permission


function hasPermission [2/2]

Gets the value of the specified permission, if set.

virtual bool endstone::Permissible::hasPermission (
    const  NotNull < Permission > & perm
) const = 0

If a permission override is not set on this object, the default value of the permission will be returned.

Parameters:

Returns:

Value of the permission


function isPermissionSet [½]

Checks if this object contains an override for the specified permission, by fully qualified name.

virtual bool endstone::Permissible::isPermissionSet (
    std::string name
) const = 0

Parameters:

  • name Name of the permission

Returns:

true if the permission is set, otherwise false


function isPermissionSet [2/2]

Checks if this object contains an override for the specified Permission .

virtual bool endstone::Permissible::isPermissionSet (
    const  NotNull < Permission > & perm
) const = 0

Parameters:

Returns:

true if the permission is set, otherwise false


function recalculatePermissions

Recalculates the permissions for this object, if the attachments have changed values.

virtual void endstone::Permissible::recalculatePermissions () = 0

This should very rarely need to be called from a plugin.


function removeAttachment

Removes the given PermissionAttachment from this object.

virtual bool endstone::Permissible::removeAttachment (
    const  NotNull < PermissionAttachment > & attachment
) = 0

Parameters:

  • attachment Attachment to remove

Returns:

true if the specified attachment was removed successfully, false when it isn't part of this object



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