Interface Contextual
- All Known Subinterfaces:
Account
,CommandBlock
,CommandBlockMinecart
,CommandCause
,CommandContext
,CommandContext.Builder
,RconConnection
,ServerPlayer
,Subject
,SubjectProxy
,SystemSubject
,UniqueAccount
,User
,VirtualAccount
public interface Contextual
A common interface for objects that have an identifier and can have a set of
active
Context
s determined.
Used primarily by ContextService
s.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Cause
Get the cause describing the current state of this subject.Returns the friendly identifier associated with this Contextual.Returns the identifier associated with this Contextual.
-
Method Details
-
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
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
ServerPlayer
or aUser
should return the username here, if available.- Returns:
- The friendly identifier for this contextual
-
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
-