Interface CachedMetaData
- All Superinterfaces:
CachedData
Meta data refers to prefixes
, suffixes
and
meta (options)
held by a permission holder.
All calls will account for inheritance, as well as any default data provided by the platform. These calls are heavily cached and are therefore fast.
-
Method Summary
Modifier and TypeMethodDescriptiongetMeta()
Gets a map of all accumulatedmeta
.getMetaValue
(@NonNull String key) Gets a value for the given meta key.Gets a value for the given meta key, and runs it through the giventransformer
.Gets the prefix.Gets a sorted map of all accumulatedprefixes
.Gets the definition used for the prefix stack.Gets the name of the holders primary group.Gets the suffix.Gets a sorted map of all accumulatedsuffixes
.Gets the definition used for the suffix stack.queryMetaValue
(@NonNull String key) Query a meta value for the givenkey
.Query for a prefix.Query for a suffix.Methods inherited from interface net.luckperms.api.cacheddata.CachedData
getQueryOptions
-
Method Details
-
queryMetaValue
Query a meta value for the givenkey
.This method will always return a
Result
, but theinner result
String
will be null if a value for the given key was not found.- Parameters:
key
- the key- Returns:
- a result containing the value
- Since:
- 5.4
-
getMetaValue
Gets a value for the given meta key.If no such meta value exists for the given key,
null
is returned.- Parameters:
key
- the key- Returns:
- the value
-
getMetaValue
default <T> @NonNull Optional<T> getMetaValue(@NonNull String key, @NonNull Function<String, ? extends T> valueTransformer) Gets a value for the given meta key, and runs it through the giventransformer
.If no such meta value exists, an
empty optional
is returned. (the transformer will never be passed a null argument)The transformer is allowed to throw
IllegalArgumentException
or return null. This will also result in anempty optional
being returned.For example, to parse and return an integer meta value, use:
getMetaValue("my-int-val", Integer::parseInt).orElse(0);
- Type Parameters:
T
- the type of the transformed result- Parameters:
key
- the keyvalueTransformer
- the transformer used to transform the value- Returns:
- the meta value
- Since:
- 5.3
-
queryPrefix
@NonNull Result<String,PrefixNode> queryPrefix()Query for a prefix.This method uses the rules defined by the
prefix stack
to produce aString
output.Assuming the default configuration is used, this will usually be the value of the holder's highest priority prefix node.
This method will always return a
Result
, but theinner result
String
will be null if a the resultant prefix stack contained no elements.- Returns:
- a result containing the prefix
- Since:
- 5.4
-
getPrefix
Gets the prefix.This method uses the rules defined by the
prefix stack
to produce aString
output.Assuming the default configuration is used, this will usually be the value of the holder's highest priority prefix node.
If the resultant prefix stack contained no elements,
null
is returned.- Returns:
- a prefix string, or null
-
querySuffix
@NonNull Result<String,SuffixNode> querySuffix()Query for a suffix.This method uses the rules defined by the
suffix stack
to produce aString
output.Assuming the default configuration is used, this will usually be the value of the holder's highest priority suffix node.
This method will always return a
Result
, but theinner result
String
will be null if a the resultant suffix stack contained no elements.- Returns:
- a result containing the suffix
- Since:
- 5.4
-
getSuffix
Gets the suffix.This method uses the rules defined by the
suffix stack
to produce aString
output.Assuming the default configuration is used, this will usually be the value of the holder's highest priority suffix node.
If the resultant suffix stack contained no elements,
null
is returned.- Returns:
- a suffix string, or null
-
getMeta
Gets a map of all accumulatedmeta
.Prefer using the
getMetaValue(String)
method for querying values.- Returns:
- a map of meta
-
getPrefixes
@NonNull @Unmodifiable SortedMap<Integer,String> getPrefixes()Gets a sorted map of all accumulatedprefixes
.Prefer using the
getPrefix()
method for querying.- Returns:
- a sorted map of prefixes
-
getSuffixes
@NonNull @Unmodifiable SortedMap<Integer,String> getSuffixes()Gets a sorted map of all accumulatedsuffixes
.Prefer using the
getSuffix()
method for querying.- Returns:
- a sorted map of suffixes
-
getPrimaryGroup
Gets the name of the holders primary group.Will return
null
for Group holder types.- Returns:
- the name of the primary group
- Since:
- 5.1
-
getPrefixStackDefinition
@NonNull MetaStackDefinition getPrefixStackDefinition()Gets the definition used for the prefix stack.- Returns:
- the definition used for the prefix stack
-
getSuffixStackDefinition
@NonNull MetaStackDefinition getSuffixStackDefinition()Gets the definition used for the suffix stack.- Returns:
- the definition used for the suffix stack
-