| Modifier and Type | Method and Description |
|---|---|
void |
auditTemporaryPermissions()
Removes any temporary permissions that have expired.
|
void |
clearMatching(@NonNull Predicate<Node> test)
Clears any nodes from the holder which pass the predicate.
|
void |
clearMatchingTransient(@NonNull Predicate<Node> test)
Clears any transient nodes from the holder which pass the predicate.
|
void |
clearMeta()
Clears all meta held by the permission holder.
|
void |
clearMeta(@NonNull ContextSet contextSet)
Clears all meta held by the permission holder in a specific context.
|
void |
clearNodes()
Clears all nodes held by the permission holder.
|
void |
clearNodes(@NonNull ContextSet contextSet)
Clears all nodes held by the permission holder in a specific context.
|
void |
clearParents()
Clears all parent groups.
|
void |
clearParents(@NonNull ContextSet contextSet)
Clears all parent groups in a specific context.
|
void |
clearTransientNodes()
Clears all transient nodes the permission holder has.
|
@NonNull Map<String,Boolean> |
exportNodes(@NonNull Contexts contexts,
boolean convertToLowercase)
Converts the output of
getAllNodesFiltered(Contexts) into string and boolean form,
and expands shorthand permissions. |
@NonNull SortedSet<LocalizedNode> |
getAllNodes()
Gets a mutable sorted set of the nodes that this object has and inherits.
|
@NonNull SortedSet<LocalizedNode> |
getAllNodes(@NonNull Contexts contexts)
Gets a mutable sorted set of the nodes that this object has and inherits, filtered by context
|
@NonNull Set<LocalizedNode> |
getAllNodesFiltered(@NonNull Contexts contexts)
Gets a mutable set of the nodes that this object has and inherits, filtered by context.
|
@NonNull CachedData |
getCachedData()
Gets the holders
CachedData cache. |
@NonNull Set<? extends Node> |
getEnduringPermissions()
Similar to
getPermissions(), except only including permissions from the enduring
node map. |
@NonNull String |
getFriendlyName()
Gets a friendly name for this holder, to be displayed in command output, etc.
|
@NonNull ImmutableSetMultimap<ImmutableContextSet,Node> |
getNodes()
Gets the backing multimap containing every permission this holder has.
|
@NonNull String |
getObjectName()
Gets the objects generic name.
|
@NonNull List<Node> |
getOwnNodes()
Gets a flattened/squashed view of the holders permissions.
|
@NonNull Set<Node> |
getPermanentPermissionNodes()
A filtered view of this holders nodes, only including permanent entries.
|
@NonNull SortedSet<? extends Node> |
getPermissions()
Gets a sorted set of all held permissions.
|
@NonNull Set<Node> |
getTemporaryPermissionNodes()
A filtered view of this holders nodes, only including temporary entries.
|
@NonNull ImmutableSetMultimap<ImmutableContextSet,Node> |
getTransientNodes()
Gets the backing multimap containing every transient permission this holder has.
|
@NonNull Set<? extends Node> |
getTransientPermissions()
Similar to
getPermissions(), except only including permissions from the enduring
node map. |
@NonNull Tristate |
hasPermission(@NonNull Node node)
Checks to see if the object has a certain permission.
|
@NonNull Tristate |
hasPermission(@NonNull Node node,
@NonNull NodeEqualityPredicate equalityPredicate)
Checks to see if the object has a certain permission.
|
@NonNull Tristate |
hasTransientPermission(@NonNull Node node)
Checks to see if the object has a certain permission.
|
@NonNull Tristate |
hasTransientPermission(@NonNull Node node,
@NonNull NodeEqualityPredicate equalityPredicate)
Checks to see if the object has a certain permission.
|
boolean |
inheritsGroup(@NonNull Group group)
Check to see if this holder inherits another group in the global context.
|
boolean |
inheritsGroup(@NonNull Group group,
@NonNull ContextSet contextSet)
Check to see if this holder inherits another group.
|
@NonNull Tristate |
inheritsPermission(@NonNull Node node)
Checks to see if the object inherits a certain permission.
|
@NonNull Tristate |
inheritsPermission(@NonNull Node node,
@NonNull NodeEqualityPredicate equalityPredicate)
Checks to see if the object inherits a certain permission.
|
@NonNull CompletableFuture<Void> |
refreshCachedData()
Refreshes and applies any changes to the cached holder data.
|
@NonNull List<LocalizedNode> |
resolveInheritances()
Recursively resolves this holders permissions.
|
@NonNull List<LocalizedNode> |
resolveInheritances(@NonNull Contexts contexts)
Recursively resolves this holders permissions.
|
@NonNull DataMutateResult |
setPermission(@NonNull Node node)
Sets a permission node for the permission holder.
|
@NonNull TemporaryDataMutateResult |
setPermission(@NonNull Node node,
@NonNull TemporaryMergeBehaviour temporaryMergeBehaviour)
Sets a permission node for the permission holder.
|
default @NonNull DataMutateResult |
setPermissionUnchecked(@NonNull Node node)
Deprecated.
now forwards to
setPermission(Node). |
@NonNull DataMutateResult |
setTransientPermission(@NonNull Node node)
Sets a transient permission for the permission holder.
|
@NonNull TemporaryDataMutateResult |
setTransientPermission(@NonNull Node node,
@NonNull TemporaryMergeBehaviour temporaryMergeBehaviour)
Sets a transient permission for the permission holder.
|
default @NonNull DataMutateResult |
setTransientPermissionUnchecked(@NonNull Node node)
Deprecated.
now forwards to
setTransientPermission(Node) |
@NonNull DataMutateResult |
unsetPermission(@NonNull Node node)
Unsets a permission for the permission holder.
|
default @NonNull DataMutateResult |
unsetPermissionUnchecked(@NonNull Node node)
Deprecated.
now forwards to
unsetPermission(Node) |
@NonNull DataMutateResult |
unsetTransientPermission(@NonNull Node node)
Unsets a transient permission for the permission holder.
|
default @NonNull DataMutateResult |
unsetTransientPermissionUnchecked(@NonNull Node node)
Deprecated.
now forwards to
unsetTransientPermission(Node) |
@NonNull String getObjectName()
The result of this method is guaranteed to be a unique identifier for distinct instances of the same type of object.
For Users, this method returns a string representation of
the users unique id.
For Groups, this method returns the group name.
The User.getUuid(), User.getName() and Group.getName() methods
define a "tighter" specification for obtaining object identifiers.
@NonNull String getFriendlyName()
This will always return a value, eventually falling back to
getObjectName() if no other "friendlier" identifiers are present.
For Users, this method will attempt to return the username,
before falling back to getObjectName().
For Groups, this method will attempt to return the groups display name, before
falling back to getObjectName().
@NonNull CachedData getCachedData()
CachedData cache.@NonNull CompletableFuture<Void> refreshCachedData()
Calling this method is unnecessary in most cases. Cache updates are handled behind the scenes by the implementation.
@NonNull ImmutableSetMultimap<ImmutableContextSet,Node> getNodes()
This method does not resolve inheritance rules, and returns a view of what's 'in the file'.
@NonNull ImmutableSetMultimap<ImmutableContextSet,Node> getTransientNodes()
This method does not resolve inheritance rules.
Transient permissions only exist for the duration of the session.
@NonNull List<Node> getOwnNodes()
This list is constructed using the Multimap.values() method
of both the transient and enduring backing multimaps.
This means that it may contain duplicate entries.
Use getPermissions() for a view without duplicates.
This method does not resolve inheritance rules.
@NonNull SortedSet<? extends Node> getPermissions()
Effectively a sorted version of getOwnNodes(), without duplicates. Use the
aforementioned method if you don't require either of these attributes.
This method does not resolve inheritance rules.
Although this method is named getPermissions, it will actually return all types of node.
@NonNull Set<? extends Node> getEnduringPermissions()
getPermissions(), except only including permissions from the enduring
node map. (See getNodes())
Unlike transient permissions, enduring permissions will be saved to storage, and exist after the session.
This method does not resolve inheritance rules.
Although this method is named getEnduringPermissions, it will actually return all types of node.
@NonNull Set<? extends Node> getTransientPermissions()
getPermissions(), except only including permissions from the enduring
node map. (See getTransientNodes())
Transient permissions only exist for the duration of the session.
This method does not resolve inheritance rules.
Although this method is named getTransientPermissions, it will actually return all types of node.
@NonNull Set<Node> getPermanentPermissionNodes()
Data is sourced from getOwnNodes(), filtered, and then collected to a set.
This method does not resolve inheritance rules.
Although this method is named getPermanentPermissionNodes, it will actually return all types of node.
@NonNull Set<Node> getTemporaryPermissionNodes()
Data is sourced from getOwnNodes(), filtered, and then collected to a set.
This method does not resolve inheritance rules.
Although this method is named getTemporaryPermissionNodes, it will actually return all types of node.
@NonNull List<LocalizedNode> resolveInheritances(@NonNull Contexts contexts)
The returned list will contain every inherited node the holder has, in the order that they were inherited in.
This means the list will contain duplicates.
Inheritance is performed according to the platforms rules, and the order will vary depending on the accumulation order. By default, the holders own nodes are first in the list, with the entries from the end of the inheritance tree appearing last.
contexts - the contexts for the lookup@NonNull List<LocalizedNode> resolveInheritances()
The returned list will contain every inherited node the holder has, in the order that they were inherited in.
This means the list will contain duplicates.
Unlike resolveInheritances(Contexts), this method does not
filter by context, at all.
Inheritance is performed according to the platforms rules, and the order will vary depending on the accumulation order. By default, the holders own nodes are first in the list, with the entries from the end of the inheritance tree appearing last.
@NonNull SortedSet<LocalizedNode> getAllNodes(@NonNull Contexts contexts)
Unlike getAllNodesFiltered(Contexts), this method will not filter individual
nodes by context. The context is only used to determine which groups should apply.
Nodes are sorted into priority order. The order of inheritance is only important during the process of flattening inherited entries.
contexts - the context for the lookupNullPointerException - if the context is null@NonNull SortedSet<LocalizedNode> getAllNodes()
Unlike getAllNodes(Contexts), this method does not filter by context, at all.
Nodes are sorted into priority order. The order of inheritance is only important during the process of flattening inherited entries.
NullPointerException - if the context is null@NonNull Set<LocalizedNode> getAllNodesFiltered(@NonNull Contexts contexts)
Unlike getAllNodes(Contexts), this method WILL filter individual nodes,
and only return ones that fully meet the context provided.
contexts - the context for the lookupNullPointerException - if the context is null@NonNull Map<String,Boolean> exportNodes(@NonNull Contexts contexts, boolean convertToLowercase)
getAllNodesFiltered(Contexts) into string and boolean form,
and expands shorthand permissions.contexts - the context for the lookupconvertToLowercase - if the keys should be made lowercase whilst being exportedvoid auditTemporaryPermissions()
This method is called periodically by the platform, so it is only necessary to run if you want to guarentee that the current data is totally up-to-date.
@NonNull Tristate hasPermission(@NonNull Node node, @NonNull NodeEqualityPredicate equalityPredicate)
Although this method is named hasPermission, it can be used for all node types.
node - the node to check forequalityPredicate - how to determine if a node matchesNullPointerException - if the node is null@NonNull Tristate hasTransientPermission(@NonNull Node node, @NonNull NodeEqualityPredicate equalityPredicate)
Although this method is named hasTransientPermission, it can be used for all node types.
node - the node to check forequalityPredicate - how to determine if a node matchesNullPointerException - if the node is null@NonNull Tristate inheritsPermission(@NonNull Node node, @NonNull NodeEqualityPredicate equalityPredicate)
Although this method is named inheritsPermission, it can be used for all node types.
node - the node to check forequalityPredicate - how to determine if a node matchesNullPointerException - if the node is null@NonNull Tristate hasPermission(@NonNull Node node)
Although this method is named hasPermission, it can be used for all node types.
node - the node to check forNullPointerException - if the node is null@NonNull Tristate hasTransientPermission(@NonNull Node node)
Although this method is named hasTransientPermission, it can be used for all node types.
node - the node to check forNullPointerException - if the node is null@NonNull Tristate inheritsPermission(@NonNull Node node)
Although this method is named inheritsPermission, it can be used for all node types.
node - the node to check forNullPointerException - if the node is nullboolean inheritsGroup(@NonNull Group group)
"Global context" simply means an empty context set.
This method only checks for direct inheritance - one hop up the inheritance tree.
group - The group to check membership ofNullPointerException - if the group is nullIllegalStateException - if the group instance was not obtained from LuckPerms.boolean inheritsGroup(@NonNull Group group, @NonNull ContextSet contextSet)
This method only checks for direct inheritance - one hop up the inheritance tree.
group - The group to check membership ofcontextSet - the context set to filter byNullPointerException - if the group is nullIllegalStateException - if the group instance was not obtained from LuckPerms.@NonNull DataMutateResult setPermission(@NonNull Node node)
Although this method is named setPermission, it can be used for all node types.
The effect of this mutate operation will not persist in storage unless changes are
explicitly saved. If changes are not saved, the effect will only be observed until the next
time the holders permission data is (re)loaded. Changes to Users should be saved
using UserManager.saveUser(User), and changes to Groups should be saved
using GroupManager.saveGroup(Group).
Before making changes to a user or group, it may be a good idea to load a fresh copy of
the backing data from the storage if you haven't done so already, to avoid overwriting changes
made already. This can be done via UserManager.loadUser(UUID) or
GroupManager.loadGroup(String) respectively.
node - The node to be setNullPointerException - if the node is null@NonNull TemporaryDataMutateResult setPermission(@NonNull Node node, @NonNull TemporaryMergeBehaviour temporaryMergeBehaviour)
Although this method is named setPermission, it can be used for all node types.
The effect of this mutate operation will not persist in storage unless changes are
explicitly saved. If changes are not saved, the effect will only be observed until the next
time the holders permission data is (re)loaded. Changes to Users should be saved
using UserManager.saveUser(User), and changes to Groups should be saved
using GroupManager.saveGroup(Group).
Before making changes to a user or group, it may be a good idea to load a fresh copy of
the backing data from the storage if you haven't done so already, to avoid overwriting changes
made already. This can be done via UserManager.loadUser(UUID) or
GroupManager.loadGroup(String) respectively.
node - The node to be settemporaryMergeBehaviour - The behaviour used to merge temporary permission entriesNullPointerException - if the node is null@NonNull DataMutateResult setTransientPermission(@NonNull Node node)
A transient node is a permission that does not persist. Whenever a user logs out of the server, or the server restarts, this permission will disappear. It is never saved to the datastore, and therefore will not apply on other servers.
This is useful if you want to temporarily set a permission for a user while they're online, but don't want it to persist, and have to worry about removing it when they log out.
For unsetting a transient permission, see unsetTransientPermission(Node).
Although this method is named setTransientPermission, it can be used for all node types.
node - The node to be setNullPointerException - if the node is null@NonNull TemporaryDataMutateResult setTransientPermission(@NonNull Node node, @NonNull TemporaryMergeBehaviour temporaryMergeBehaviour)
A transient node is a permission that does not persist. Whenever a user logs out of the server, or the server restarts, this permission will disappear. It is never saved to the datastore, and therefore will not apply on other servers.
This is useful if you want to temporarily set a permission for a user while they're online, but don't want it to persist, and have to worry about removing it when they log out.
For unsetting a transient permission, see unsetTransientPermission(Node).
Although this method is named setTransientPermission, it can be used for all node types.
node - The node to be setemporaryMergeBehaviour - The behaviour used to merge temporary permission entriesNullPointerException - if the node is null@NonNull DataMutateResult unsetPermission(@NonNull Node node)
Although this method is named unsetPermission, it can be used for all node types.
The effect of this mutate operation will not persist in storage unless changes are
explicitly saved. If changes are not saved, the effect will only be observed until the next
time the holders permission data is (re)loaded. Changes to Users should be saved
using UserManager.saveUser(User), and changes to Groups should be saved
using GroupManager.saveGroup(Group).
Before making changes to a user or group, it may be a good idea to load a fresh copy of
the backing data from the storage if you haven't done so already, to avoid overwriting changes
made already. This can be done via UserManager.loadUser(UUID) or
GroupManager.loadGroup(String) respectively.
node - The node to be unsetNullPointerException - if the node is null@NonNull DataMutateResult unsetTransientPermission(@NonNull Node node)
Although this method is named unsetTransientPermission, it can be used for all node types.
node - The node to be unsetNullPointerException - if the node is nullvoid clearMatching(@NonNull Predicate<Node> test)
This method only targets enduring data.
The effect of this mutate operation will not persist in storage unless changes are
explicitly saved. If changes are not saved, the effect will only be observed until the next
time the holders permission data is (re)loaded. Changes to Users should be saved
using UserManager.saveUser(User), and changes to Groups should be saved
using GroupManager.saveGroup(Group).
Before making changes to a user or group, it may be a good idea to load a fresh copy of
the backing data from the storage if you haven't done so already, to avoid overwriting changes
made already. This can be done via UserManager.loadUser(UUID) or
GroupManager.loadGroup(String) respectively.
test - the predicate to test for nodes which should be removedvoid clearMatchingTransient(@NonNull Predicate<Node> test)
The effect of this mutate operation will not persist in storage unless changes are
explicitly saved. If changes are not saved, the effect will only be observed until the next
time the holders permission data is (re)loaded. Changes to Users should be saved
using UserManager.saveUser(User), and changes to Groups should be saved
using GroupManager.saveGroup(Group).
Before making changes to a user or group, it may be a good idea to load a fresh copy of
the backing data from the storage if you haven't done so already, to avoid overwriting changes
made already. This can be done via UserManager.loadUser(UUID) or
GroupManager.loadGroup(String) respectively.
test - the predicate to test for nodes which should be removedvoid clearNodes()
The effect of this mutate operation will not persist in storage unless changes are
explicitly saved. If changes are not saved, the effect will only be observed until the next
time the holders permission data is (re)loaded. Changes to Users should be saved
using UserManager.saveUser(User), and changes to Groups should be saved
using GroupManager.saveGroup(Group).
Before making changes to a user or group, it may be a good idea to load a fresh copy of
the backing data from the storage if you haven't done so already, to avoid overwriting changes
made already. This can be done via UserManager.loadUser(UUID) or
GroupManager.loadGroup(String) respectively.
void clearNodes(@NonNull ContextSet contextSet)
The effect of this mutate operation will not persist in storage unless changes are
explicitly saved. If changes are not saved, the effect will only be observed until the next
time the holders permission data is (re)loaded. Changes to Users should be saved
using UserManager.saveUser(User), and changes to Groups should be saved
using GroupManager.saveGroup(Group).
Before making changes to a user or group, it may be a good idea to load a fresh copy of
the backing data from the storage if you haven't done so already, to avoid overwriting changes
made already. This can be done via UserManager.loadUser(UUID) or
GroupManager.loadGroup(String) respectively.
contextSet - the contexts to filter byvoid clearParents()
The effect of this mutate operation will not persist in storage unless changes are
explicitly saved. If changes are not saved, the effect will only be observed until the next
time the holders permission data is (re)loaded. Changes to Users should be saved
using UserManager.saveUser(User), and changes to Groups should be saved
using GroupManager.saveGroup(Group).
Before making changes to a user or group, it may be a good idea to load a fresh copy of
the backing data from the storage if you haven't done so already, to avoid overwriting changes
made already. This can be done via UserManager.loadUser(UUID) or
GroupManager.loadGroup(String) respectively.
void clearParents(@NonNull ContextSet contextSet)
The effect of this mutate operation will not persist in storage unless changes are
explicitly saved. If changes are not saved, the effect will only be observed until the next
time the holders permission data is (re)loaded. Changes to Users should be saved
using UserManager.saveUser(User), and changes to Groups should be saved
using GroupManager.saveGroup(Group).
Before making changes to a user or group, it may be a good idea to load a fresh copy of
the backing data from the storage if you haven't done so already, to avoid overwriting changes
made already. This can be done via UserManager.loadUser(UUID) or
GroupManager.loadGroup(String) respectively.
contextSet - the contexts to filter byvoid clearMeta()
Meta nodes in this case, are any nodes which have a MetaType, PrefixType
or SuffixType type.
The effect of this mutate operation will not persist in storage unless changes are
explicitly saved. If changes are not saved, the effect will only be observed until the next
time the holders permission data is (re)loaded. Changes to Users should be saved
using UserManager.saveUser(User), and changes to Groups should be saved
using GroupManager.saveGroup(Group).
Before making changes to a user or group, it may be a good idea to load a fresh copy of
the backing data from the storage if you haven't done so already, to avoid overwriting changes
made already. This can be done via UserManager.loadUser(UUID) or
GroupManager.loadGroup(String) respectively.
void clearMeta(@NonNull ContextSet contextSet)
Meta nodes in this case, are any nodes which have a MetaType, PrefixType
or SuffixType type.
The effect of this mutate operation will not persist in storage unless changes are
explicitly saved. If changes are not saved, the effect will only be observed until the next
time the holders permission data is (re)loaded. Changes to Users should be saved
using UserManager.saveUser(User), and changes to Groups should be saved
using GroupManager.saveGroup(Group).
Before making changes to a user or group, it may be a good idea to load a fresh copy of
the backing data from the storage if you haven't done so already, to avoid overwriting changes
made already. This can be done via UserManager.loadUser(UUID) or
GroupManager.loadGroup(String) respectively.
contextSet - the contexts to filter byvoid clearTransientNodes()
@Deprecated default @NonNull DataMutateResult setPermissionUnchecked(@NonNull Node node)
setPermission(Node).node - The node to be setNullPointerException - if the node is null@Deprecated default @NonNull DataMutateResult setTransientPermissionUnchecked(@NonNull Node node)
setTransientPermission(Node)node - The node to be setNullPointerException - if the node is null@Deprecated default @NonNull DataMutateResult unsetPermissionUnchecked(@NonNull Node node)
unsetPermission(Node)node - The node to be unsetNullPointerException - if the node is null@Deprecated default @NonNull DataMutateResult unsetTransientPermissionUnchecked(@NonNull Node node)
unsetTransientPermission(Node)node - The node to be unsetNullPointerException - if the node is null