public int getScore() throws IllegalStateException { Scoreboard board = objective.checkState().board; if (board.getPlayers().contains(entry)) { // Lazy Map<String, ScoreboardScore> scores = board.getPlayerObjectives(entry); ScoreboardScore score = scores.get(objective.getHandle()); if (score != null) { // Lazy return score.getScore(); } } return 0; // Lazy }
CraftScoreboard(Scoreboard board) { this.board = board; for (ScoreboardObjective objective : (Iterable<ScoreboardObjective>) board.getObjectives()) { new CraftObjective(this, objective); // It adds itself to map } for (ScoreboardTeam team : (Iterable<ScoreboardTeam>) board.getTeams()) { new CraftTeam(this, team); // It adds itself to map } }
public void setDisplaySlot(DisplaySlot slot) throws IllegalStateException { CraftScoreboard scoreboard = checkState(); Scoreboard board = scoreboard.board; ScoreboardObjective objective = this.objective; for (int i = 0; i < CraftScoreboardTranslations.MAX_DISPLAY_SLOT; i++) { if (board.getObjectiveForSlot(i) == objective) { board.setDisplaySlot(i, null); } } if (slot != null) { int slotNumber = CraftScoreboardTranslations.fromBukkitSlot(slot); board.setDisplaySlot(slotNumber, getHandle()); } }
public DisplaySlot getDisplaySlot() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); Scoreboard board = scoreboard.board; ScoreboardObjective objective = this.objective; for (int i = 0; i < CraftScoreboardTranslations.MAX_DISPLAY_SLOT; i++) { if (board.getObjectiveForSlot(i) == objective) { return CraftScoreboardTranslations.toBukkitSlot(i); } } return null; }
public Collection<ScoreboardScore> getScoreboardScores(IScoreboardCriteria criteria, String name, Collection<ScoreboardScore> collection) { for (CraftScoreboard scoreboard : scoreboards) { Scoreboard board = scoreboard.board; for (ScoreboardObjective objective : (Iterable<ScoreboardObjective>) board.getObjectivesForCriteria(criteria)) { collection.add(board.getPlayerScoreForObjective(name, objective)); } } return collection; }
public int getScore() throws IllegalStateException { Scoreboard board = objective.checkState().board; if (board.getPlayers().contains(entry)) { // Lazy Map<ScoreboardObjective, ScoreboardScore> scores = board.getPlayerObjectives(entry); ScoreboardScore score = scores.get(objective.getHandle()); if (score != null) { // Lazy return score.getScore(); } } return 0; // Lazy }
public int getScore() throws IllegalStateException { Scoreboard board = objective.checkState().board; if (board.getPlayers().contains(playerName)) { // Lazy Map<String, ScoreboardScore> scores = board.getPlayerObjectives(playerName); ScoreboardScore score = scores.get(objective.getHandle()); if (score != null) { // Lazy return score.getScore(); } } return 0; // Lazy }
public int getScore() throws IllegalStateException { Scoreboard board = objective.checkState().board; if (board.getPlayers().contains(entry)) { // Lazy Map<net.minecraft.server.ScoreboardObjective, ScoreboardScore> scores = board.getPlayerObjectives(entry); // Spigot ScoreboardScore score = scores.get(objective.getHandle()); if (score != null) { // Lazy return score.getScore(); } } return 0; // Lazy }
public Scoreboard getHandle() { return board; }
static DisplaySlot toBukkitSlot(int i) { return SLOTS.inverse().get(Scoreboard.getSlotName(i)); }
static int fromBukkitSlot(DisplaySlot slot) { return Scoreboard.getSlotForName(SLOTS.get(slot)); }
public CraftScoreboardManager(MinecraftServer minecraftserver, net.minecraft.server.Scoreboard scoreboardServer) { mainScoreboard = new CraftScoreboard(scoreboardServer); server = minecraftserver; scoreboards.add(mainScoreboard); }
CraftScoreboard(Scoreboard board) { this.board = board; }