/** * Either updates the score with a specified value or removes the score for an objective */ public void handleUpdateScore(SPacketUpdateScore packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Scoreboard scoreboard = this.clientWorldController.getScoreboard(); ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getObjectiveName()); if (packetIn.getScoreAction() == SPacketUpdateScore.Action.CHANGE) { Score score = scoreboard.getOrCreateScore(packetIn.getPlayerName(), scoreobjective); score.setScorePoints(packetIn.getScoreValue()); } else if (packetIn.getScoreAction() == SPacketUpdateScore.Action.REMOVE) { if (StringUtils.isNullOrEmpty(packetIn.getObjectiveName())) { scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), (ScoreObjective)null); } else if (scoreobjective != null) { scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), scoreobjective); } } }
public List < Packet<? >> getCreatePackets(ScoreObjective objective) { List < Packet<? >> list = Lists. < Packet<? >> newArrayList(); list.add(new SPacketScoreboardObjective(objective, 0)); for (int i = 0; i < 19; ++i) { if (this.getObjectiveInDisplaySlot(i) == objective) { list.add(new SPacketDisplayObjective(i, objective)); } } for (Score score : this.getSortedScores(objective)) { list.add(new SPacketUpdateScore(score)); } return list; }
public void onScoreUpdated(Score scoreIn) { super.onScoreUpdated(scoreIn); if (this.addedObjectives.contains(scoreIn.getObjective())) { this.scoreboardMCServer.getPlayerList().sendPacketToAllPlayers(new SPacketUpdateScore(scoreIn)); } this.markSaveDataDirty(); }
public void broadcastScoreUpdate(String scoreName) { super.broadcastScoreUpdate(scoreName); this.scoreboardMCServer.getPlayerList().sendPacketToAllPlayers(new SPacketUpdateScore(scoreName)); this.markSaveDataDirty(); }
public void broadcastScoreUpdate(String scoreName, ScoreObjective objective) { super.broadcastScoreUpdate(scoreName, objective); this.scoreboardMCServer.getPlayerList().sendPacketToAllPlayers(new SPacketUpdateScore(scoreName, objective)); this.markSaveDataDirty(); }
/** * Either updates the score with a specified value or removes the score for an objective */ void handleUpdateScore(SPacketUpdateScore packetIn);