From ab2992a2ef759189727acccfd15539de94bd1350 Mon Sep 17 00:00:00 2001 From: Helvetica Volubi Date: Sat, 27 Dec 2025 19:34:57 +0800 Subject: [PATCH] fix some bug caused by 5622d49d49d7d88b812f1d1da1c43654b7e7f0a4 --- ...onfig-to-enable-waypoint-command-bar.patch | 35 +++++++++---------- .../features/0023-Leaves-Fakeplayer.patch | 4 +-- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/lophine-server/minecraft-patches/features/0007-Add-config-to-enable-waypoint-command-bar.patch b/lophine-server/minecraft-patches/features/0007-Add-config-to-enable-waypoint-command-bar.patch index d369e3e..a80484b 100644 --- a/lophine-server/minecraft-patches/features/0007-Add-config-to-enable-waypoint-command-bar.patch +++ b/lophine-server/minecraft-patches/features/0007-Add-config-to-enable-waypoint-command-bar.patch @@ -23,10 +23,10 @@ index 1fb359073342a657e9e493403263b56be5b3393f..451a685782da46f5683ea6707289bbaf WorldBorderCommand.register(this.dispatcher); if (JvmProfiler.INSTANCE.isAvailable()) { diff --git a/net/minecraft/server/waypoints/ServerWaypointManager.java b/net/minecraft/server/waypoints/ServerWaypointManager.java -index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..f34b6a858095c4257947ca30a5851e60752c3614 100644 +index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..65a4956ba2f0e38da7ae4f8cd7ed6e4b02c015a9 100644 --- a/net/minecraft/server/waypoints/ServerWaypointManager.java +++ b/net/minecraft/server/waypoints/ServerWaypointManager.java -@@ -16,22 +16,32 @@ import net.minecraft.world.waypoints.WaypointManager; +@@ -16,22 +16,31 @@ import net.minecraft.world.waypoints.WaypointManager; import net.minecraft.world.waypoints.WaypointTransmitter; public class ServerWaypointManager implements WaypointManager { @@ -56,9 +56,8 @@ index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..f34b6a858095c4257947ca30a5851e60 - Map map = Tables.transpose(this.connections).row(waypoint); - SetView set = Sets.difference(this.players, map.keySet()); + java.util.List> map = this.connections.getXZ(waypoint); // Lophine - concurrent -+ if (map.isEmpty()) return; // Lophine - concurrent + Set players1 = new HashSet<>(); // Lophine - concurrent -+ map.forEach((entry) -> players1.add(entry.getKey())); // Lophine - concurrent ++ if (!map.isEmpty()) map.forEach((entry) -> players1.add(entry.getKey())); // Lophine - concurrent + SetView set = Sets.difference(this.players, players1); // Lophine - concurrent - for (Entry entry : ImmutableSet.copyOf(map.entrySet())) { @@ -66,16 +65,16 @@ index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..f34b6a858095c4257947ca30a5851e60 this.updateConnection(entry.getKey(), waypoint, entry.getValue()); } -@@ -43,26 +53,67 @@ public class ServerWaypointManager implements WaypointManager connection.disconnect()); - Tables.transpose(this.connections).row(waypoint).clear(); -+ java.util.List> map = this.connections.getXZ(waypoint); // Lophine - concurrent -+ if (map.isEmpty()) return; // Lophine - concurrent -+ this.connections.getXZ(waypoint).forEach((entry) -> entry.getKey().disconnect()); // Lophine - concurrent -+ this.connections.clearXZ(waypoint); // Lophine - concurrent ++ this.connections.getXZ(waypoint).forEach((entry) -> { ++ entry.getValue().disconnect(); ++ this.connections.remove(entry.getKey(), waypoint, entry.getValue()); ++ }); // Lophine - concurrent this.waypoints.remove(waypoint); } @@ -100,9 +99,8 @@ index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..f34b6a858095c4257947ca30a5851e60 + // Lophine start - unsafe waypoint bar + if (!fun.bm.lophine.config.modules.experiment.CommandConfig.waypoint) return; + java.util.List> map = this.connections.getYZ(player); // Lophine - concurrent -+ if (map.isEmpty()) return; // Lophine - concurrent + Set waypoints1 = new HashSet<>();// Lophine - concurrent -+ map.forEach((entry) -> waypoints1.add(entry.getKey()));// Lophine - concurrent ++ if (!map.isEmpty()) map.forEach((entry) -> waypoints1.add(entry.getKey()));// Lophine - concurrent + SetView set = Sets.difference(this.waypoints, waypoints1); // Lophine - concurrent + + for (Entry entry : map) { // Lophine - concurrent @@ -119,10 +117,10 @@ index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..f34b6a858095c4257947ca30a5851e60 // Folia - region threading + // Lophine start - unsafe waypoint bar + if (!fun.bm.lophine.config.modules.experiment.CommandConfig.waypoint) return; -+ java.util.List> map = this.connections.getYZ(player); // Lophine - concurrent -+ if (map.isEmpty()) return; // Lophine - concurrent -+ map.forEach((entry) -> entry.getValue().disconnect()); // Lophine - concurrent -+ this.connections.clearYZ(player); // Lophine - concurrent ++ this.connections.getYZ(player).forEach((entry) -> { ++ entry.getValue().disconnect(); ++ this.connections.remove(player, entry.getKey(), entry.getValue()); ++ }); // Lophine - concurrent + this.untrackWaypoint((WaypointTransmitter)player); + this.players.remove(player); + // Lophine end - unsafe waypoint bar @@ -132,13 +130,12 @@ index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..f34b6a858095c4257947ca30a5851e60 - this.connections.values().forEach(WaypointTransmitter.Connection::disconnect); - this.connections.clear(); + java.util.List map = this.connections.getAllZ(); // Lophine - concurrent -+ if (map.isEmpty()) return; // Lophine - concurrent -+ map.forEach(WaypointTransmitter.Connection::disconnect); // Lophine - concurrent ++ if (!map.isEmpty()) map.forEach(WaypointTransmitter.Connection::disconnect); // Lophine - concurrent + this.connections.clearAll(); // Lophine - concurrent } public void remakeConnections(WaypointTransmitter waypoint) { -@@ -83,13 +134,19 @@ public class ServerWaypointManager implements WaypointManager { @@ -163,7 +160,7 @@ index 0f8cacbb8fe55a60e2f0c98bf36c005b29f41a4b..f34b6a858095c4257947ca30a5851e60 }); } } -@@ -103,10 +160,12 @@ public class ServerWaypointManager implements WaypointManager { connection1.connect(); diff --git a/lophine-server/minecraft-patches/features/0023-Leaves-Fakeplayer.patch b/lophine-server/minecraft-patches/features/0023-Leaves-Fakeplayer.patch index 9fa5d42..66d6bc1 100644 --- a/lophine-server/minecraft-patches/features/0023-Leaves-Fakeplayer.patch +++ b/lophine-server/minecraft-patches/features/0023-Leaves-Fakeplayer.patch @@ -511,7 +511,7 @@ index 8e2775e873c92beed6a0e4e8ce1304ab8ca6e8d1..580f114fd99b017403c61e994d0c947d public boolean canBypassPlayerLimit(GameProfile profile) { diff --git a/net/minecraft/server/waypoints/ServerWaypointManager.java b/net/minecraft/server/waypoints/ServerWaypointManager.java -index f34b6a858095c4257947ca30a5851e60752c3614..d08fe74e00926ee1433e890715f13ff6855b1d2d 100644 +index 65a4956ba2f0e38da7ae4f8cd7ed6e4b02c015a9..044ded5ec81905e38efe8812ff6d50259d761385 100644 --- a/net/minecraft/server/waypoints/ServerWaypointManager.java +++ b/net/minecraft/server/waypoints/ServerWaypointManager.java @@ -24,6 +24,11 @@ public class ServerWaypointManager implements WaypointManager