Package org.spongepowered.api.scoreboard
Interface Scoreboard
public interface Scoreboard
Represents a scoreboard, which contains
Team
s and Objective
s.
The server has a default scoreboard, but each Player
can have their own scoreboard.- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Represents a builder to createScoreboard
instances. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addObjective
(Objective objective) Adds the specifiedObjective
to this scoreboard.static Scoreboard.Builder
builder()
Creates a newScoreboard.Builder
to build aScoreboard
.default void
clearSlot
(Supplier<? extends DisplaySlot> slot) Clears anyObjective
in the specified slot.default void
clearSlot
(DisplaySlot slot) Clears anyObjective
in the specified slot.memberTeam
(Component member) Gets anObjective
on this scoreboard by name, if it exists.objective
(Supplier<? extends DisplaySlot> slot) Gets theObjective
currently displayed in aDisplaySlot
on this scoreboard, if one is present.objective
(DisplaySlot slot) Gets theObjective
currently displayed in aDisplaySlot
on this scoreboard, if one is present.Gets allObjective
s on this scoreboard.objectivesByCriterion
(Supplier<? extends Criterion> criterion) Gets allObjective
s of a Criteria on this scoreboard.objectivesByCriterion
(Criterion criterion) Gets allObjective
s of a Criteria on this scoreboard.void
registerTeam
(Team team) Registers the specifiedTeam
to this scoreboard.void
removeObjective
(Objective objective) Removes the specifiedObjective
from this scoreboard.void
removeScores
(String 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 aTeam
by name on this scoreboard.teams()
Gets all theTeam
s on this scoreboard.default void
updateDisplaySlot
(@Nullable Objective objective, DefaultedRegistryReference<? extends DisplaySlot> displaySlot) Sets the specifiedObjective
in the specifiedDisplaySlot
.void
updateDisplaySlot
(@Nullable Objective objective, DisplaySlot displaySlot) Sets the specifiedObjective
in the specifiedDisplaySlot
.
-
Method Details
-
builder
Creates a newScoreboard.Builder
to build aScoreboard
.- Returns:
- The new builder
-
objective
Gets anObjective
on this scoreboard by name, if it exists. -
objective
Gets theObjective
currently displayed in aDisplaySlot
on this scoreboard, if one is present.- Parameters:
slot
- TheDisplaySlot
- Returns:
- the
Objective
currently displayed, if present
-
objective
Gets theObjective
currently displayed in aDisplaySlot
on this scoreboard, if one is present.- Parameters:
slot
- TheDisplaySlot
- Returns:
- the
Objective
currently displayed, if present
-
addObjective
Adds the specifiedObjective
to this scoreboard.- Parameters:
objective
- TheObjective
add- Throws:
IllegalArgumentException
- if anObjective
with the samename
already exists, or if the specifiedObjective
has already been added.
-
updateDisplaySlot
default void updateDisplaySlot(@Nullable Objective objective, DefaultedRegistryReference<? extends DisplaySlot> displaySlot) throws IllegalStateException Sets the specifiedObjective
in the specifiedDisplaySlot
.If the
Objective
isnull
, then the specifiedDisplaySlot
will be cleared.- Parameters:
objective
- TheObjective
to setdisplaySlot
- TheDisplaySlot
to the specifiedObjective
in- Throws:
IllegalStateException
- if the specifiedObjective
does not exist on this scoreboard
-
updateDisplaySlot
void updateDisplaySlot(@Nullable Objective objective, DisplaySlot displaySlot) throws IllegalStateException Sets the specifiedObjective
in the specifiedDisplaySlot
.If the
Objective
isnull
, then the specifiedDisplaySlot
will be cleared.- Parameters:
objective
- TheObjective
to setdisplaySlot
- TheDisplaySlot
to the specifiedObjective
in- Throws:
IllegalStateException
- if the specifiedObjective
does not exist on this scoreboard
-
clearSlot
Clears anyObjective
in the specified slot.- Parameters:
slot
- TheDisplaySlot
to remove anyObjective
for
-
clearSlot
Clears anyObjective
in the specified slot.- Parameters:
slot
- TheDisplaySlot
to remove anyObjective
for
-
objectivesByCriterion
Gets allObjective
s of a Criteria on this scoreboard. -
objectivesByCriterion
Gets allObjective
s of a Criteria on this scoreboard. -
objectives
Gets allObjective
s on this scoreboard.- Returns:
- A set of all
Objective
s on this scoreboard
-
removeObjective
Removes the specifiedObjective
from this scoreboard.- Parameters:
objective
- TheObjective
to remove
-
scores
Gets all the scores on this scoreboard, across all objectives.If the same
Score
has 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
Score
has 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 aTeam
by name on this scoreboard. -
registerTeam
Registers the specifiedTeam
to this scoreboard.- Parameters:
team
- TheTeam
to register- Throws:
IllegalArgumentException
- if a team with the samename
already exists on this scoreboard, or if the specifiedTeam
is already registered to a scoreboard (this scoreboard, or another one).
-
teams
Gets all theTeam
s on this scoreboard.- Returns:
- The set of
Team
s
-
memberTeam
-