endstone::Permission
Represents a unique permission that may be attached to a Permissible .
Attributes:
Name | Description |
---|---|
DefaultPermission |
Functions:
Name | Description |
---|---|
Permission | |
addParent | |
addParent | |
getChildren | |
getDefault | |
getDescription | |
getName | |
getPermissibles | |
init | |
recalculatePermissibles | |
setDefault | |
setDescription |
DefaultPermission
const PermissionDefault endstone::Permission::DefaultPermission;
Permission
Permission(std::string name, std::string description = "",
PermissionDefault default_value = DefaultPermission,
std::unordered_map<std::string, bool> children = {})
addParent
Permission *addParent(std::string name, bool value)
Adds this permission to the specified parent permission.
If the parent permission does not exist, it will be created and registered.
Parameters:
name
Name of the parent permissionvalue
The value to set this permission to
Returns:
Parent permission it created or loaded
void addParent(Permission &perm, bool value) const
Adds this permission to the specified parent permission.
Parameters:
perm
Parent permission to register withvalue
The value to set this permission to
getChildren
std::unordered_map<std::string, bool> &getChildren()
Gets the children of this permission. If you change this map in any form, you must call recalculatePermissibles() to recalculate all Permissibles
Returns:
Permission children
getDefault
PermissionDefault getDefault() const
Gets the default value of this permission.
Returns:
Default value of this permission.
getDescription
std::string getDescription() const
Gets a brief description of this permission, may be empty
Returns:
Brief description of this permission
getName
std::string getName() const
Returns the unique fully qualified name of this Permission
Returns:
Fully qualified name
getPermissibles
std::unordered_set<Permissible *> getPermissibles() const
Gets a set containing every Permissible that has this permission. This set cannot be modified.
Returns:
Set containing permissibles with this permission
init
void init(PluginManager &plugin_manager)
recalculatePermissibles
void recalculatePermissibles()
Recalculates all Permissibles that contain this permission.
This should be called after modifying the children, and is automatically called after modifying the default value
setDefault
void setDefault(PermissionDefault value)
Sets the default value of this permission.
This will not be saved to disk, and is a temporary operation until the server reloads permissions. Changing this default will cause all Permissibles that contain this permission to recalculate their permissions
Parameters:
value
The new default to set
setDescription
void setDescription(std::string value)
Sets the description of this permission.
This will not be saved to disk, and is a temporary operation until the server reloads permissions.
Parameters:
value
The new description to set