Package net.luckperms.api.context
Interface StaticContextCalculator
- All Superinterfaces:
ContextCalculator<Object>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Extension of
ContextCalculator which provides the same context
regardless of the subject.-
Method Summary
Modifier and TypeMethodDescriptiondefault voidcalculate(@NonNull Object target, @NonNull ContextConsumer consumer) Submits any contexts this calculator determines to be applicable to thetargetcontextual subject.voidcalculate(@NonNull ContextConsumer consumer) Submits any contexts this calculator determines to be applicable.static StaticContextCalculatorforSingleContext(String key, Supplier<String> valueFunction) Creates a newStaticContextCalculatorthat provides a single context.Methods inherited from interface net.luckperms.api.context.ContextCalculator
estimatePotentialContexts
-
Method Details
-
forSingleContext
Creates a newStaticContextCalculatorthat provides a single context.- Parameters:
key- the key of the context provided by the calculatorvalueFunction- the function used to compute the corresponding value for each query. A context will not be "accumulated" if the value returned is null.- Returns:
- the resultant calculator
-
calculate
Submits any contexts this calculator determines to be applicable.Care should be taken to ensure implementations of this method meet the general requirements for
ContextCalculator, defined in the class doc.- Parameters:
consumer- theContextConsumerto submit contexts to
-
calculate
Description copied from interface:ContextCalculatorSubmits any contexts this calculator determines to be applicable to thetargetcontextual subject.Care should be taken to ensure implementations of this method meet the general requirements for
ContextCalculator, defined in the class doc.- Specified by:
calculatein interfaceContextCalculator<Object>- Parameters:
target- the target contextual subject for this operationconsumer- theContextConsumerto submit contexts to
-