Interface SubjectProxy
- All Superinterfaces:
Contextual,Subject
- All Known Subinterfaces:
CommandCause,CommandContext,CommandContext.Builder
All default-Cause methods query the context cause from this proxy,
rather than the backing subject. This allows proxy subjects to override the
context causes.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Optional<?> Get the game object that may be associated with this subject.default SubjectReferenceGets a SubjectReference representing this subject.default SubjectCollectionReturns the subject collection this subject is a member of.default CauseGet the cause describing the current state of this subject.Returns the friendly identifier associated with this Contextual.default booleanhasPermission(String permission) Test whether the subject is permitted to perform an action given as the given permission string.default booleanhasPermission(String permission, Set<Context> contexts) Test whether the subject is permitted to perform an action corresponding to the given permission string.default booleanhasPermission(String permission, Cause cause) Test whether the subject is permitted to perform an action corresponding to the given permission string.default StringReturns the identifier associated with this Contextual.default booleanisChildOf(SubjectReference parent) Check if this subject is a child of the given parent in the subject's current context, traversing inheritance.default booleanisChildOf(SubjectReference parent, Set<Context> contexts) Check if this subject is a child of the given parent in the given context combination, traversing inheritance.default booleanisChildOf(SubjectReference parent, Cause causes) Check if this subject is a child of the given parent in the given context combination, traversing inheritance.default booleanReturns if this Subject has persistent, non-transient data.Gets the value of a given option in the subject's current context.Gets the value of a given option in the given context.Gets the value of a given option in the given context.default List<? extends SubjectReference> parents()Return all parents that this group has in its current context combination.default List<? extends SubjectReference> Return all parents that this group has in the given context combination.default List<? extends SubjectReference> Return all parents that this group has in the given context combination.default TristatepermissionValue(String permission) Returns the calculated value set for a given permission.default TristatepermissionValue(String permission, Set<Context> contexts) Returns the calculated value set for a given permission.default TristatepermissionValue(String permission, Cause causes) Returns the calculated value set for a given permission.subject()Gets theSubjectthis interface is a proxy for.default SubjectDataReturns the primary data backing for this Subject.default SubjectDataReturns the transient data backing for this Subject.
-
Method Details
-
subject
Subject subject()Gets theSubjectthis interface is a proxy for.- Returns:
- The
Subject
-
contextCause
Description copied from interface:ContextualGet the cause describing the current state of this subject.This is often not based on current game state, but rather the last known state of this subject. If a subject refers to a game object that is not active in the world, the cause may be a global cause.
- Specified by:
contextCausein interfaceContextual- Specified by:
contextCausein interfaceSubject- Returns:
- the active cause
-
friendlyIdentifier
Description copied from interface:ContextualReturns the friendly identifier associated with this Contextual.Unlike
Contextual.identifier(), this value is not guaranteed to be unique.If the friendly identifier is equal to the normal identifier, this method should return
Optional.empty().Contextuals which represent a
ServerPlayeror aUsershould return the username here, if available.- Specified by:
friendlyIdentifierin interfaceContextual- Returns:
- The friendly identifier for this contextual
-
containingCollection
Description copied from interface:SubjectReturns the subject collection this subject is a member of.- Specified by:
containingCollectionin interfaceSubject- Returns:
- The appropriate collection
-
asSubjectReference
Description copied from interface:SubjectGets a SubjectReference representing this subject.- Specified by:
asSubjectReferencein interfaceSubject- Returns:
- A subject reference representing this subject
-
associatedObject
Description copied from interface:SubjectGet the game object that may be associated with this subject.This could be a player, system subject, or something else. The return value of this method should not be stored.
- Specified by:
associatedObjectin interfaceSubject- Returns:
- a potential game object
-
isSubjectDataPersisted
default boolean isSubjectDataPersisted()Description copied from interface:SubjectReturns if this Subject has persistent, non-transient data.If true, this subject should have two distinct stores of SubjectData, and the non-transient form should be saved between sessions.
If false, this subject will have only one store of SubjectData, which will not be persisted between sessions.
- Specified by:
isSubjectDataPersistedin interfaceSubject- Returns:
- If this Subject has persistent, non-transient data.
-
subjectData
Description copied from interface:SubjectReturns the primary data backing for this Subject.If this Subject is not persisted, this data will not be saved between sessions.
For subjects which are not persisted, the same store will be returned by
Subject.transientSubjectData().- Specified by:
subjectDatain interfaceSubject- Returns:
- The primary data backing for this Subject
-
transientSubjectData
Description copied from interface:SubjectReturns the transient data backing for this Subject.Transient data is guaranteed to only last for the duration of the subject's session, and is not persisted.
For subjects which are not persisted, the same store will be returned by
Subject.subjectData().- Specified by:
transientSubjectDatain interfaceSubject- Returns:
- The transient data backing for this Subject
-
permissionValue
Description copied from interface:SubjectReturns the calculated value set for a given permission.It is expected that this method will also account for values inherited from parent subjects, as well as permission nodes inherited implicitly from a more generic level.
Additionally, the defaults defined the
SubjectCollectionthat holds this subject, as well as defaults defined inPermissionService.defaults()should be considered for this lookup.This method is likely to be called frequently, so it is desirable that implementations cache the results to method calls.
- Specified by:
permissionValuein interfaceSubject- Parameters:
permission- The permission to checkcontexts- The contexts to query permission value in- Returns:
- The tristate result of the check
-
permissionValue
Description copied from interface:SubjectReturns the calculated value set for a given permission.It is expected that this method will also account for values inherited from parent subjects, as well as permission nodes inherited implicitly from a more generic level.
Additionally, the defaults defined the
SubjectCollectionthat holds this subject, as well as defaults defined inPermissionService.defaults()should be considered for this lookup.This method is likely to be called frequently, so it is desirable that implementations cache the results to method calls.
- Specified by:
permissionValuein interfaceSubject- Parameters:
permission- The permission to checkcauses- The cause to gather context from.- Returns:
- The tristate result of the check
-
permissionValue
Description copied from interface:SubjectReturns the calculated value set for a given permission.It is expected that this method will also account for values inherited from parent subjects, as well as permission nodes inherited implicitly from a more generic level.
Additionally, the defaults defined the
SubjectCollectionthat holds this subject, as well as defaults defined inPermissionService.defaults()should be considered for this lookup.This method is likely to be called frequently, so it is desirable that implementations cache the results to method calls.
- Specified by:
permissionValuein interfaceSubject- Parameters:
permission- The permission to check- Returns:
- The tristate result of the check
-
isChildOf
Description copied from interface:SubjectCheck if this subject is a child of the given parent in the given context combination, traversing inheritance.It is expected that this method will also account for data from distant parents, inherited from direct parent subjects.
Additionally, the defaults defined the
SubjectCollectionthat holds this subject, as well as defaults defined inPermissionService.defaults()should be considered for this lookup. -
isChildOf
Description copied from interface:SubjectCheck if this subject is a child of the given parent in the given context combination, traversing inheritance.It is expected that this method will also account for data from distant parents, inherited from direct parent subjects.
Additionally, the defaults defined the
SubjectCollectionthat holds this subject, as well as defaults defined inPermissionService.defaults()should be considered for this lookup. -
isChildOf
Description copied from interface:SubjectCheck if this subject is a child of the given parent in the subject's current context, traversing inheritance.This must return the same value as
Subject.isChildOf(SubjectReference, Cause)called with the phase tracker's current cause. -
parents
Description copied from interface:SubjectReturn all parents that this group has in the given context combination.This must include inherited values if the permissions service supports inheritance.
-
parents
Description copied from interface:SubjectReturn all parents that this group has in the given context combination.This must include inherited values if the permissions service supports inheritance.
-
parents
Description copied from interface:SubjectReturn all parents that this group has in its current context combination.This must include inherited values if the permissions service supports inheritance.
It must also must return the same value as
Subject.parents(Cause) -
option
Description copied from interface:SubjectGets the value of a given option in the given context.It is expected that this method will account for options inherited from parent subjects.
Additionally, the default options defined by the
SubjectCollectionthat holds this subject, as well as defaults defined inPermissionService.defaults()should be considered for this lookup. -
option
Description copied from interface:SubjectGets the value of a given option in the given context.It is expected that this method will account for options inherited from parent subjects.
Additionally, the default options defined by the
SubjectCollectionthat holds this subject, as well as defaults defined inPermissionService.defaults()should be considered for this lookup. -
option
Description copied from interface:SubjectGets the value of a given option in the subject's current context.This must return the same value as
Subject.option(String, Cause)called with the phase tracker's current cause. -
identifier
Description copied from interface:ContextualReturns the identifier associated with this Contextual.The identifier of each distinct Contextual within a collection of contextuals should be unique.
Not guaranteed to be human-readable. Use
Contextual.friendlyIdentifier()for a more readable alternative.- Specified by:
identifierin interfaceContextual- Returns:
- The identifier for this subject
-
hasPermission
Description copied from interface:SubjectTest whether the subject is permitted to perform an action corresponding to the given permission string.This must return the same boolean equivalent as
Subject.permissionValue(String, Cause).- Specified by:
hasPermissionin interfaceSubject- Parameters:
permission- The permission stringcontexts- The contexts to calculate permission status in- Returns:
- True if permission is granted
-
hasPermission
Description copied from interface:SubjectTest whether the subject is permitted to perform an action corresponding to the given permission string.This must return the same boolean equivalent as
Subject.permissionValue(String, Cause).- Specified by:
hasPermissionin interfaceSubject- Parameters:
permission- The permission stringcause- The cause stack to extract context information from- Returns:
- True if permission is granted
-
hasPermission
Description copied from interface:SubjectTest whether the subject is permitted to perform an action given as the given permission string.This must return the same value as
Subject.hasPermission(String, Cause)called with the phase tracker's current cause.- Specified by:
hasPermissionin interfaceSubject- Parameters:
permission- The permission string- Returns:
- True if permission is granted
-