fix: reconcileConnections CME under high player churn; bump v1.1.4

This commit is contained in:
xxdd001 committed 2026-09-14 20:09:18 +08:00
1 parent 563787c5d4
commit 98e39a0265
2 files changed
+4 -2

No files matched your search

+1 -1
View File
@@ -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. # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT mod_license=MIT
# The mod version. See https://semver.org/ # 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. # The group ID for the mod. It is only important when publishing build artifacts to Maven.
mod_group_id=dev.modzuozhi 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. # The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
@@ -197,7 +197,9 @@ public class ServerManager {
* 已在正确 loop 中的连接是 no-op,仅发生实际迁移时才增删。单机/少量玩家时开销可忽略。 * 已在正确 loop 中的连接是 no-op,仅发生实际迁移时才增删。单机/少量玩家时开销可忽略。
*/ */
public void reconcileConnections(MinecraftServer server) { 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) { if (player.connection != null) {
routeConnection(player.connection.getConnection(), player.serverLevel()); routeConnection(player.connection.getConnection(), player.serverLevel());
} }