From 2e5e1195b59fcf428b4cb4e37c4a2a9a344b71f4 Mon Sep 17 00:00:00 2001 From: 3944Realms Date: Sat, 6 Jun 2026 03:34:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E3=80=81=E7=A6=BB=E5=BC=80=E6=B6=88=E6=81=AF=E9=9A=90?= =?UTF-8?q?=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- forge-mod/gradle.properties | 2 +- .../crossmod/mixin/MixinPlayerList.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/forge-mod/gradle.properties b/forge-mod/gradle.properties index 87d6051..d522331 100644 --- a/forge-mod/gradle.properties +++ b/forge-mod/gradle.properties @@ -49,7 +49,7 @@ mod_name=Leisure Time Dock Mod # 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.1 +mod_version=1.1.2 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/forge-mod/src/main/java/com/leisuretimedock/crossmod/mixin/MixinPlayerList.java b/forge-mod/src/main/java/com/leisuretimedock/crossmod/mixin/MixinPlayerList.java index f16e7fa..68a4d9b 100644 --- a/forge-mod/src/main/java/com/leisuretimedock/crossmod/mixin/MixinPlayerList.java +++ b/forge-mod/src/main/java/com/leisuretimedock/crossmod/mixin/MixinPlayerList.java @@ -2,6 +2,7 @@ package com.leisuretimedock.crossmod.mixin; import com.leisuretimedock.crossmod.config.CrossServerConfigManager; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.contents.TranslatableContents; import net.minecraft.server.players.PlayerList; import org.slf4j.Logger; import org.spongepowered.asm.mixin.Final; @@ -23,8 +24,16 @@ public class MixinPlayerList { ) private void send(Component message, boolean bypassHiddenChat, CallbackInfo ci) { try { - if (CrossServerConfigManager.INSTANCE.isDisabledJoinQuitMessage() && message.toString().contains("multiplayer.player.joined") || message.toString().contains("multiplayer.player.left")) { - ci.cancel(); + if (CrossServerConfigManager.INSTANCE.isDisabledJoinQuitMessage()) { + // 更好的方式:检查消息的翻译键 + if (message.getContents() instanceof TranslatableContents translatable) { + String key = translatable.getKey(); + if ("multiplayer.player.joined".equals(key) || + "multiplayer.player.joined.renamed".equals(key) || + "multiplayer.player.left".equals(key)) { + ci.cancel(); + } + } } } catch (Exception e) { LOGGER.warn("Exception while sending system message to client", e);