Class Scoreboard

java.lang.Object
org.geysermc.geyser.scoreboard.Scoreboard

public final class Scoreboard extends Object
Here follows some information about how scoreboards work in Java Edition, that is related to the workings of this class:

Objectives can be divided in two states: inactive and active. Inactive objectives is the default state for objectives that have been created using the SetObjective packet. Scores can be added, updated and removed, but as long as they're inactive they aren't shown to the player. An objective becomes active when a SetDisplayObjective packet is received, which contains the slot that the objective should be displayed at.

While Bedrock can handle showing one objective on multiple slots at the same time, we have to help Bedrock a bit for example by limiting the amount of sidebar scores to the amount of lines that can be shown (otherwise Bedrock may lag) and only showing online players in the playerlist (otherwise it's too cluttered.) This fact is the biggest contributor for the class being structured like it is.

  • Constructor Details

  • Method Details

    • removeScoreboard

      public void removeScoreboard()
    • registerNewObjective

      public @Nullable Objective registerNewObjective(String objectiveId)
    • displayObjective

      public void displayObjective(String objectiveId, org.geysermc.mcprotocollib.protocol.data.game.scoreboard.ScoreboardPosition slot)
    • registerNewTeam

      public void registerNewTeam(String teamName, String[] players, net.kyori.adventure.text.Component name, net.kyori.adventure.text.Component prefix, net.kyori.adventure.text.Component suffix, org.geysermc.mcprotocollib.protocol.data.game.scoreboard.NameTagVisibility visibility, org.geysermc.mcprotocollib.protocol.data.game.scoreboard.TeamColor color)
    • onUpdate

      public void onUpdate()
    • getObjective

      public Objective getObjective(String objectiveName)
    • removeObjective

      public void removeObjective(Objective objective)
    • resetPlayerScores

      public void resetPlayerScores(String playerNameOrEntityUuid)
    • getTeam

      public Team getTeam(String teamName)
    • getTeamFor

      public Team getTeamFor(String playerNameOrEntityUuid)
    • removeTeam

      public void removeTeam(String teamName)
    • getTeamNames

      @Contract("-> new") public Map<String,Set<org.cloudburstmc.protocol.bedrock.data.command.CommandEnumConstraint>> getTeamNames()
    • playerRegistered

      public void playerRegistered(PlayerEntity player)
    • playerRemoved

      public void playerRemoved(PlayerEntity player)
    • entityRegistered

      public void entityRegistered(Entity entity)
    • entityRemoved

      public void entityRemoved(Entity entity)
    • setTeamFor

      public void setTeamFor(Team team, Set<String> entities)
    • nextId

      public long nextId()
    • session

      public GeyserSession session()
    • getObjectiveSlots

      public Map<org.geysermc.mcprotocollib.protocol.data.game.scoreboard.ScoreboardPosition,DisplaySlot> getObjectiveSlots()
    • getPlayerToTeam

      public Map<String,Team> getPlayerToTeam()
      Required to preserve vanilla behavior, which also uses a map. Otherwise, for example, if TAB has a team for a player and vanilla has a team, "race conditions" that do not match vanilla could occur.