endstone::Permissible
Represents an object that may become a server operator and can be assigned permissions.
Functions:
Name | Description |
---|---|
addAttachment | Adds a new PermissionAttachment with a single permission by name and value. |
addAttachment | Adds a new empty PermissionAttachment to this object. |
asCommandSender | Casts a Permissible as CommandSender . |
getEffectivePermissions | Gets a set containing all the permissions currently in effect by this object. |
getPermissionLevel | Gets the permission level of this object. |
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. |
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. |
isPermissionSet | Checks if this object contains an override for the specified permission, by fully qualified name. |
isPermissionSet | Checks if this object contains an override for the specified Permission . |
recalculatePermissions | Recalculates the permissions for this object, if the attachments have changed values. This should very rarely need to be called from a plugin. |
removeAttachment | Removes the given PermissionAttachment from this object. |
addAttachment
PermissionAttachment *addAttachment(Plugin &plugin, const std::string &name,
bool value)
Adds a new PermissionAttachment with a single permission by name and value.
Parameters:
plugin
Plugin responsible for this attachment, may not be null or disabledname
Name of the permission to attachvalue
Value of the permission
Returns:
The PermissionAttachment that was just created
PermissionAttachment *addAttachment(Plugin &plugin)
Adds a new empty PermissionAttachment to this object.
Parameters:
plugin
Plugin responsible for this attachment, may not be null or disabled
Returns:
The PermissionAttachment that was just created
asCommandSender
CommandSender *asCommandSender() const
Casts a Permissible as CommandSender .
Returns:
CommandSender, nullptr if not a CommandSender
getEffectivePermissions
std::unordered_set<PermissionAttachmentInfo *> getEffectivePermissions() const
Gets a set containing all the permissions currently in effect by this object.
Returns:
Set of currently effective permissions
getPermissionLevel
PermissionLevel getPermissionLevel() const
Gets the permission level of this object.
Returns:
The permission level
hasPermission
bool hasPermission(std::string name) 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.
Parameters:
name
Name of the permission
Returns:
Value of the permission
bool hasPermission(const Permission &perm) 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.
Parameters:
perm
Permission to get
Returns:
Value of the permission
isPermissionSet
bool isPermissionSet(std::string name) const
Checks if this object contains an override for the specified permission, by fully qualified name.
Parameters:
name
Name of the permission
Returns:
true if the permission is set, otherwise false
bool isPermissionSet(const Permission &perm) const
Checks if this object contains an override for the specified Permission .
Parameters:
perm
Permission to check
Returns:
true if the permission is set, otherwise false
recalculatePermissions
void recalculatePermissions()
Recalculates the permissions for this object, if the attachments have changed values. This should very rarely need to be called from a plugin.
removeAttachment
Result<void> removeAttachment(PermissionAttachment &attachment)
Removes the given PermissionAttachment from this object.
Parameters:
attachment
Attachment to remove
Returns:
true if the specified attachment was removed successfully, false when it isn’t part of this object