From 286e3468d70b046b3ba290fac88ad0056754cfa6 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Sat, 21 Dec 2024 16:03:29 +0100 Subject: [PATCH] Some more cleanup --- .../0017-Moonrise-optimisation-patches.patch | 6 +++--- ...-Incremental-chunk-and-player-saving.patch | 4 ++-- .../server/players/PlayerList.java.patch | 19 +++++++------------ 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/paper-server/patches/features/0017-Moonrise-optimisation-patches.patch b/paper-server/patches/features/0017-Moonrise-optimisation-patches.patch index 08d7f1080b..337302aaa2 100644 --- a/paper-server/patches/features/0017-Moonrise-optimisation-patches.patch +++ b/paper-server/patches/features/0017-Moonrise-optimisation-patches.patch @@ -27976,10 +27976,10 @@ index 4eb040006f5d41b47e5ac9df5d9f19c4315d6343..7fa41dea184b01891f45d8e404bc1cba this.generatingStep = generatingStep; this.cache = cache; diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 3d5d84c1c1d431e9b369aa727ab0876f90ff5d61..6abe5fd39583663af0feb98607cff75c42d96729 100644 +index ff0315cffdb282fdc0a1ffd15e2954caa76835c9..5e94dd9e26aa4fd6545dbaae2ae0cb51cb6f13e0 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -1317,7 +1317,7 @@ public abstract class PlayerList { +@@ -1312,7 +1312,7 @@ public abstract class PlayerList { public void setViewDistance(int viewDistance) { this.viewDistance = viewDistance; @@ -27988,7 +27988,7 @@ index 3d5d84c1c1d431e9b369aa727ab0876f90ff5d61..6abe5fd39583663af0feb98607cff75c for (ServerLevel serverLevel : this.server.getAllLevels()) { if (serverLevel != null) { -@@ -1328,7 +1328,7 @@ public abstract class PlayerList { +@@ -1323,7 +1323,7 @@ public abstract class PlayerList { public void setSimulationDistance(int simulationDistance) { this.simulationDistance = simulationDistance; diff --git a/paper-server/patches/features/0025-Incremental-chunk-and-player-saving.patch b/paper-server/patches/features/0025-Incremental-chunk-and-player-saving.patch index 9d7ae4524f..4ac088fbda 100644 --- a/paper-server/patches/features/0025-Incremental-chunk-and-player-saving.patch +++ b/paper-server/patches/features/0025-Incremental-chunk-and-player-saving.patch @@ -95,7 +95,7 @@ index e61fe83479f095e8addbd3e8f1d5179c998ae1eb..0a7e5106a1d39150326e7c323030df5d private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; private static final int FLY_STAT_RECORDING_SPEED = 25; diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 6abe5fd39583663af0feb98607cff75c42d96729..65c16eddff43c875be72b08f61d6f321a6876a48 100644 +index 5e94dd9e26aa4fd6545dbaae2ae0cb51cb6f13e0..03feaf0adb8ee87e33744a4615dc2507a02f92d7 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java @@ -482,6 +482,7 @@ public abstract class PlayerList { @@ -106,7 +106,7 @@ index 6abe5fd39583663af0feb98607cff75c42d96729..65c16eddff43c875be72b08f61d6f321 this.playerIo.save(player); ServerStatsCounter serverStatsCounter = player.getStats(); // CraftBukkit if (serverStatsCounter != null) { -@@ -1069,9 +1070,23 @@ public abstract class PlayerList { +@@ -1064,9 +1065,23 @@ public abstract class PlayerList { } public void saveAll() { diff --git a/paper-server/patches/sources/net/minecraft/server/players/PlayerList.java.patch b/paper-server/patches/sources/net/minecraft/server/players/PlayerList.java.patch index 65cec1e1fc..e9cb8b46e9 100644 --- a/paper-server/patches/sources/net/minecraft/server/players/PlayerList.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/players/PlayerList.java.patch @@ -450,12 +450,12 @@ + // this.broadcastAll(new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID()))); + ClientboundPlayerInfoRemovePacket packet = new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID())); + for (int i = 0; i < this.players.size(); i++) { -+ ServerPlayer entityplayer2 = (ServerPlayer) this.players.get(i); ++ ServerPlayer otherPlayer = (ServerPlayer) this.players.get(i); + -+ if (entityplayer2.getBukkitEntity().canSee(player.getBukkitEntity())) { -+ entityplayer2.connection.send(packet); ++ if (otherPlayer.getBukkitEntity().canSee(player.getBukkitEntity())) { ++ otherPlayer.connection.send(packet); + } else { -+ entityplayer2.getBukkitEntity().onEntityRemove(player); ++ otherPlayer.getBukkitEntity().onEntityRemove(player); + } + } + // This removes the scoreboard (and player reference) for the specific player in the manager @@ -758,7 +758,7 @@ return serverPlayer; } -@@ -482,24 +_,65 @@ +@@ -482,24 +_,60 @@ } public void sendActiveEffects(LivingEntity entity, ServerGamePacketListenerImpl connection) { @@ -791,14 +791,9 @@ - this.broadcastAll(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY), this.players)); + // CraftBukkit start + for (int i = 0; i < this.players.size(); ++i) { -+ final ServerPlayer target = (ServerPlayer) this.players.get(i); ++ final ServerPlayer target = this.players.get(i); + -+ target.connection.send(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY), this.players.stream().filter(new Predicate() { -+ @Override -+ public boolean test(ServerPlayer input) { -+ return target.getBukkitEntity().canSee(input.getBukkitEntity()); -+ } -+ }).collect(java.util.stream.Collectors.toList()))); ++ target.connection.send(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY), com.google.common.collect.Collections2.filter(this.players, t -> target.getBukkitEntity().canSee(t.getBukkitEntity())))); + } + // CraftBukkit end this.sendAllPlayerInfoIn = 0;