Interface Contextual
-
- All Known Subinterfaces:
Account,CommandBlock,CommandBlockMinecart,CommandCause,CommandContext,CommandContext.Builder,RconConnection,ServerPlayer,Subject,SubjectProxy,SystemSubject,UniqueAccount,User,VirtualAccount
public interface ContextualA common interface for objects that have an identifier and can have a set of activeContexts determined.Used primarily by
ContextServices.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default CausecontextCause()Get the cause describing the current state of this subject.default Optional<String>friendlyIdentifier()Returns the friendly identifier associated with this Contextual.Stringidentifier()Returns the identifier associated with this Contextual.
-
-
-
Method Detail
-
identifier
String identifier()
Returns 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
friendlyIdentifier()for a more readable alternative.- Returns:
- The identifier for this subject
-
friendlyIdentifier
default Optional<String> friendlyIdentifier()
Returns the friendly identifier associated with this Contextual.Unlike
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.- Returns:
- The friendly identifier for this contextual
-
contextCause
default Cause contextCause()
Get 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.
- Returns:
- the active cause
-
-