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; }
/** * May create a scoreboard objective, remove an objective from the scoreboard or update an objectives' displayname */ public void handleScoreboardObjective(SPacketScoreboardObjective packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Scoreboard scoreboard = this.clientWorldController.getScoreboard(); if (packetIn.getAction() == 0) { ScoreObjective scoreobjective = scoreboard.addScoreObjective(packetIn.getObjectiveName(), IScoreCriteria.DUMMY); scoreobjective.setDisplayName(packetIn.getObjectiveValue()); scoreobjective.setRenderType(packetIn.getRenderType()); } else { ScoreObjective scoreobjective1 = scoreboard.getObjective(packetIn.getObjectiveName()); if (packetIn.getAction() == 1) { scoreboard.removeObjective(scoreobjective1); } else if (packetIn.getAction() == 2) { scoreobjective1.setDisplayName(packetIn.getObjectiveValue()); scoreobjective1.setRenderType(packetIn.getRenderType()); } } }
public void onObjectiveDisplayNameChanged(ScoreObjective objective) { super.onObjectiveDisplayNameChanged(objective); if (this.addedObjectives.contains(objective)) { this.scoreboardMCServer.getPlayerList().sendPacketToAllPlayers(new SPacketScoreboardObjective(objective, 2)); } this.markSaveDataDirty(); }
public List < Packet<? >> getDestroyPackets(ScoreObjective p_96548_1_) { List < Packet<? >> list = Lists. < Packet<? >> newArrayList(); list.add(new SPacketScoreboardObjective(p_96548_1_, 1)); for (int i = 0; i < 19; ++i) { if (this.getObjectiveInDisplaySlot(i) == p_96548_1_) { list.add(new SPacketDisplayObjective(i, p_96548_1_)); } } return list; }
/** * May create a scoreboard objective, remove an objective from the scoreboard or update an objectives' displayname */ void handleScoreboardObjective(SPacketScoreboardObjective packetIn);