aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/server/ServerScoreboard.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/server/ServerScoreboard.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/server/ServerScoreboard.java.patch194
1 files changed, 194 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/server/ServerScoreboard.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/server/ServerScoreboard.java.patch
new file mode 100644
index 0000000000..7f18620a5e
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/server/ServerScoreboard.java.patch
@@ -0,0 +1,194 @@
+--- a/net/minecraft/server/ServerScoreboard.java
++++ b/net/minecraft/server/ServerScoreboard.java
+@@ -34,14 +37,10 @@
+ }
+
+ @Override
+- protected void onScoreChanged(ScoreHolder scoreHolder, Objective objective, Score score) {
+- super.onScoreChanged(scoreHolder, objective, score);
+- if (this.trackedObjectives.contains(objective)) {
+- this.server
+- .getPlayerList()
+- .broadcastAll(
+- new ClientboundSetScorePacket(scoreHolder.getScoreboardName(), objective.getName(), score.value(), score.display(), score.numberFormat())
+- );
++ protected void onScoreChanged(ScoreHolder scoreholder, Objective scoreboardobjective, Score scoreboardscore) {
++ super.onScoreChanged(scoreholder, scoreboardobjective, scoreboardscore);
++ if (this.trackedObjectives.contains(scoreboardobjective)) {
++ this.broadcastAll(new ClientboundSetScorePacket(scoreholder.getScoreboardName(), scoreboardobjective.getName(), scoreboardscore.value(), scoreboardscore.display(), scoreboardscore.numberFormat())); // CraftBukkit
+ }
+
+ this.setDirty();
+@@ -54,37 +53,38 @@
+ }
+
+ @Override
+- public void onPlayerRemoved(ScoreHolder scoreHolder) {
+- super.onPlayerRemoved(scoreHolder);
+- this.server.getPlayerList().broadcastAll(new ClientboundResetScorePacket(scoreHolder.getScoreboardName(), null));
++ public void onPlayerRemoved(ScoreHolder scoreholder) {
++ super.onPlayerRemoved(scoreholder);
++ this.broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), (String) null)); // CraftBukkit
+ this.setDirty();
+ }
+
+ @Override
+- public void onPlayerScoreRemoved(ScoreHolder scoreHolder, Objective objective) {
+- super.onPlayerScoreRemoved(scoreHolder, objective);
+- if (this.trackedObjectives.contains(objective)) {
+- this.server.getPlayerList().broadcastAll(new ClientboundResetScorePacket(scoreHolder.getScoreboardName(), objective.getName()));
++ public void onPlayerScoreRemoved(ScoreHolder scoreholder, Objective scoreboardobjective) {
++ super.onPlayerScoreRemoved(scoreholder, scoreboardobjective);
++ if (this.trackedObjectives.contains(scoreboardobjective)) {
++ this.broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), scoreboardobjective.getName())); // CraftBukkit
+ }
+
+ this.setDirty();
+ }
+
+ @Override
+- public void setDisplayObjective(DisplaySlot displaySlot, @Nullable Objective objective) {
+- Objective displayObjective = this.getDisplayObjective(displaySlot);
+- super.setDisplayObjective(displaySlot, objective);
+- if (displayObjective != objective && displayObjective != null) {
+- if (this.getObjectiveDisplaySlotCount(displayObjective) > 0) {
+- this.server.getPlayerList().broadcastAll(new ClientboundSetDisplayObjectivePacket(displaySlot, objective));
++ public void setDisplayObjective(DisplaySlot displayslot, @Nullable Objective scoreboardobjective) {
++ Objective scoreboardobjective1 = this.getDisplayObjective(displayslot);
++
++ super.setDisplayObjective(displayslot, scoreboardobjective);
++ if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) {
++ if (this.getObjectiveDisplaySlotCount(scoreboardobjective1) > 0) {
++ this.broadcastAll(new ClientboundSetDisplayObjectivePacket(displayslot, scoreboardobjective)); // CraftBukkit
+ } else {
+ this.stopTrackingObjective(displayObjective);
+ }
+ }
+
+- if (objective != null) {
+- if (this.trackedObjectives.contains(objective)) {
+- this.server.getPlayerList().broadcastAll(new ClientboundSetDisplayObjectivePacket(displaySlot, objective));
++ if (scoreboardobjective != null) {
++ if (this.trackedObjectives.contains(scoreboardobjective)) {
++ this.broadcastAll(new ClientboundSetDisplayObjectivePacket(displayslot, scoreboardobjective)); // CraftBukkit
+ } else {
+ this.startTrackingObjective(objective);
+ }
+@@ -96,9 +96,7 @@
+ @Override
+ public boolean addPlayerToTeam(String playerName, PlayerTeam team) {
+ if (super.addPlayerToTeam(playerName, team)) {
+- this.server
+- .getPlayerList()
+- .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD));
++ this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.a.ADD)); // CraftBukkit
+ this.setDirty();
+ return true;
+ } else {
+@@ -109,9 +107,7 @@
+ @Override
+ public void removePlayerFromTeam(String username, PlayerTeam playerTeam) {
+ super.removePlayerFromTeam(username, playerTeam);
+- this.server
+- .getPlayerList()
+- .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE));
++ this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.a.REMOVE)); // CraftBukkit
+ this.setDirty();
+ }
+
+@@ -125,7 +121,7 @@
+ public void onObjectiveChanged(Objective objective) {
+ super.onObjectiveChanged(objective);
+ if (this.trackedObjectives.contains(objective)) {
+- this.server.getPlayerList().broadcastAll(new ClientboundSetObjectivePacket(objective, 2));
++ this.broadcastAll(new ClientboundSetObjectivePacket(objective, 2)); // CraftBukkit
+ }
+
+ this.setDirty();
+@@ -144,21 +140,21 @@
+ @Override
+ public void onTeamAdded(PlayerTeam playerTeam) {
+ super.onTeamAdded(playerTeam);
+- this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerTeam, true));
++ this.broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerTeam, true)); // CraftBukkit
+ this.setDirty();
+ }
+
+ @Override
+ public void onTeamChanged(PlayerTeam playerTeam) {
+ super.onTeamChanged(playerTeam);
+- this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerTeam, false));
++ this.broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerTeam, false)); // CraftBukkit
+ this.setDirty();
+ }
+
+ @Override
+ public void onTeamRemoved(PlayerTeam playerTeam) {
+ super.onTeamRemoved(playerTeam);
+- this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createRemovePacket(playerTeam));
++ this.broadcastAll(ClientboundSetPlayerTeamPacket.createRemovePacket(playerTeam)); // CraftBukkit
+ this.setDirty();
+ }
+
+@@ -200,9 +203,15 @@
+ public void startTrackingObjective(Objective objective) {
+ List<Packet<?>> startTrackingPackets = this.getStartTrackingPackets(objective);
+
+- for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) {
+- for (Packet<?> packet : startTrackingPackets) {
+- serverPlayer.connection.send(packet);
++ while (iterator.hasNext()) {
++ ServerPlayer entityplayer = (ServerPlayer) iterator.next();
++ if (entityplayer.getBukkitEntity().getScoreboard().getHandle() != this) continue; // CraftBukkit - Only players on this board
++ Iterator iterator1 = list.iterator();
++
++ while (iterator1.hasNext()) {
++ Packet<?> packet = (Packet) iterator1.next();
++
++ entityplayer.connection.send(packet);
+ }
+ }
+
+@@ -225,9 +240,15 @@
+ public void stopTrackingObjective(Objective objective) {
+ List<Packet<?>> stopTrackingPackets = this.getStopTrackingPackets(objective);
+
+- for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) {
+- for (Packet<?> packet : stopTrackingPackets) {
+- serverPlayer.connection.send(packet);
++ while (iterator.hasNext()) {
++ ServerPlayer entityplayer = (ServerPlayer) iterator.next();
++ if (entityplayer.getBukkitEntity().getScoreboard().getHandle() != this) continue; // CraftBukkit - Only players on this board
++ Iterator iterator1 = list.iterator();
++
++ while (iterator1.hasNext()) {
++ Packet<?> packet = (Packet) iterator1.next();
++
++ entityplayer.connection.send(packet);
+ }
+ }
+
+@@ -260,8 +287,20 @@
+ return this.createData().load(tag);
+ }
+
+- public static enum Method {
+- CHANGE,
+- REMOVE;
++ // CraftBukkit start - Send to players
++ private void broadcastAll(Packet packet) {
++ for (ServerPlayer entityplayer : (List<ServerPlayer>) this.server.getPlayerList().players) {
++ if (entityplayer.getBukkitEntity().getScoreboard().getHandle() == this) {
++ entityplayer.connection.send(packet);
++ }
++ }
+ }
++ // CraftBukkit end
++
++ public static enum Action {
++
++ CHANGE, REMOVE;
++
++ private Action() {}
++ }
+ }