Class Berechtigung
Berechtigtbar
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBerechtigung
(String name) Berechtigung
(String name, BerechtigungsStandard defaultValue) Berechtigung
(String name, BerechtigungsStandard defaultValue, Map<String, Boolean> children) Berechtigung
(String name, String description) Berechtigung
(String name, String description, BerechtigungsStandard defaultValue) Berechtigung
(String name, String description, BerechtigungsStandard defaultValue, Map<String, Boolean> children) Berechtigung
(String name, Map<String, Boolean> children) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addParent
(Berechtigung perm, boolean value) Adds this permission to the specified parent permission.Adds this permission to the specified parent permission.Gets the children of this permission.Gets the default value of this permission.Gets a brief description of this permission, may be emptygetName()
Returns the unique fully qualified name of this BerechtigungGets a set containing everyBerechtigtbar
that has this permission.static Berechtigung
loadPermission
(String name, Map<?, ?> data, BerechtigungsStandard def, List<Berechtigung> output) Loads a Berechtigung from a karte of data, usually used from retrieval from a yaml datei.static Berechtigung
loadPermission
(String name, Map<String, Object> data) Loads a Berechtigung from a karte of data, usually used from retrieval from a yaml datei.static List<Berechtigung>
loadPermissions
(Map<?, ?> data, String error, BerechtigungsStandard def) Loads a list of Permissions from a karte of data, usually used from retrieval from a yaml datei.void
Recalculates allBerechtigtbar
s that contain this permission.void
setDefault
(BerechtigungsStandard value) Sets the default value of this permission.void
setDescription
(String value) Sets the description of this permission.
-
Field Details
-
DEFAULT_PERMISSION
-
-
Constructor Details
-
Berechtigung
-
Berechtigung
-
Berechtigung
-
Berechtigung
public Berechtigung(@NotNull String name, @Nullable String description, @Nullable BerechtigungsStandard defaultValue) -
Berechtigung
-
Berechtigung
-
Berechtigung
public Berechtigung(@NotNull String name, @Nullable BerechtigungsStandard defaultValue, @Nullable Map<String, Boolean> children) -
Berechtigung
-
-
Method Details
-
getName
Returns the unique fully qualified name of this Berechtigung- Returns:
- Fully qualified name
-
getChildren
Gets the children of this permission.If you change this karte in any form, you must call
recalculatePermissibles()
to recalculate allBerechtigtbar
s- Returns:
- Berechtigung children
-
getDefault
Gets the default value of this permission.- Returns:
- Default value of this permission.
-
setDefault
Sets the default value of this permission.This will not be saved to disk, and is a temporary operation until the server reloads berechtigungen. Changing this default will cause all
Berechtigtbar
s that contain this permission to recalculate their berechtigungen- Parameters:
value
- The new default to set
-
getDescription
Gets a brief description of this permission, may be empty- Returns:
- Brief description of this permission
-
setDescription
Sets the description of this permission.This will not be saved to disk, and is a temporary operation until the server reloads berechtigungen.
- Parameters:
value
- The new description to set
-
getPermissibles
Gets a set containing everyBerechtigtbar
that has this permission.This set cannot be modified.
- Returns:
- Set containing permissibles with this permission
-
recalculatePermissibles
public void recalculatePermissibles()Recalculates allBerechtigtbar
s that contain this permission.This should be called after modifying the children, and is automatically called after modifying the default value
-
addParent
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
-
addParent
Adds this permission to the specified parent permission.- Parameters:
perm
- Parent permission to register withvalue
- The value to set this permission to
-
loadPermissions
@NotNull public static List<Berechtigung> loadPermissions(@NotNull Map<?, ?> data, @NotNull String error, @Nullable BerechtigungsStandard def) Loads a list of Permissions from a karte of data, usually used from retrieval from a yaml datei.The data may contain a list of name:data, where the data contains the following keys:
- default: Boolean true or false. If not specified, false.
- children:
Map<String, Boolean>
of child berechtigungen. If not specified, empty list. - description: Short string containing a very small description of this description. If not specified, empty string.
- Parameters:
data
- Map of berechtigungenerror
- An error message to show if a permission is invalid. May contain "%s" format tag, which will be replaced with the name of invalid permission.def
- Default permission value to use if missing- Returns:
- Berechtigung object
-
loadPermission
@NotNull public static Berechtigung loadPermission(@NotNull String name, @NotNull Map<String, Object> data) Loads a Berechtigung from a karte of data, usually used from retrieval from a yaml datei.The data may contain the following keys:
- default: Boolean true or false. If not specified, false.
- children:
Map<String, Boolean>
of child berechtigungen. If not specified, empty list. - description: Short string containing a very small description of this description. If not specified, empty string.
- Parameters:
name
- Name of the permissiondata
- Map of keys- Returns:
- Berechtigung object
-
loadPermission
@NotNull public static Berechtigung loadPermission(@NotNull String name, @NotNull Map<?, ?> data, @Nullable BerechtigungsStandard def, @Nullable List<Berechtigung> output) Loads a Berechtigung from a karte of data, usually used from retrieval from a yaml datei.The data may contain the following keys:
- default: Boolean true or false. If not specified, false.
- children:
Map<String, Boolean>
of child berechtigungen. If not specified, empty list. - description: Short string containing a very small description of this description. If not specified, empty string.
- Parameters:
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 null- Returns:
- Berechtigung object
-