public interface ContextManager
ContextCalculators, and calculates applicable contexts for a
given type.
This interface accepts Object types as a parameter to avoid having to depend
on specific server implementations. In all cases, the "player" or "subject" type for
the platform must be used.
Specifically:
org.bukkit.entity.Playernet.md_5.bungee.api.connection.ProxiedPlayerorg.spongepowered.api.service.permission.Subject| Modifier and Type | Method and Description |
|---|---|
Contexts |
formContexts(ImmutableContextSet contextSet)
Forms a
Contexts instance from an ImmutableContextSet. |
Contexts |
formContexts(Object subject,
ImmutableContextSet contextSet)
Forms a
Contexts instance from an ImmutableContextSet. |
ImmutableContextSet |
getApplicableContext(Object subject)
Queries the ContextManager for current context values for the subject.
|
Contexts |
getApplicableContexts(Object subject)
Queries the ContextManager for current context values for the subject.
|
ImmutableContextSet |
getStaticContext()
Gets the contexts from the static calculators in this manager.
|
Contexts |
getStaticContexts()
Gets the contexts from the static calculators in this manager.
|
void |
invalidateCache(Object subject)
Invalidates the lookup cache for a given subject
|
Optional<ImmutableContextSet> |
lookupApplicableContext(User user)
Queries the ContextManager for current context values for the given User.
|
Optional<Contexts> |
lookupApplicableContexts(User user)
Queries the ContextManager for current context values for the given User.
|
void |
registerCalculator(ContextCalculator<?> calculator)
Registers a context calculator with the manager.
|
void |
registerStaticCalculator(StaticContextCalculator calculator)
Registers a static context calculator with the manager.
|
@Nonnull ImmutableContextSet getApplicableContext(@Nonnull Object subject)
subject - the subject@Nonnull Contexts getApplicableContexts(@Nonnull Object subject)
subject - the subject@Nonnull Optional<ImmutableContextSet> lookupApplicableContext(@Nonnull User user)
This will only return a value if the player corresponding to the
User is online.
If you need to be a Contexts instance regardless, you should
initially try this method, and then fallback on getStaticContext().
user - the user@Nonnull Optional<Contexts> lookupApplicableContexts(@Nonnull User user)
This will only return a value if the player corresponding to the
User is online.
If you need to be a Contexts instance regardless, you should
initially try this method, and then fallback on getStaticContexts().
user - the user@Nonnull ImmutableContextSet getStaticContext()
Static calculators provide the same context for all subjects, and are marked as such when registered.
@Nonnull Contexts getStaticContexts()
Static calculators provide the same context for all subjects, and are marked as such when registered.
@Nonnull Contexts formContexts(@Nonnull Object subject, @Nonnull ImmutableContextSet contextSet)
Contexts instance from an ImmutableContextSet.
This method relies on the plugins configuration to form the
Contexts instance.
subject - the reference subjectcontextSet - the context set@Nonnull Contexts formContexts(@Nonnull ImmutableContextSet contextSet)
Contexts instance from an ImmutableContextSet.
This method relies on the plugins configuration to form the
Contexts instance.
contextSet - the context setvoid registerCalculator(@Nonnull ContextCalculator<?> calculator)
calculator - the calculatorvoid registerStaticCalculator(@Nonnull StaticContextCalculator calculator)
Static calculators provide the same context for all subjects.
calculator - the calculatorCopyright © 2018. All rights reserved.