From c987af4684bc3d963b4f255fec755bb1a5cb4e36 Mon Sep 17 00:00:00 2001 From: Madis Date: Sun, 22 Oct 2023 13:26:20 +0200 Subject: [PATCH 1/4] Unintrusive vanilla --- .../nochatreports/common/core/ServerSafetyLevel.java | 6 ++++++ .../nochatreports/common/core/ServerSafetyState.java | 2 +- .../common/mixins/client/MixinChatListener.java | 4 ++++ src/main/resources/assets/nochatreports/lang/en_us.json | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/aizistral/nochatreports/common/core/ServerSafetyLevel.java b/src/main/java/com/aizistral/nochatreports/common/core/ServerSafetyLevel.java index 81e35178..c34ba54e 100644 --- a/src/main/java/com/aizistral/nochatreports/common/core/ServerSafetyLevel.java +++ b/src/main/java/com/aizistral/nochatreports/common/core/ServerSafetyLevel.java @@ -31,6 +31,12 @@ public enum ServerSafetyLevel { */ UNINTRUSIVE, + /** + * Same as UNINTRUSIVE, but also checks that the server type is vanilla. + * This only changes the tooltip to better inform the user, not any functionality. + */ + UNINTRUSIVE_VANILLA, + /** * For servers that have enforce-secure-profile enabled, or enforce signed messages * through some other means. Users of this mod can choose to play on those servers regardless diff --git a/src/main/java/com/aizistral/nochatreports/common/core/ServerSafetyState.java b/src/main/java/com/aizistral/nochatreports/common/core/ServerSafetyState.java index 366811fb..856e8714 100644 --- a/src/main/java/com/aizistral/nochatreports/common/core/ServerSafetyState.java +++ b/src/main/java/com/aizistral/nochatreports/common/core/ServerSafetyState.java @@ -70,7 +70,7 @@ public static boolean isInSingleplayer() { } public static boolean isDetermined() { - return current != ServerSafetyLevel.UNINTRUSIVE && current != ServerSafetyLevel.UNDEFINED + return current != ServerSafetyLevel.UNINTRUSIVE && current != ServerSafetyLevel.UNINTRUSIVE_VANILLA && current != ServerSafetyLevel.UNDEFINED && current != ServerSafetyLevel.UNKNOWN; } diff --git a/src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatListener.java b/src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatListener.java index e304ad83..4c98e9dc 100644 --- a/src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatListener.java +++ b/src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatListener.java @@ -22,6 +22,7 @@ import com.aizistral.nochatreports.common.gui.UnsafeServerScreen; import net.minecraft.client.Minecraft; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screens.ChatScreen; import net.minecraft.client.multiplayer.chat.ChatListener; import net.minecraft.client.multiplayer.chat.ChatTrustLevel; @@ -88,6 +89,9 @@ private void onEvaluateTrustLevel(PlayerChatMessage playerChatMessage, Component } else { if (playerChatMessage.hasSignature() && ServerSafetyState.getCurrent() == ServerSafetyLevel.SECURE) { ServerSafetyState.updateCurrent(ServerSafetyLevel.UNINTRUSIVE); + + if(this.client.getNetworkHandler().getBrand() == "vanilla") + ServerSafetyState.updateCurrent(ServerSafetyLevel.UNINTRUSIVE_VANILLA); } var evaluate = ChatTrustLevel.evaluate(playerChatMessage, component, instant); diff --git a/src/main/resources/assets/nochatreports/lang/en_us.json b/src/main/resources/assets/nochatreports/lang/en_us.json index 45857b50..c53125a0 100644 --- a/src/main/resources/assets/nochatreports/lang/en_us.json +++ b/src/main/resources/assets/nochatreports/lang/en_us.json @@ -9,6 +9,7 @@ "gui.nochatreports.safety_status.secure": "This server has No Chat Reports installed, or prevents your messages from being reportable in some other known way. You can chat safely.", "gui.nochatreports.safety_status.singleplayer": "You can always chat safely in singleplayer and self-hosted LAN worlds.", "gui.nochatreports.safety_status.unintrusive": "This server allows you to send unsigned messages which cannot be reported to Mojang. Unless some kind of plugin is installed on the server that prevents chat reports - vanilla clients will still send signed messages, display unsigned messages as \"Unverified\" and not show them if \"Only Show Secure Chat\" is enabled in chat options.", + "gui.nochatreports.safety_status.unintrusive_vanilla": "This server allows you to send unsigned messages which cannot be reported to Mojang. Because this is a vanilla server, vanilla clients will still send signed messages, display unsigned messages as \"Unverified\" and not show them if \"Only Show Secure Chat\" is enabled in chat options.", "gui.nochatreports.safety_status.insecure": "This server currently demands all chat messages to be signed. All signed messages are a potentially incriminating evidence that can be used against you in a chat report.", "gui.nochatreports.safety_status.insecure_signing": "You have enabled chat signing, which makes all your messages a potentially incriminating evidence that can be used against you in a chat report.", "gui.nochatreports.safety_status.realms": "This is a Realms server. Not only is there no way to prevent chat reports here, but Mojang also employs automated chat monitoring to identify potential \"online harms\" and escalate them to human review, whether the owner of the Realm likes it or not. Your only hope is chat encryption.", From de668dbf80504342221943fd4877784a7f8b339e Mon Sep 17 00:00:00 2001 From: Madis Date: Sun, 22 Oct 2023 13:28:31 +0200 Subject: [PATCH 2/4] Update et_ee.json --- src/main/resources/assets/nochatreports/lang/et_ee.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/assets/nochatreports/lang/et_ee.json b/src/main/resources/assets/nochatreports/lang/et_ee.json index 70b86143..184044b8 100644 --- a/src/main/resources/assets/nochatreports/lang/et_ee.json +++ b/src/main/resources/assets/nochatreports/lang/et_ee.json @@ -7,6 +7,7 @@ "gui.nochatreports.safety_status.secure": "Sellele serverile on paigaldatud mod No Chat Reports või see piirab sinu sõnumitest teatamist mõnel muul teadaoleval viisil. Sa saad turvaliselt vestelda.", "gui.nochatreports.safety_status.singleplayer": "Üksikmängus saad sa alati turvaliselt vestelda.", "gui.nochatreports.safety_status.unintrusive": "See server võimaldab saata signeerimata sõnumeid, mida ei saa Mojangile teatada. Kui serveris pole mõnda vestlusest teatamise piiramise pluginat, saadavad vanillikliendid siiski signeeritud sõnumeid, kuvavad signeerimata sõnumeid \"kinnitamata sõnumitena\" ning ei kuva neid üldse, kui vestlusseadetes on lubatud \"Vaid turvaline vestlus\".", + "gui.nochatreports.safety_status.unintrusive_vanilla": "See server võimaldab saata signeerimata sõnumeid, mida ei saa Mojangile teatada. Kuna see on vanilliserver, saadavad vanillikliendid siiski signeeritud sõnumeid, kuvavad signeerimata sõnumeid \"kinnitamata sõnumitena\" ning ei kuva neid üldse, kui vestlusseadetes on lubatud \"Vaid turvaline vestlus\".", "gui.nochatreports.safety_status.insecure": "See server nõuab hetkel kõikide mängijasõnumite signeerimist. Kõik signeeritud sõnumid on potentsiaalselt süüdistav asitõend, mida saab raportis sinu vastu kasutada.", "gui.nochatreports.safety_status.insecure_signing": "Oled lubanud vestluse signeerimise, mis teeb kõik su sõnumid potentsiaalselt süüdistavaks asitõendiks, mida saab raportis sinu vastu kasutada.", "gui.nochatreports.safety_status.realms": "See on Realmsi server. Lisaks sellele, et siin ei saa vestlusest teatamist keelata, kasutab Mojang ka automaatset vestlusseiret, et tuvastada potentsiaalsed \"võrgukäitumise rikkumised\" ning saata need edasi inimkontrolli, olenemata sellest, kas see meeldib realmi omanikule või mitte. Sinu ainus lootus on vestluse krüpteerimine.", From 2f970ef884851362967d29d02c6ff6e2dca186f7 Mon Sep 17 00:00:00 2001 From: Madis Otenurm Date: Sun, 22 Oct 2023 14:29:38 +0300 Subject: [PATCH 3/4] Update ServerSafetyLevel.java --- .../aizistral/nochatreports/common/core/ServerSafetyLevel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/aizistral/nochatreports/common/core/ServerSafetyLevel.java b/src/main/java/com/aizistral/nochatreports/common/core/ServerSafetyLevel.java index c34ba54e..b59557f0 100644 --- a/src/main/java/com/aizistral/nochatreports/common/core/ServerSafetyLevel.java +++ b/src/main/java/com/aizistral/nochatreports/common/core/ServerSafetyLevel.java @@ -33,7 +33,7 @@ public enum ServerSafetyLevel { /** * Same as UNINTRUSIVE, but also checks that the server type is vanilla. - * This only changes the tooltip to better inform the user, not any functionality. + * This only changes the tooltip to better inform the user, functionality remains identical to UNINTRUSIVE. */ UNINTRUSIVE_VANILLA, From 79be11496b2a166d3112ac5e8457d4bc71fa0f4d Mon Sep 17 00:00:00 2001 From: Madis Date: Wed, 17 Apr 2024 21:39:18 +0200 Subject: [PATCH 4/4] Fixes --- .../common/mixins/client/MixinChatListener.java | 4 ++-- .../common/mixins/client/MixinChatScreen.java | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatListener.java b/src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatListener.java index 4c98e9dc..8f14e6b1 100644 --- a/src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatListener.java +++ b/src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatListener.java @@ -2,6 +2,7 @@ import java.time.Instant; import java.util.Base64; +import java.util.Objects; import java.util.UUID; import org.spongepowered.asm.mixin.Mixin; @@ -22,7 +23,6 @@ import com.aizistral.nochatreports.common.gui.UnsafeServerScreen; import net.minecraft.client.Minecraft; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screens.ChatScreen; import net.minecraft.client.multiplayer.chat.ChatListener; import net.minecraft.client.multiplayer.chat.ChatTrustLevel; @@ -90,7 +90,7 @@ private void onEvaluateTrustLevel(PlayerChatMessage playerChatMessage, Component if (playerChatMessage.hasSignature() && ServerSafetyState.getCurrent() == ServerSafetyLevel.SECURE) { ServerSafetyState.updateCurrent(ServerSafetyLevel.UNINTRUSIVE); - if(this.client.getNetworkHandler().getBrand() == "vanilla") + if(Objects.equals(Minecraft.getInstance().getCurrentServer().status.getString(), "vanilla")) // Doesn't seem correct, but close ServerSafetyState.updateCurrent(ServerSafetyLevel.UNINTRUSIVE_VANILLA); } diff --git a/src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatScreen.java b/src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatScreen.java index f94c8a6f..e15d47ef 100644 --- a/src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatScreen.java +++ b/src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatScreen.java @@ -245,10 +245,11 @@ private int getSpriteSet(ServerSafetyLevel level) { return switch (level) { case INSECURE -> 0; case UNINTRUSIVE -> 1; - case SECURE, SINGLEPLAYER -> 2; - case REALMS -> 3; - case UNKNOWN -> 4; - case UNDEFINED -> 5; + case UNINTRUSIVE_VANILLA -> 2; + case SECURE, SINGLEPLAYER -> 3; + case REALMS -> 4; + case UNKNOWN -> 5; + case UNDEFINED -> 6; }; }