Package net.luckperms.api.cacheddata
Interface CachedMetaData
-
- All Superinterfaces:
CachedData
public interface CachedMetaData extends CachedData
Holds cached meta lookup data for a specific set of contexts.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description @NonNull @Unmodifiable Map<String,List<String>>getMeta()Gets an immutable copy of the meta this holder has.@Nullable StringgetMetaValue(@NonNull String key)Gets a value for the given meta key.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.@Nullable StringgetPrefix()Gets the holder's highest priority prefix, or null if the holder has no prefixes@NonNull @Unmodifiable SortedMap<Integer,String>getPrefixes()Gets an immutable sorted map of all of the prefixes the holder has, whereby the first value is the highest priority prefix.@NonNull MetaStackDefinitiongetPrefixStackDefinition()Gets the definition used for the prefix stack@Nullable StringgetPrimaryGroup()Gets the name of the holders primary group.@Nullable StringgetSuffix()Gets the holder's highest priority suffix, or null if the holder has no suffixes@NonNull @Unmodifiable SortedMap<Integer,String>getSuffixes()Gets an immutable sorted map of all of the suffixes the holder has, whereby the first value is the highest priority suffix.@NonNull MetaStackDefinitiongetSuffixStackDefinition()Gets the definition used for the suffix stack-
Methods inherited from interface net.luckperms.api.cacheddata.CachedData
getQueryOptions
-
-
-
-
Method Detail
-
getMetaValue
@Nullable String getMetaValue(@NonNull String key)
Gets a value for the given meta key.- 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 optionalis returned. (the transformer will never be passed a null argument)The transformer is allowed to throw
IllegalArgumentExceptionor return null. This will also result in anempty optionalbeing 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
-
getPrefix
@Nullable String getPrefix()
Gets the holder's highest priority prefix, or null if the holder has no prefixes- Returns:
- a prefix string, or null
-
getSuffix
@Nullable String getSuffix()
Gets the holder's highest priority suffix, or null if the holder has no suffixes- Returns:
- a suffix string, or null
-
getMeta
@NonNull @Unmodifiable Map<String,List<String>> getMeta()
Gets an immutable copy of the meta this holder has.- Returns:
- an immutable map of meta
-
getPrefixes
@NonNull @Unmodifiable SortedMap<Integer,String> getPrefixes()
Gets an immutable sorted map of all of the prefixes the holder has, whereby the first value is the highest priority prefix.- Returns:
- a sorted map of prefixes
-
getSuffixes
@NonNull @Unmodifiable SortedMap<Integer,String> getSuffixes()
Gets an immutable sorted map of all of the suffixes the holder has, whereby the first value is the highest priority suffix.- Returns:
- a sorted map of suffixes
-
getPrimaryGroup
@Nullable String getPrimaryGroup()
Gets the name of the holders primary group.Will return
nullfor 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
-
-