aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/server/ServerScoreboard.java.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-spigotflower-stripped/net/minecraft/server/ServerScoreboard.java.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-softspoon.tar.gz
Paper-softspoon.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/server/ServerScoreboard.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/server/ServerScoreboard.java.patch176
1 files changed, 176 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/server/ServerScoreboard.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/server/ServerScoreboard.java.patch
new file mode 100644
index 0000000000..73ccec84ac
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/server/ServerScoreboard.java.patch
@@ -0,0 +1,176 @@
+--- a/net/minecraft/server/ServerScoreboard.java
++++ b/net/minecraft/server/ServerScoreboard.java
+@@ -37,11 +37,10 @@
+ }
+
+ @Override
+- @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();
+@@ -58,16 +55,15 @@
+ @Override
+ public void onPlayerRemoved(ScoreHolder scoreholder) {
+ super.onPlayerRemoved(scoreholder);
+- this.server.getPlayerList().broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), (String) null));
++ this.broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), (String) null)); // CraftBukkit
+ this.setDirty();
+ }
+
+ @Override
+- @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();
+@@ -78,18 +73,18 @@
+ public void setDisplayObjective(DisplaySlot displayslot, @Nullable Objective objective) {
+ Objective objective1 = this.getDisplayObjective(displayslot);
+
+- super.setDisplayObjective(displayslot, objective);
+- if (objective1 != objective && objective1 != null) {
+- if (this.getObjectiveDisplaySlotCount(objective1) > 0) {
+- this.server.getPlayerList().broadcastAll(new ClientboundSetDisplayObjectivePacket(displayslot, objective));
++ super.setDisplayObjective(displayslot, scoreboardobjective);
++ if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) {
++ if (this.getObjectiveDisplaySlotCount(scoreboardobjective1) > 0) {
++ this.broadcastAll(new ClientboundSetDisplayObjectivePacket(displayslot, scoreboardobjective)); // CraftBukkit
+ } else {
+ this.stopTrackingObjective(objective1);
+ }
+ }
+
+- 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);
+ }
+@@ -99,10 +94,9 @@
+ }
+
+ @Override
+- @Override
+- public boolean addPlayerToTeam(String s, PlayerTeam playerteam) {
+- if (super.addPlayerToTeam(s, playerteam)) {
+- this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerteam, s, ClientboundSetPlayerTeamPacket.Action.ADD));
++ public boolean addPlayerToTeam(String playerName, PlayerTeam team) {
++ if (super.addPlayerToTeam(playerName, team)) {
++ this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.a.ADD)); // CraftBukkit
+ this.setDirty();
+ return true;
+ } else {
+@@ -111,10 +105,9 @@
+ }
+
+ @Override
+- @Override
+- public void removePlayerFromTeam(String s, PlayerTeam playerteam) {
+- super.removePlayerFromTeam(s, playerteam);
+- this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerteam, s, ClientboundSetPlayerTeamPacket.Action.REMOVE));
++ public void removePlayerFromTeam(String username, PlayerTeam playerTeam) {
++ super.removePlayerFromTeam(username, playerTeam);
++ this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.a.REMOVE)); // CraftBukkit
+ this.setDirty();
+ }
+
+@@ -130,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();
+@@ -148,26 +138,23 @@
+ }
+
+ @Override
+- @Override
+- public void onTeamAdded(PlayerTeam playerteam) {
+- super.onTeamAdded(playerteam);
+- this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerteam, true));
++ public void onTeamAdded(PlayerTeam playerTeam) {
++ super.onTeamAdded(playerTeam);
++ this.broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerTeam, true)); // CraftBukkit
+ this.setDirty();
+ }
+
+ @Override
+- @Override
+- public void onTeamChanged(PlayerTeam playerteam) {
+- super.onTeamChanged(playerteam);
+- this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerteam, false));
++ public void onTeamChanged(PlayerTeam playerTeam) {
++ super.onTeamChanged(playerTeam);
++ this.broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerTeam, false)); // CraftBukkit
+ this.setDirty();
+ }
+
+ @Override
+- @Override
+- public void onTeamRemoved(PlayerTeam playerteam) {
+- super.onTeamRemoved(playerteam);
+- this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createRemovePacket(playerteam));
++ public void onTeamRemoved(PlayerTeam playerTeam) {
++ super.onTeamRemoved(playerTeam);
++ this.broadcastAll(ClientboundSetPlayerTeamPacket.createRemovePacket(playerTeam)); // CraftBukkit
+ this.setDirty();
+ }
+
+@@ -217,7 +204,8 @@
+ Iterator iterator = this.server.getPlayerList().getPlayers().iterator();
+
+ while (iterator.hasNext()) {
+- ServerPlayer serverplayer = (ServerPlayer) iterator.next();
++ 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()) {
+@@ -253,7 +241,8 @@
+ Iterator iterator = this.server.getPlayerList().getPlayers().iterator();
+
+ while (iterator.hasNext()) {
+- ServerPlayer serverplayer = (ServerPlayer) iterator.next();
++ 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()) {
+@@ -298,7 +287,15 @@
+ return this.createData().load(compoundtag);
+ }
+
+- public static enum Method {
++ // 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
+
+ CHANGE, REMOVE;
+