Interface Objective
public interface Objective
An objective tracks an integer score for each entry it contains.
 
Entries can be updated by plugins, by in-game commands, or automatically
 by the game, depending on their Criterion.
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a builder to createObjectiveinstances.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds the specifiedScoreto this objective.static Objective.Builderbuilder()Creates a newObjective.Builderto build aObjective.Gets the criterion for this objective.Gets theObjectiveDisplayModeused to display this objective.Gets the name displayed to players.findOrCreateScore(String name) Gets an entry'sScorefor this objective.findOrCreateScore(Entity entity) Gets an entry'sScorefor this objective.findOrCreateScore(GameProfile profile) Gets an entry'sScorefor this objective.Gets an entry'sScorefor this objective, if it exists.Gets an entry'sScorefor this objective, if it exists.findScore(GameProfile profile) Gets an entry'sScorefor this objective, if it exists.booleanReturns whether this objective has aScorewith the given name.booleanReturns whether this objective has aScorewith the given entity.booleanhasScore(GameProfile profile) Returns whether this objective has aScorewith the given profile.name()Gets the name of this Objective.booleanremoveScore(String name) Removes theScorewith the specified name from this objective, if present.booleanremoveScore(Entity entity) Removes theScorewith the specified entity from this objective, if present.booleanremoveScore(GameProfile profile) Removes theScorewith the specified profile from this objective, if present.booleanremoveScore(Score score) Removes the specifiedScorefrom this objective, if present.scores()Gets the set ofScores for this objective.voidsetDisplayMode(ObjectiveDisplayMode displayMode) Sets theObjectiveDisplayModeused to display this objective.voidsetDisplayName(Component displayName) Sets the name displayed to players.
- 
Method Details- 
builderCreates a newObjective.Builderto build aObjective.- Returns:
- The new builder
 
- 
nameString name()Gets the name of this Objective.- Returns:
- The objective's name
 
- 
displayNameComponent displayName()Gets the name displayed to players.- Returns:
- The objective's display name
 
- 
setDisplayNameSets the name displayed to players.- Parameters:
- displayName- Display name to set
- Throws:
- IllegalArgumentException- if displayName is longer than 32 characters (in its legacy representation)
 
- 
criterionCriterion criterion()Gets the criterion for this objective.- Returns:
- This objective's criterion
 
- 
displayModeObjectiveDisplayMode displayMode()Gets theObjectiveDisplayModeused to display this objective.- Returns:
- The ObjectiveDisplayModeused to display this objective
 
- 
setDisplayModeSets theObjectiveDisplayModeused to display this objective.- Parameters:
- displayMode- The- ObjectiveDisplayModeused to display this objective
 
- 
scoresGets the set ofScores for this objective.- Returns:
- The set of Scores for this objective
 
- 
hasScoreReturns whether this objective has aScorewith the given name.
- 
hasScoreReturns whether this objective has aScorewith the given entity.
- 
hasScoreReturns whether this objective has aScorewith the given profile.
- 
addScoreAdds the specifiedScoreto this objective.- Parameters:
- score- The- Scoreto add
- Throws:
- IllegalArgumentException- If a- Scorewith the same name exists, or the specified- Scorehas already been added
 
- 
findScoreGets an entry'sScorefor this objective, if it exists.
- 
findOrCreateScore
- 
removeScoreRemoves theScorewith the specified name from this objective, if present.- Parameters:
- name- The name of the- Scoreto remove.
- Returns:
- Whether the score existed on this objective
 
- 
findScoreGets an entry'sScorefor this objective, if it exists.
- 
findOrCreateScore
- 
removeScoreRemoves theScorewith the specified entity from this objective, if present.- Parameters:
- entity- The entity of the- Scoreto remove.
- Returns:
- Whether the score existed on this objective
 
- 
findScoreGets an entry'sScorefor this objective, if it exists.
- 
findOrCreateScore
- 
removeScoreRemoves theScorewith the specified profile from this objective, if present.- Parameters:
- profile- The profile of the- Scoreto remove.
- Returns:
- Whether the score existed on this objective
 
- 
removeScoreRemoves the specifiedScorefrom this objective, if present.- Parameters:
- score- The- Scoreto remove
- Returns:
- Whether the score existed on this objective
 
- 
scoreboardsSet<Scoreboard> scoreboards()- Returns:
- A Setof parentScoreboards thisObjectiveis registered to
 
 
-