From 98e39a02657f997eb98f7b643d0846a0c6e5e09a Mon Sep 17 00:00:00 2001 From: xxdd001 Date: Mon, 14 Sep 2026 20:09:18 +0800 Subject: [PATCH] fix: reconcileConnections CME under high player churn; bump v1.1.4 --- gradle.properties | 2 +- src/main/java/dev/modzuozhi/core/dimthread/ServerManager.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index a3bce76..2724a98 100644 --- a/gradle.properties +++ b/gradle.properties @@ -37,7 +37,7 @@ mod_name=Dimensional Ripper # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=MIT # The mod version. See https://semver.org/ -mod_version=1.1.3 +mod_version=1.1.4 # The group ID for the mod. It is only important when publishing build artifacts to Maven. mod_group_id=dev.modzuozhi # The authors of the mod. This is a simple text string that is used for display purposes in the mod list. diff --git a/src/main/java/dev/modzuozhi/core/dimthread/ServerManager.java b/src/main/java/dev/modzuozhi/core/dimthread/ServerManager.java index 255120b..a785786 100644 --- a/src/main/java/dev/modzuozhi/core/dimthread/ServerManager.java +++ b/src/main/java/dev/modzuozhi/core/dimthread/ServerManager.java @@ -197,7 +197,9 @@ public class ServerManager { * 已在正确 loop 中的连接是 no-op,仅发生实际迁移时才增删。单机/少量玩家时开销可忽略。 */ public void reconcileConnections(MinecraftServer server) { - for (ServerPlayer player : server.getPlayerList().getPlayers()) { + // 快照拷贝:playerList.getPlayers() 返回不可变包装,高负载下(大量假人批量上线/下线) + // 原列表可能被并发修改 → 遍历报 ConcurrentModificationException。拷贝后迭代安全。 + for (ServerPlayer player : new java.util.ArrayList<>(server.getPlayerList().getPlayers())) { if (player.connection != null) { routeConnection(player.connection.getConnection(), player.serverLevel()); }