public class Permission
extends java.lang.Object
Permissible
Modifier and Type | Field | Description |
---|---|---|
static PermissionDefault |
DEFAULT_PERMISSION |
Constructor | Description |
---|---|
Permission(java.lang.String name) |
|
Permission(java.lang.String name,
java.lang.String description) |
|
Permission(java.lang.String name,
java.lang.String description,
java.util.Map<java.lang.String,java.lang.Boolean> children) |
|
Permission(java.lang.String name,
java.lang.String description,
PermissionDefault defaultValue) |
|
Permission(java.lang.String name,
java.lang.String description,
PermissionDefault defaultValue,
java.util.Map<java.lang.String,java.lang.Boolean> children) |
|
Permission(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Boolean> children) |
|
Permission(java.lang.String name,
PermissionDefault defaultValue) |
|
Permission(java.lang.String name,
PermissionDefault defaultValue,
java.util.Map<java.lang.String,java.lang.Boolean> children) |
Modifier and Type | Method | Description |
---|---|---|
Permission |
addParent(java.lang.String name,
boolean value) |
Adds this permission to the specified parent permission.
|
void |
addParent(Permission perm,
boolean value) |
Adds this permission to the specified parent permission.
|
java.util.Map<java.lang.String,java.lang.Boolean> |
getChildren() |
Gets the children of this permission.
|
PermissionDefault |
getDefault() |
Gets the default value of this permission.
|
java.lang.String |
getDescription() |
Gets a brief description of this permission, if set
|
java.lang.String |
getName() |
Returns the unique fully qualified name of this Permission
|
java.util.Set<Permissible> |
getPermissibles() |
Gets a set containing every
Permissible that has this
permission. |
static Permission |
loadPermission(java.lang.String name,
java.util.Map<?,?> data,
PermissionDefault def,
java.util.List<Permission> output) |
Loads a Permission from a map of data, usually used from retrieval from
a yaml file.
|
static Permission |
loadPermission(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> data) |
Loads a Permission from a map of data, usually used from retrieval from
a yaml file.
|
static java.util.List<Permission> |
loadPermissions(java.util.Map<?,?> data,
java.lang.String error,
PermissionDefault def) |
Loads a list of Permissions from a map of data, usually used from
retrieval from a yaml file.
|
void |
recalculatePermissibles() |
Recalculates all
Permissible s that contain this permission. |
void |
setDefault(PermissionDefault value) |
Sets the default value of this permission.
|
void |
setDescription(java.lang.String value) |
Sets the description of this permission.
|
public static final PermissionDefault DEFAULT_PERMISSION
public Permission(java.lang.String name)
public Permission(java.lang.String name, java.lang.String description)
public Permission(java.lang.String name, PermissionDefault defaultValue)
public Permission(java.lang.String name, java.lang.String description, PermissionDefault defaultValue)
public Permission(java.lang.String name, java.util.Map<java.lang.String,java.lang.Boolean> children)
public Permission(java.lang.String name, java.lang.String description, java.util.Map<java.lang.String,java.lang.Boolean> children)
public Permission(java.lang.String name, PermissionDefault defaultValue, java.util.Map<java.lang.String,java.lang.Boolean> children)
public Permission(java.lang.String name, java.lang.String description, PermissionDefault defaultValue, java.util.Map<java.lang.String,java.lang.Boolean> children)
public java.lang.String getName()
public java.util.Map<java.lang.String,java.lang.Boolean> getChildren()
If you change this map in any form, you must call recalculatePermissibles()
to recalculate all Permissible
s
public PermissionDefault getDefault()
public void setDefault(PermissionDefault value)
This will not be saved to disk, and is a temporary operation until the
server reloads permissions. Changing this default will cause all Permissible
s that contain this permission to recalculate their
permissions
value
- The new default to setpublic java.lang.String getDescription()
public void setDescription(java.lang.String value)
This will not be saved to disk, and is a temporary operation until the server reloads permissions.
value
- The new description to setpublic java.util.Set<Permissible> getPermissibles()
Permissible
that has this
permission.
This set cannot be modified.
public void recalculatePermissibles()
Permissible
s that contain this permission.
This should be called after modifying the children, and is automatically called after modifying the default value
public Permission addParent(java.lang.String name, boolean value)
If the parent permission does not exist, it will be created and registered.
name
- Name of the parent permissionvalue
- The value to set this permission topublic void addParent(Permission perm, boolean value)
perm
- Parent permission to register withvalue
- The value to set this permission topublic static java.util.List<Permission> loadPermissions(java.util.Map<?,?> data, java.lang.String error, PermissionDefault def)
The data may contain a list of name:data, where the data contains the following keys:
Map<String, Boolean>
of child permissions. If not
specified, empty list.
data
- Map of permissionserror
- An error message to show if a permission is invalid.def
- Default permission value to use if missingpublic static Permission loadPermission(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> data)
The data may contain the following keys:
Map<String, Boolean>
of child permissions. If not
specified, empty list.
name
- Name of the permissiondata
- Map of keyspublic static Permission loadPermission(java.lang.String name, java.util.Map<?,?> data, PermissionDefault def, java.util.List<Permission> output)
The data may contain the following keys:
Map<String, Boolean>
of child permissions. If not
specified, empty list.
name
- Name of the permissiondata
- Map of keysdef
- Default permission value to use if not setoutput
- A list to append any created child-Permissions to, may be nullCopyright © 2018. All rights reserved.