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 |
|---|---|
@NonNull Contexts |
formContexts(@NonNull ImmutableContextSet contextSet)
Forms a
Contexts instance from an ImmutableContextSet. |
@NonNull Contexts |
formContexts(@NonNull Object subject,
@NonNull ImmutableContextSet contextSet)
Forms a
Contexts instance from an ImmutableContextSet. |
@NonNull ImmutableContextSet |
getApplicableContext(@NonNull Object subject)
Queries the ContextManager for current context values for the subject.
|
@NonNull Contexts |
getApplicableContexts(@NonNull Object subject)
Queries the ContextManager for current context values for the subject.
|
@NonNull ImmutableContextSet |
getStaticContext()
Gets the contexts from the static calculators in this manager.
|
@NonNull Contexts |
getStaticContexts()
Gets the contexts from the static calculators in this manager.
|
void |
invalidateCache(@NonNull Object subject)
Invalidates the lookup cache for a given subject
|
@NonNull Optional<ImmutableContextSet> |
lookupApplicableContext(@NonNull User user)
Queries the ContextManager for current context values for the given User.
|
@NonNull Optional<Contexts> |
lookupApplicableContexts(@NonNull User user)
Queries the ContextManager for current context values for the given User.
|
void |
registerCalculator(@NonNull ContextCalculator<?> calculator)
Registers a context calculator with the manager.
|
void |
registerStaticCalculator(@NonNull 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 calculatorvoid invalidateCache(@NonNull Object subject)
subject - the subject