Interface PermissionHolder
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a way to identify distinctPermissionHolders. -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves any temporary permissions that have expired.data()Gets the holdersDataType.NORMALdata.Gets the holdersCachedDataManagercache.Gets theNodeMapof a particular type.Gets a flattened and sorted view of the holders own distinctNodes.Gets a friendly name for this holder, to be displayed in command output, etc.Gets the identifier of the holder.getInheritedGroups(@NonNull QueryOptions queryOptions) Gets a collection of theGroups this holder inherits nodes from.default @NonNull @Unmodifiable Collection<Node>getNodes()Gets a flattened view of the holders ownNodes.default <T extends Node>
@NonNull @Unmodifiable Collection<T>Gets a flattened view of the holders ownNodes of the giventype.Gets the most appropriate query options available at the time for thePermissionHolder.resolveDistinctInheritedNodes(@NonNull QueryOptions queryOptions) Gets a resolved and sorted view of the holders own and inherited distinctNodes.default <T extends Node>
@NonNull @Unmodifiable Collection<T>resolveInheritedNodes(@NonNull NodeType<T> type, @NonNull QueryOptions queryOptions) Gets a resolved view of the holders own and inheritedNodes of a giventype.resolveInheritedNodes(@NonNull QueryOptions queryOptions) Gets a resolved view of the holders own and inheritedNodes.Gets the holdersDataType.TRANSIENTdata.
-
Method Details
-
getIdentifier
@NonNull PermissionHolder.Identifier getIdentifier()Gets the identifier of the holder.- Returns:
- the identifier
-
getFriendlyName
Gets a friendly name for this holder, to be displayed in command output, etc.This will always return a value, eventually falling back to
PermissionHolder.Identifier.getName()if no other "friendlier" identifiers are present.For
Users, this method will attempt to return theusername, before falling back toPermissionHolder.Identifier.getName().For
Groups, this method will attempt to return the groups display name, before falling back toPermissionHolder.Identifier.getName().- Returns:
- a friendly identifier for this holder
-
getQueryOptions
@NonNull QueryOptions getQueryOptions()Gets the most appropriate query options available at the time for thePermissionHolder.For
Users, the most appropriate query options will be theircurrent active query optionsif the corresponding player is online, and otherwise, will fallback tothe current static query optionsif they are offline.For
Groups, the most appropriate query options will always beContextManager.getStaticQueryOptions()the current static query options.- Returns:
- query options
- Since:
- 5.1
-
getCachedData
@NonNull CachedDataManager getCachedData()Gets the holdersCachedDataManagercache.- Returns:
- the holders cached data.
-
getData
Gets theNodeMapof a particular type.- Parameters:
dataType- the data type- Returns:
- the data
-
data
Gets the holdersDataType.NORMALdata.- Returns:
- the normal data
-
transientData
Gets the holdersDataType.TRANSIENTdata.Transient permissions only exist for the duration of the session.
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.
- Returns:
- the transient data
-
getNodes
Gets a flattened view of the holders ownNodes.This list is constructed using the values of both the
normalandtransientbacking node maps.It may contain duplicate entries if the same node is added to both the normal and transient node maps. You can use
getDistinctNodes()for a view without duplicates.This method does not resolve inheritance rules.
- Returns:
- a collection of the holders own nodes.
-
getNodes
Gets a flattened view of the holders ownNodes of the giventype.- Type Parameters:
T- the node type- Parameters:
type- the type of node to filter by- Returns:
- a filtered collection of the holders own nodes
- Since:
- 5.1
- See Also:
-
getDistinctNodes
@NonNull @Unmodifiable SortedSet<Node> getDistinctNodes()Gets a flattened and sorted view of the holders own distinctNodes.Effectively a sorted version of
getNodes(), without duplicates. Use the aforementioned method if you don't require either of these attributes.This method does not resolve inheritance rules.
- Returns:
- a sorted set of the holders own distinct nodes
-
resolveInheritedNodes
Gets a resolved view of the holders own and inheritedNodes.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.
- Parameters:
queryOptions- the query options- Returns:
- a list of the holders inherited nodes
-
resolveInheritedNodes
default <T extends Node> @NonNull @Unmodifiable Collection<T> resolveInheritedNodes(@NonNull NodeType<T> type, @NonNull QueryOptions queryOptions) Gets a resolved view of the holders own and inheritedNodes of a giventype.- Type Parameters:
T- the node type- Parameters:
type- the type of node to filter byqueryOptions- the query options- Returns:
- a filtered list of the holders inherited nodes
- Since:
- 5.1
- See Also:
-
resolveDistinctInheritedNodes
@NonNull @Unmodifiable SortedSet<Node> resolveDistinctInheritedNodes(@NonNull QueryOptions queryOptions) Gets a resolved and sorted view of the holders own and inherited distinctNodes.Effectively a sorted version of
resolveInheritedNodes(QueryOptions), without duplicates. Use the aforementioned method if you don't require either of these attributes.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.
- Parameters:
queryOptions- the query options- Returns:
- a sorted set of the holders distinct inherited nodes
-
getInheritedGroups
Gets a collection of theGroups this holder inherits nodes from.If
Flag.RESOLVE_INHERITANCEis set, this will include holders inherited from both directly and indirectly (through directly inherited groups). It will effectively resolve the whole "inheritance tree".If
Flag.RESOLVE_INHERITANCEis not set, then the traversal will only go one level up the inheritance tree, and return only directly inherited groups.The collection will be ordered according to the platforms inheritance rules. The groups which are inherited from first will appear earlier in the list.
The list will not contain the holder.
- Parameters:
queryOptions- the query options- Returns:
- a collection of the groups the holder inherits from
- Since:
- 5.1
-
auditTemporaryNodes
void auditTemporaryNodes()Removes any temporary permissions that have expired.This method is called periodically by the platform, so it is only necessary to run if you want to guarantee that the current data is totally up-to-date.
-