public interface Objective
Entries can be updated by plugins, by in-game commands, or automatically
by the game, depending on their Criterion
.
Modifier and Type | Interface and Description |
---|---|
static interface |
Objective.Builder
Represents a builder to create
Objective instances. |
Modifier and Type | Method and Description |
---|---|
void |
addScore(Score score)
Adds the specified
Score to this objective. |
static Objective.Builder |
builder()
Creates a new
Objective.Builder to build a Objective . |
Criterion |
getCriterion()
Gets the criterion for this objective.
|
ObjectiveDisplayMode |
getDisplayMode()
Gets the
ObjectiveDisplayMode used to display this objective. |
Text |
getDisplayName()
Gets the name displayed to players.
|
String |
getName()
Gets the name of this Objective.
|
Score |
getOrCreateScore(Text name)
Gets an entry's
Score for this objective. |
default Optional<Score> |
getScore(Text name)
Gets an entry's
Score for this objective, if it exists. |
Set<Scoreboard> |
getScoreboards()
|
Map<Text,Score> |
getScores()
Gets the set of
Score s for this objective. |
boolean |
hasScore(Text name)
Returns whether this objective has a
Score with the given name. |
boolean |
removeScore(Score score)
Removes the specified
Score from this objective, if present. |
boolean |
removeScore(Text name)
Removes the
Score with the specified name from this objective, if present. |
void |
setDisplayMode(ObjectiveDisplayMode displayMode)
Sets the
ObjectiveDisplayMode used to display this objective. |
void |
setDisplayName(Text displayName)
Sets the name displayed to players.
|
static Objective.Builder builder()
Objective.Builder
to build a Objective
.String getName()
Text getDisplayName()
void setDisplayName(Text displayName) throws IllegalArgumentException
displayName
- Display name to setIllegalArgumentException
- if displayName is longer than 32
characters (in its legacy representation)Criterion getCriterion()
ObjectiveDisplayMode getDisplayMode()
ObjectiveDisplayMode
used to display this objective.ObjectiveDisplayMode
used to display this objectivevoid setDisplayMode(ObjectiveDisplayMode displayMode)
ObjectiveDisplayMode
used to display this objective.displayMode
- The ObjectiveDisplayMode
used to display this objectiveMap<Text,Score> getScores()
Score
s for this objective.Score
s for this objectiveboolean hasScore(Text name)
Score
with the given name.void addScore(Score score) throws IllegalArgumentException
Score
to this objective.score
- The Score
to addIllegalArgumentException
- If a Score
with the same name exists, or the specified Score
has already been addeddefault Optional<Score> getScore(Text name)
Score
for this objective, if it exists.boolean removeScore(Score score)
Score
from this objective, if present.score
- The Score
to removeboolean removeScore(Text name)
Score
with the specified name from this objective, if present.name
- The name of the Score
to remove.Set<Scoreboard> getScoreboards()
Set
of parent Scoreboard
s this
Objective
is registered to