public interface Scoreboard
Teams and Objectives.
The server has a default scoreboard, but each Player
can have their own scoreboard.| Modifier and Type | Interface and Description |
|---|---|
static interface |
Scoreboard.Builder
Represents a builder to create
Scoreboard instances. |
| Modifier and Type | Method and Description |
|---|---|
void |
addObjective(Objective objective)
Adds the specified
Objective to this scoreboard. |
static Scoreboard.Builder |
builder()
Creates a new
Scoreboard.Builder to build a Scoreboard. |
default void |
clearSlot(DisplaySlot slot)
Clears any
Objective in the specified slot. |
Optional<Team> |
getMemberTeam(Text member)
|
Optional<Objective> |
getObjective(DisplaySlot slot)
Gets the
Objective currently displayed in a DisplaySlot on this
scoreboard, if one is present. |
Optional<Objective> |
getObjective(String name)
Gets an
Objective on this scoreboard by name, if it exists. |
Set<Objective> |
getObjectives()
Gets all
Objectives on this scoreboard. |
Set<Objective> |
getObjectivesByCriteria(Criterion criteria)
Gets all
Objectives of a Criteria on this scoreboard. |
Set<Score> |
getScores()
Gets all the scores on this scoreboard, across all objectives.
|
Set<Score> |
getScores(Text name)
Gets all scores with the specified name on this scoreboard,
across all objectives.
|
Optional<Team> |
getTeam(String teamName)
Gets a
Team by name on this scoreboard. |
Set<Team> |
getTeams()
Gets all the
Teams on this scoreboard. |
void |
registerTeam(Team team)
Registers the specified
Team to this scoreboard. |
void |
removeObjective(Objective objective)
Removes the specified
Objective from this scoreboard. |
void |
removeScores(Text name)
Removes all scores with the specified name on this scoreboard,
across all objectives.
|
void |
updateDisplaySlot(Objective objective,
DisplaySlot displaySlot)
Sets the specified
Objective in the specified DisplaySlot. |
static Scoreboard.Builder builder()
Scoreboard.Builder to build a Scoreboard.Optional<Objective> getObjective(String name)
Objective on this scoreboard by name, if it exists.Optional<Objective> getObjective(DisplaySlot slot)
Objective currently displayed in a DisplaySlot on this
scoreboard, if one is present.slot - The DisplaySlotObjective currently displayed, if presentvoid addObjective(Objective objective) throws IllegalArgumentException
Objective to this scoreboard.objective - The Objective addIllegalArgumentException - if an Objective with the same
name already exists, or if the
specified Objective has already been added.void updateDisplaySlot(@Nullable Objective objective, DisplaySlot displaySlot) throws IllegalStateException
Objective in the specified DisplaySlot.
If the Objective is null, then the specified
DisplaySlot will be cleared.
objective - The Objective to setdisplaySlot - The DisplaySlot to the specified Objective inIllegalStateException - if the specified Objective does not exist
on this scoreboarddefault void clearSlot(DisplaySlot slot)
Objective in the specified slot.slot - The DisplaySlot to remove any Objective forSet<Objective> getObjectivesByCriteria(Criterion criteria)
Objectives of a Criteria on this scoreboard.Set<Objective> getObjectives()
Objectives on this scoreboard.Objectives on this scoreboardvoid removeObjective(Objective objective)
Objective from this scoreboard.objective - The Objective to removeSet<Score> getScores()
If the same Score has been added to multiple objectives,
it will only appear once in the set.
Set<Score> getScores(Text name)
If the same Score has been added to multiple objectives,
it will only appear once in the set.
name - The name whose scores are being retrievedvoid removeScores(Text name)
name - The name to remove all scores forvoid registerTeam(Team team) throws IllegalArgumentException
Team to this scoreboard.team - The Team to registerIllegalArgumentException - if a team with the same
name already exists on this scoreboard, or if the specified
Team is already registered to a scoreboard (this scoreboard,
or another one).