public interface ContextCalculator<T extends Contextual>
Contexts applicable for a Contextual.
 Implementations of this interface should satisfy the following requirements:
Contextual.getActiveContexts().Calculators should be registered with the corresponding
 ContextualService using
 ContextualService.registerContextCalculator(ContextCalculator).
Context lookups for instances provided by the platform,
 (e.g. Player) are delegated to the active PermissionService.
 Plugins wishing to provide contexts for these instances should register
 calculators here.
When the provider of a ContextualService changes, calculators must
 be registered again. Plugins should listen to the
 ChangeServiceProviderEvent to ensure their calculators are registered
 with any replacement providers.
| Modifier and Type | Method and Description | 
|---|---|
void | 
accumulateContexts(T target,
                  Set<Context> accumulator)
Adds any  
Contexts this calculator determines to be applicable to
 the target contextual. | 
static <T extends Contextual> | 
forSingleContext(String key,
                Function<T,String> valueFunction)
Creates a new  
ContextCalculator that provides a single context. | 
default boolean | 
matches(Context context,
       T target)
Checks if a  
Context is currently applicable to a
 Contextual. | 
static <T extends Contextual> ContextCalculator<T> forSingleContext(String key, Function<T,String> valueFunction)
ContextCalculator that provides a single context.T - The contextual typekey - 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.void accumulateContexts(T target, Set<Context> accumulator)
Contexts this calculator determines to be applicable to
 the target contextual.
 Care should be taken to ensure implementations of this method meet the
 general requirements for ContextCalculator, defined in the class
 doc.
Calculators should not rely on the state of accumulator during
 this call, and also shouldn't make calls to remove contexts added by
 other calculators.
target - the target Contextual for this operationaccumulator - a Set of Contexts this operation
                    will accumulate to.default boolean matches(Context context, T target)
Context is currently applicable to a
 Contextual.
 
 If this calculator does not handle the given type of context, this method should return false.
For the given set of contexts which would be accumulated using
 accumulateContexts(Contextual, Set), this method should return
 true if the given context would be included in the accumulated set.
context - the Context being checkedtarget - the Contextual that is being checked againstContext is handled by this calculator
         and is applicable to the given Contextual. Otherwise
         false.