Package org.spongepowered.api.scoreboard
Interface Scoreboard
public interface Scoreboard
Represents a scoreboard, which contains
Teams and Objectives.
The server has a default scoreboard, but each Player
can have their own scoreboard.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a builder to createScoreboardinstances. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddObjective(Objective objective) Adds the specifiedObjectiveto this scoreboard.static Scoreboard.Builderbuilder()Creates a newScoreboard.Builderto build aScoreboard.default voidclearSlot(Supplier<? extends DisplaySlot> slot) Clears anyObjectivein the specified slot.default voidclearSlot(DisplaySlot slot) Clears anyObjectivein the specified slot.memberTeam(Component member) Gets anObjectiveon this scoreboard by name, if it exists.objective(Supplier<? extends DisplaySlot> slot) Gets theObjectivecurrently displayed in aDisplaySloton this scoreboard, if one is present.objective(DisplaySlot slot) Gets theObjectivecurrently displayed in aDisplaySloton this scoreboard, if one is present.Gets allObjectives on this scoreboard.objectivesByCriterion(Supplier<? extends Criterion> criterion) Gets allObjectives of a Criteria on this scoreboard.objectivesByCriterion(Criterion criterion) Gets allObjectives of a Criteria on this scoreboard.voidregisterTeam(Team team) Registers the specifiedTeamto this scoreboard.voidremoveObjective(Objective objective) Removes the specifiedObjectivefrom this scoreboard.voidremoveScores(Component name) Removes all scores with the specified name on this scoreboard, across all objectives.scores()Gets all the scores on this scoreboard, across all objectives.Gets all scores with the specified name on this scoreboard, across all objectives.Gets aTeamby name on this scoreboard.teams()Gets all theTeams on this scoreboard.default voidupdateDisplaySlot(@Nullable Objective objective, DefaultedRegistryReference<? extends DisplaySlot> displaySlot) Sets the specifiedObjectivein the specifiedDisplaySlot.voidupdateDisplaySlot(@Nullable Objective objective, DisplaySlot displaySlot) Sets the specifiedObjectivein the specifiedDisplaySlot.
-
Method Details
-
builder
Creates a newScoreboard.Builderto build aScoreboard.- Returns:
- The new builder
-
objective
Gets anObjectiveon this scoreboard by name, if it exists. -
objective
Gets theObjectivecurrently displayed in aDisplaySloton this scoreboard, if one is present.- Parameters:
slot- TheDisplaySlot- Returns:
- the
Objectivecurrently displayed, if present
-
objective
Gets theObjectivecurrently displayed in aDisplaySloton this scoreboard, if one is present.- Parameters:
slot- TheDisplaySlot- Returns:
- the
Objectivecurrently displayed, if present
-
addObjective
Adds the specifiedObjectiveto this scoreboard.- Parameters:
objective- TheObjectiveadd- Throws:
IllegalArgumentException- if anObjectivewith the samenamealready exists, or if the specifiedObjectivehas already been added.
-
updateDisplaySlot
default void updateDisplaySlot(@Nullable Objective objective, DefaultedRegistryReference<? extends DisplaySlot> displaySlot) throws IllegalStateException Sets the specifiedObjectivein the specifiedDisplaySlot.If the
Objectiveisnull, then the specifiedDisplaySlotwill be cleared.- Parameters:
objective- TheObjectiveto setdisplaySlot- TheDisplaySlotto the specifiedObjectivein- Throws:
IllegalStateException- if the specifiedObjectivedoes not exist on this scoreboard
-
updateDisplaySlot
void updateDisplaySlot(@Nullable Objective objective, DisplaySlot displaySlot) throws IllegalStateException Sets the specifiedObjectivein the specifiedDisplaySlot.If the
Objectiveisnull, then the specifiedDisplaySlotwill be cleared.- Parameters:
objective- TheObjectiveto setdisplaySlot- TheDisplaySlotto the specifiedObjectivein- Throws:
IllegalStateException- if the specifiedObjectivedoes not exist on this scoreboard
-
clearSlot
Clears anyObjectivein the specified slot.- Parameters:
slot- TheDisplaySlotto remove anyObjectivefor
-
clearSlot
Clears anyObjectivein the specified slot.- Parameters:
slot- TheDisplaySlotto remove anyObjectivefor
-
objectivesByCriterion
Gets allObjectives of a Criteria on this scoreboard. -
objectivesByCriterion
Gets allObjectives of a Criteria on this scoreboard. -
objectives
Gets allObjectives on this scoreboard.- Returns:
- A set of all
Objectives on this scoreboard
-
removeObjective
Removes the specifiedObjectivefrom this scoreboard.- Parameters:
objective- TheObjectiveto remove
-
scores
Gets all the scores on this scoreboard, across all objectives.If the same
Scorehas been added to multiple objectives, it will only appear once in the set.- Returns:
- A set of all scores
-
scores
Gets all scores with the specified name on this scoreboard, across all objectives.If the same
Scorehas been added to multiple objectives, it will only appear once in the set.- Parameters:
name- The name whose scores are being retrieved- Returns:
- A set of all scores for the name
-
removeScores
Removes all scores with the specified name on this scoreboard, across all objectives.- Parameters:
name- The name to remove all scores for
-
team
Gets aTeamby name on this scoreboard. -
registerTeam
Registers the specifiedTeamto this scoreboard.- Parameters:
team- TheTeamto register- Throws:
IllegalArgumentException- if a team with the samenamealready exists on this scoreboard, or if the specifiedTeamis already registered to a scoreboard (this scoreboard, or another one).
-
teams
Gets all theTeams on this scoreboard.- Returns:
- The set of
Teams
-
memberTeam
-