From af90a12079c558ea4a1efc9385e93bcdcb9917dd Mon Sep 17 00:00:00 2001 From: Aizistral Date: Mon, 2 Jan 2023 14:37:04 +0100 Subject: Commence work on branch unification --- .../nochatreports/fabric/RandomFabricClass.java | 9 +++ .../fabric/mixins/MixinMinecraft.java | 20 +++++++ src/fabric/resources/fabric.mod.json | 60 +++++++++++++++++++ .../resources/nochatreports-fabric.mixins.json | 17 ++++++ src/fabric/resources/nochatreports.accesswidener | 28 +++++++++ .../com/aizistral/nochatreports/NoChatReports.java | 3 +- .../nochatreports/NoChatReportsClient.java | 1 + .../aizistral/nochatreports/config/JSONConfig.java | 2 + .../nochatreports/config/ModMenuIntegration.java | 1 + .../aizistral/nochatreports/config/NCRConfig.java | 6 ++ .../nochatreports/config/NCRConfigClient.java | 2 + .../nochatreports/config/NCRConfigCommon.java | 3 + .../nochatreports/config/NCRConfigEncryption.java | 2 + .../nochatreports/config/NCRServerPreferences.java | 2 + .../nochatreports/config/ServerAddressAdapter.java | 1 + .../nochatreports/core/EncryptionUtil.java | 1 + .../nochatreports/core/ServerSafetyLevel.java | 2 + .../nochatreports/core/ServerSafetyState.java | 2 + .../aizistral/nochatreports/core/SigningMode.java | 1 + .../encryption/AESCFB8Encryption.java | 3 + .../nochatreports/encryption/AESCFB8Encryptor.java | 5 ++ .../nochatreports/encryption/AESECBEncryption.java | 3 + .../nochatreports/encryption/AESECBEncryptor.java | 5 ++ .../nochatreports/encryption/AESEncryption.java | 3 + .../nochatreports/encryption/AESEncryptor.java | 4 ++ .../nochatreports/encryption/AESGCMEncryption.java | 3 + .../nochatreports/encryption/AESGCMEncryptor.java | 5 ++ .../nochatreports/encryption/CaesarEncryption.java | 3 + .../nochatreports/encryption/CaesarEncryptor.java | 4 ++ .../nochatreports/encryption/Encryption.java | 7 +++ .../nochatreports/encryption/Encryptor.java | 2 + .../nochatreports/gui/AdvancedImageButton.java | 1 + .../nochatreports/gui/AdvancedTooltip.java | 1 + .../nochatreports/gui/EncryptionButton.java | 4 ++ .../nochatreports/gui/EncryptionConfigScreen.java | 2 + .../nochatreports/gui/EncryptionWarningScreen.java | 3 + .../nochatreports/gui/RealmsWarningScreen.java | 2 + .../nochatreports/gui/TriageWarningScreen.java | 1 + .../nochatreports/gui/UnsafeServerScreen.java | 1 + .../mixins/client/MixinChatComponent.java | 1 + .../mixins/client/MixinChatListener.java | 1 + .../mixins/client/MixinConnectScreen.java | 1 + .../mixins/client/MixinGuiMessageTag.java | 3 +- .../mixins/client/MixinServerStatusPinger$1.java | 33 ++++++++--- src/main/resources/fabric.mod.json | 59 ------------------- src/main/resources/nochatreports.accesswidener | 28 --------- src/main/resources/nochatreports.mixins.json | 3 +- .../nochatreports/debug/NoChatReportsDebug.java | 44 -------------- .../nochatreports/debug/ReportWriter.java | 41 ------------- .../nochatreports/debug/UnrealPlayer.java | 64 --------------------- .../mixins/MixinAbuseReportSenderServices.java | 39 ------------- .../nochatreports/debug/mixins/MixinMinecraft.java | 24 -------- .../debug/mixins/MixinPlayerEntry.java | 26 --------- src/test/resources/NCR_logo.png | Bin 1580 -> 0 bytes .../minecraft/textures/gui/title/edition.png | Bin 453 -> 0 bytes src/test/resources/fabric.mod.json | 36 ------------ src/test/resources/nochatreportstest.mixins.json | 19 ------ 57 files changed, 255 insertions(+), 392 deletions(-) create mode 100644 src/fabric/java/com/aizistral/nochatreports/fabric/RandomFabricClass.java create mode 100644 src/fabric/java/com/aizistral/nochatreports/fabric/mixins/MixinMinecraft.java create mode 100644 src/fabric/resources/fabric.mod.json create mode 100644 src/fabric/resources/nochatreports-fabric.mixins.json create mode 100644 src/fabric/resources/nochatreports.accesswidener delete mode 100644 src/main/resources/fabric.mod.json delete mode 100644 src/main/resources/nochatreports.accesswidener delete mode 100644 src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java delete mode 100644 src/test/java/com/aizistral/nochatreports/debug/ReportWriter.java delete mode 100644 src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java delete mode 100644 src/test/java/com/aizistral/nochatreports/debug/mixins/MixinAbuseReportSenderServices.java delete mode 100644 src/test/java/com/aizistral/nochatreports/debug/mixins/MixinMinecraft.java delete mode 100644 src/test/java/com/aizistral/nochatreports/debug/mixins/MixinPlayerEntry.java delete mode 100644 src/test/resources/NCR_logo.png delete mode 100644 src/test/resources/assets/minecraft/textures/gui/title/edition.png delete mode 100644 src/test/resources/fabric.mod.json delete mode 100644 src/test/resources/nochatreportstest.mixins.json (limited to 'src') diff --git a/src/fabric/java/com/aizistral/nochatreports/fabric/RandomFabricClass.java b/src/fabric/java/com/aizistral/nochatreports/fabric/RandomFabricClass.java new file mode 100644 index 0000000..c2bfc09 --- /dev/null +++ b/src/fabric/java/com/aizistral/nochatreports/fabric/RandomFabricClass.java @@ -0,0 +1,9 @@ +package com.aizistral.nochatreports.fabric; + +public class RandomFabricClass { + public static final String HELLO = "HELLO"; + + public RandomFabricClass() { + + } +} diff --git a/src/fabric/java/com/aizistral/nochatreports/fabric/mixins/MixinMinecraft.java b/src/fabric/java/com/aizistral/nochatreports/fabric/mixins/MixinMinecraft.java new file mode 100644 index 0000000..70f3f9e --- /dev/null +++ b/src/fabric/java/com/aizistral/nochatreports/fabric/mixins/MixinMinecraft.java @@ -0,0 +1,20 @@ +package com.aizistral.nochatreports.fabric.mixins; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import com.aizistral.nochatreports.NoChatReports; + +import net.minecraft.client.Minecraft; + +@Mixin(Minecraft.class) +public class MixinMinecraft { + + @Inject(method = "run", at = @At("HEAD")) + private void onRun(CallbackInfo info) { + NoChatReports.LOGGER.info("Game entered main loop!"); + } + +} diff --git a/src/fabric/resources/fabric.mod.json b/src/fabric/resources/fabric.mod.json new file mode 100644 index 0000000..c883c9f --- /dev/null +++ b/src/fabric/resources/fabric.mod.json @@ -0,0 +1,60 @@ +{ + "schemaVersion": 1, + "id": "nochatreports", + "version": "${version}", + + "name": "No Chat Reports", + "description": "Strips cryptographic signatures from player messages, making it impossible to track and associate them with your Mojang/Microsoft account, as well as use Player Chat Reporting feature.", + "authors": [ + "Aizistral" + ], + "contributors": [ + "Madis0 (aka robotkoer)" + ], + "contact": { + "homepage": "https://www.curseforge.com/minecraft/mc-mods/no-chat-reports", + "sources": "https://github.com/Aizistral-Studios/No-Chat-Reports", + "issues": "https://github.com/Aizistral-Studios/No-Chat-Reports/issues" + }, + + "license": "WTFPL", + "icon": "NCR_logo.png", + + "environment": "*", + "entrypoints": { + "main": [ + "com.aizistral.nochatreports.NoChatReports" + ], + "client": [ + "com.aizistral.nochatreports.NoChatReportsClient" + ], + "modmenu": [ + "com.aizistral.nochatreports.config.ModMenuIntegration" + ] + }, + "mixins": [ + "nochatreports.mixins.json", + "nochatreports-fabric.mixins.json" + ], + + "depends": { + "fabricloader": ">=0.14.6", + "fabric-networking-api-v1": "*", + "fabric-screen-api-v1": "*", + "fabric-rendering-v1": "*", + "fabric-resource-loader-v0": "*", + "minecraft": [ ">=1.19.3-alpha.22.44.a" ], + "java": ">=17" + }, + "suggests": {}, + "accessWidener" : "nochatreports.accesswidener", + + "custom": { + "modmenu": { + "links": { + "modmenu.modrinth": "https://modrinth.com/mod/no-chat-reports", + "modmenu.curseforge": "https://www.curseforge.com/minecraft/mc-mods/no-chat-reports" + } + } + } +} diff --git a/src/fabric/resources/nochatreports-fabric.mixins.json b/src/fabric/resources/nochatreports-fabric.mixins.json new file mode 100644 index 0000000..3406294 --- /dev/null +++ b/src/fabric/resources/nochatreports-fabric.mixins.json @@ -0,0 +1,17 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "com.aizistral.nochatreports.fabric.mixins", + "compatibilityLevel": "JAVA_17", + "verbose": true, + "mixins": [ + ], + "client": [ + "MixinMinecraft" + ], + "server": [ + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/src/fabric/resources/nochatreports.accesswidener b/src/fabric/resources/nochatreports.accesswidener new file mode 100644 index 0000000..ccf4f65 --- /dev/null +++ b/src/fabric/resources/nochatreports.accesswidener @@ -0,0 +1,28 @@ +accessWidener v1 named +mutable field net/minecraft/client/multiplayer/ClientPacketListener callbackScreen Lnet/minecraft/client/gui/screens/Screen; +accessible field net/minecraft/client/multiplayer/ClientPacketListener callbackScreen Lnet/minecraft/client/gui/screens/Screen; +accessible field net/minecraft/client/gui/screens/SimpleOptionsSubScreen list Lnet/minecraft/client/gui/components/OptionsList; +accessible field net/minecraft/client/gui/components/ImageButton xTexStart I +accessible field net/minecraft/client/gui/components/ImageButton yTexStart I +mutable field net/minecraft/client/gui/components/ImageButton xTexStart I +mutable field net/minecraft/client/gui/components/ImageButton yTexStart I +accessible field net/minecraft/network/chat/contents/TranslatableContents args [Ljava/lang/Object; +mutable field net/minecraft/network/chat/contents/TranslatableContents args [Ljava/lang/Object; +accessible field net/minecraft/network/chat/MutableComponent contents Lnet/minecraft/network/chat/ComponentContents; +mutable field net/minecraft/network/chat/MutableComponent contents Lnet/minecraft/network/chat/ComponentContents; +accessible field net/minecraft/client/gui/screens/multiplayer/WarningScreen message Lnet/minecraft/client/gui/components/MultiLineLabel; +accessible field net/minecraft/client/multiplayer/ClientPacketListener signedMessageEncoder Lnet/minecraft/network/chat/SignedMessageChain$Encoder; +accessible field net/minecraft/client/multiplayer/ClientPacketListener chatSession Lnet/minecraft/network/chat/LocalChatSession; +accessible method net/minecraft/client/gui/components/Tooltip (Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/Component;)V +accessible field net/minecraft/client/gui/components/Tooltip MAX_WIDTH I +accessible field net/minecraft/client/gui/components/Tooltip message Lnet/minecraft/network/chat/Component; +accessible field net/minecraft/client/gui/components/Tooltip narration Lnet/minecraft/network/chat/Component; +accessible field net/minecraft/client/gui/components/Tooltip cachedTooltip Ljava/util/List; +accessible field net/minecraft/client/gui/screens/Screen minecraft Lnet/minecraft/client/Minecraft; +accessible field net/minecraft/client/gui/screens/Screen itemRenderer Lnet/minecraft/client/renderer/entity/ItemRenderer; +accessible field net/minecraft/client/gui/screens/Screen font Lnet/minecraft/client/gui/Font; +accessible field net/minecraft/client/gui/components/AbstractWidget tooltip Lnet/minecraft/client/gui/components/Tooltip; +accessible field net/minecraft/client/gui/components/AbstractWidget tooltipMsDelay I +accessible method net/minecraft/client/gui/components/AbstractWidget updateTooltip ()V +extendable method net/minecraft/client/gui/components/AbstractWidget updateTooltip ()V +accessible field net/minecraft/client/gui/screens/OptionsScreen TELEMETRY Lnet/minecraft/network/chat/Component; \ No newline at end of file diff --git a/src/main/java/com/aizistral/nochatreports/NoChatReports.java b/src/main/java/com/aizistral/nochatreports/NoChatReports.java index a70f8f0..584e8ac 100644 --- a/src/main/java/com/aizistral/nochatreports/NoChatReports.java +++ b/src/main/java/com/aizistral/nochatreports/NoChatReports.java @@ -1,6 +1,5 @@ package com.aizistral.nochatreports; -import com.aizistral.nochatreports.config.NCRConfig; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.networking.v1.PacketSender; import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; @@ -12,6 +11,8 @@ import net.minecraft.server.network.ServerGamePacketListenerImpl; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.aizistral.nochatreports.config.NCRConfig; + import java.nio.charset.Charset; /** diff --git a/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java b/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java index 4cd2f8e..2fa7ecf 100644 --- a/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java +++ b/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java @@ -1,5 +1,6 @@ package com.aizistral.nochatreports; +import com.aizistral.nochatreports.NoChatReports; import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerDataExtension; import com.aizistral.nochatreports.core.ServerSafetyLevel; diff --git a/src/main/java/com/aizistral/nochatreports/config/JSONConfig.java b/src/main/java/com/aizistral/nochatreports/config/JSONConfig.java index edc8bec..6f5f488 100644 --- a/src/main/java/com/aizistral/nochatreports/config/JSONConfig.java +++ b/src/main/java/com/aizistral/nochatreports/config/JSONConfig.java @@ -9,6 +9,8 @@ import java.util.Optional; import java.util.function.Supplier; import com.aizistral.nochatreports.NoChatReports; +import com.aizistral.nochatreports.config.JSONConfig; +import com.aizistral.nochatreports.config.ServerAddressAdapter; import com.google.gson.ExclusionStrategy; import com.google.gson.FieldAttributes; import com.google.gson.Gson; diff --git a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java index 7a90aa8..6163a88 100644 --- a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java +++ b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java @@ -1,5 +1,6 @@ package com.aizistral.nochatreports.config; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerSafetyState; import com.aizistral.nochatreports.core.SigningMode; import com.aizistral.nochatreports.gui.FontHelper; diff --git a/src/main/java/com/aizistral/nochatreports/config/NCRConfig.java b/src/main/java/com/aizistral/nochatreports/config/NCRConfig.java index 7f203bc..5a1137f 100644 --- a/src/main/java/com/aizistral/nochatreports/config/NCRConfig.java +++ b/src/main/java/com/aizistral/nochatreports/config/NCRConfig.java @@ -1,6 +1,12 @@ package com.aizistral.nochatreports.config; import com.aizistral.nochatreports.NoChatReports; +import com.aizistral.nochatreports.config.JSONConfig; +import com.aizistral.nochatreports.config.NCRConfigClient; +import com.aizistral.nochatreports.config.NCRConfigCommon; +import com.aizistral.nochatreports.config.NCRConfigEncryption; +import com.aizistral.nochatreports.config.NCRServerPreferences; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; diff --git a/src/main/java/com/aizistral/nochatreports/config/NCRConfigClient.java b/src/main/java/com/aizistral/nochatreports/config/NCRConfigClient.java index 6054f7e..800deaf 100644 --- a/src/main/java/com/aizistral/nochatreports/config/NCRConfigClient.java +++ b/src/main/java/com/aizistral/nochatreports/config/NCRConfigClient.java @@ -1,5 +1,7 @@ package com.aizistral.nochatreports.config; +import com.aizistral.nochatreports.config.JSONConfig; +import com.aizistral.nochatreports.config.NCRConfigClient; import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.aizistral.nochatreports.core.SigningMode; import com.aizistral.nochatreports.mixins.client.MixinChatListener; diff --git a/src/main/java/com/aizistral/nochatreports/config/NCRConfigCommon.java b/src/main/java/com/aizistral/nochatreports/config/NCRConfigCommon.java index 38df30e..861f57d 100644 --- a/src/main/java/com/aizistral/nochatreports/config/NCRConfigCommon.java +++ b/src/main/java/com/aizistral/nochatreports/config/NCRConfigCommon.java @@ -1,5 +1,8 @@ package com.aizistral.nochatreports.config; +import com.aizistral.nochatreports.config.JSONConfig; +import com.aizistral.nochatreports.config.NCRConfigCommon; + public final class NCRConfigCommon extends JSONConfig { protected static final String FILE_NAME = "NoChatReports/NCR-Common.json"; diff --git a/src/main/java/com/aizistral/nochatreports/config/NCRConfigEncryption.java b/src/main/java/com/aizistral/nochatreports/config/NCRConfigEncryption.java index 525abff..6cd4f0a 100644 --- a/src/main/java/com/aizistral/nochatreports/config/NCRConfigEncryption.java +++ b/src/main/java/com/aizistral/nochatreports/config/NCRConfigEncryption.java @@ -1,5 +1,7 @@ package com.aizistral.nochatreports.config; +import com.aizistral.nochatreports.config.JSONConfig; +import com.aizistral.nochatreports.config.NCRConfigEncryption; import com.aizistral.nochatreports.encryption.Encryption; import com.aizistral.nochatreports.encryption.Encryptor; diff --git a/src/main/java/com/aizistral/nochatreports/config/NCRServerPreferences.java b/src/main/java/com/aizistral/nochatreports/config/NCRServerPreferences.java index d94be20..81ad97f 100644 --- a/src/main/java/com/aizistral/nochatreports/config/NCRServerPreferences.java +++ b/src/main/java/com/aizistral/nochatreports/config/NCRServerPreferences.java @@ -8,6 +8,8 @@ import java.util.Optional; import org.jetbrains.annotations.Nullable; import com.aizistral.nochatreports.NoChatReportsClient; +import com.aizistral.nochatreports.config.JSONConfig; +import com.aizistral.nochatreports.config.NCRServerPreferences; import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.aizistral.nochatreports.core.ServerSafetyState; import com.aizistral.nochatreports.core.SigningMode; diff --git a/src/main/java/com/aizistral/nochatreports/config/ServerAddressAdapter.java b/src/main/java/com/aizistral/nochatreports/config/ServerAddressAdapter.java index c68aed9..8d63bd1 100644 --- a/src/main/java/com/aizistral/nochatreports/config/ServerAddressAdapter.java +++ b/src/main/java/com/aizistral/nochatreports/config/ServerAddressAdapter.java @@ -1,5 +1,6 @@ package com.aizistral.nochatreports.config; +import com.aizistral.nochatreports.config.ServerAddressAdapter; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; diff --git a/src/main/java/com/aizistral/nochatreports/core/EncryptionUtil.java b/src/main/java/com/aizistral/nochatreports/core/EncryptionUtil.java index 39e9a11..a614bba 100644 --- a/src/main/java/com/aizistral/nochatreports/core/EncryptionUtil.java +++ b/src/main/java/com/aizistral/nochatreports/core/EncryptionUtil.java @@ -2,6 +2,7 @@ package com.aizistral.nochatreports.core; import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.encryption.Encryptor; + import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentContents; import net.minecraft.network.chat.MutableComponent; diff --git a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java index 69e69aa..817f192 100644 --- a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java +++ b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java @@ -1,5 +1,7 @@ package com.aizistral.nochatreports.core; +import com.aizistral.nochatreports.core.ServerSafetyState; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.network.chat.Component; diff --git a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyState.java b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyState.java index ced4281..73b08ad 100644 --- a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyState.java +++ b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyState.java @@ -1,6 +1,8 @@ package com.aizistral.nochatreports.core; +import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.aizistral.nochatreports.gui.UnsafeServerScreen; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; diff --git a/src/main/java/com/aizistral/nochatreports/core/SigningMode.java b/src/main/java/com/aizistral/nochatreports/core/SigningMode.java index 3402d6c..32b6dba 100644 --- a/src/main/java/com/aizistral/nochatreports/core/SigningMode.java +++ b/src/main/java/com/aizistral/nochatreports/core/SigningMode.java @@ -3,6 +3,7 @@ package com.aizistral.nochatreports.core; import org.jetbrains.annotations.Nullable; import com.aizistral.nochatreports.config.NCRConfig; +import com.aizistral.nochatreports.core.SigningMode; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; diff --git a/src/main/java/com/aizistral/nochatreports/encryption/AESCFB8Encryption.java b/src/main/java/com/aizistral/nochatreports/encryption/AESCFB8Encryption.java index 09b075c..197f753 100644 --- a/src/main/java/com/aizistral/nochatreports/encryption/AESCFB8Encryption.java +++ b/src/main/java/com/aizistral/nochatreports/encryption/AESCFB8Encryption.java @@ -2,6 +2,9 @@ package com.aizistral.nochatreports.encryption; import java.security.InvalidKeyException; +import com.aizistral.nochatreports.encryption.AESCFB8Encryptor; +import com.aizistral.nochatreports.encryption.AESEncryption; + public class AESCFB8Encryption extends AESEncryption { protected AESCFB8Encryption() { diff --git a/src/main/java/com/aizistral/nochatreports/encryption/AESCFB8Encryptor.java b/src/main/java/com/aizistral/nochatreports/encryption/AESCFB8Encryptor.java index 63476f3..c4f045d 100644 --- a/src/main/java/com/aizistral/nochatreports/encryption/AESCFB8Encryptor.java +++ b/src/main/java/com/aizistral/nochatreports/encryption/AESCFB8Encryptor.java @@ -4,6 +4,11 @@ import net.minecraft.util.Tuple; import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; + +import com.aizistral.nochatreports.encryption.AESCFB8Encryption; +import com.aizistral.nochatreports.encryption.AESEncryptor; +import com.aizistral.nochatreports.encryption.Encryption; + import java.nio.ByteBuffer; import java.security.InvalidKeyException; import java.security.spec.AlgorithmParameterSpec; diff --git a/src/main/java/com/aizistral/nochatreports/encryption/AESECBEncryption.java b/src/main/java/com/aizistral/nochatreports/encryption/AESECBEncryption.java index 359d509..5c4216a 100644 --- a/src/main/java/com/aizistral/nochatreports/encryption/AESECBEncryption.java +++ b/src/main/java/com/aizistral/nochatreports/encryption/AESECBEncryption.java @@ -2,6 +2,9 @@ package com.aizistral.nochatreports.encryption; import java.security.InvalidKeyException; +import com.aizistral.nochatreports.encryption.AESECBEncryptor; +import com.aizistral.nochatreports.encryption.AESEncryption; + public class AESECBEncryption extends AESEncryption { protected AESECBEncryption() { diff --git a/src/main/java/com/aizistral/nochatreports/encryption/AESECBEncryptor.java b/src/main/java/com/aizistral/nochatreports/encryption/AESECBEncryptor.java index a853f0c..d12051a 100644 --- a/src/main/java/com/aizistral/nochatreports/encryption/AESECBEncryptor.java +++ b/src/main/java/com/aizistral/nochatreports/encryption/AESECBEncryptor.java @@ -3,6 +3,11 @@ package com.aizistral.nochatreports.encryption; import net.minecraft.util.Tuple; import javax.crypto.SecretKey; + +import com.aizistral.nochatreports.encryption.AESECBEncryption; +import com.aizistral.nochatreports.encryption.AESEncryptor; +import com.aizistral.nochatreports.encryption.Encryption; + import java.security.InvalidKeyException; import java.security.spec.AlgorithmParameterSpec; diff --git a/src/main/java/com/aizistral/nochatreports/encryption/AESEncryption.java b/src/main/java/com/aizistral/nochatreports/encryption/AESEncryption.java index f2c4922..84145d2 100644 --- a/src/main/java/com/aizistral/nochatreports/encryption/AESEncryption.java +++ b/src/main/java/com/aizistral/nochatreports/encryption/AESEncryption.java @@ -7,6 +7,9 @@ import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.SecretKeySpec; + +import com.aizistral.nochatreports.encryption.Encryption; + import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; diff --git a/src/main/java/com/aizistral/nochatreports/encryption/AESEncryptor.java b/src/main/java/com/aizistral/nochatreports/encryption/AESEncryptor.java index 2094c5a8..cfde341 100644 --- a/src/main/java/com/aizistral/nochatreports/encryption/AESEncryptor.java +++ b/src/main/java/com/aizistral/nochatreports/encryption/AESEncryptor.java @@ -4,6 +4,10 @@ import net.minecraft.util.Tuple; import javax.crypto.*; import javax.crypto.spec.SecretKeySpec; + +import com.aizistral.nochatreports.encryption.AESEncryption; +import com.aizistral.nochatreports.encryption.Encryptor; + import java.nio.ByteBuffer; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; diff --git a/src/main/java/com/aizistral/nochatreports/encryption/AESGCMEncryption.java b/src/main/java/com/aizistral/nochatreports/encryption/AESGCMEncryption.java index f50ec85..edb5eb4 100644 --- a/src/main/java/com/aizistral/nochatreports/encryption/AESGCMEncryption.java +++ b/src/main/java/com/aizistral/nochatreports/encryption/AESGCMEncryption.java @@ -2,6 +2,9 @@ package com.aizistral.nochatreports.encryption; import java.security.InvalidKeyException; +import com.aizistral.nochatreports.encryption.AESEncryption; +import com.aizistral.nochatreports.encryption.AESGCMEncryptor; + public class AESGCMEncryption extends AESEncryption { protected AESGCMEncryption() { diff --git a/src/main/java/com/aizistral/nochatreports/encryption/AESGCMEncryptor.java b/src/main/java/com/aizistral/nochatreports/encryption/AESGCMEncryptor.java index 9ef7ed7..c2f5450 100644 --- a/src/main/java/com/aizistral/nochatreports/encryption/AESGCMEncryptor.java +++ b/src/main/java/com/aizistral/nochatreports/encryption/AESGCMEncryptor.java @@ -4,6 +4,11 @@ import net.minecraft.util.Tuple; import javax.crypto.SecretKey; import javax.crypto.spec.GCMParameterSpec; + +import com.aizistral.nochatreports.encryption.AESEncryptor; +import com.aizistral.nochatreports.encryption.AESGCMEncryption; +import com.aizistral.nochatreports.encryption.Encryption; + import java.nio.ByteBuffer; import java.security.InvalidKeyException; import java.security.spec.AlgorithmParameterSpec; diff --git a/src/main/java/com/aizistral/nochatreports/encryption/CaesarEncryption.java b/src/main/java/com/aizistral/nochatreports/encryption/CaesarEncryption.java index 16536bc..5ea07d7 100644 --- a/src/main/java/com/aizistral/nochatreports/encryption/CaesarEncryption.java +++ b/src/main/java/com/aizistral/nochatreports/encryption/CaesarEncryption.java @@ -3,6 +3,9 @@ package com.aizistral.nochatreports.encryption; import java.security.InvalidKeyException; import java.security.SecureRandom; +import com.aizistral.nochatreports.encryption.CaesarEncryptor; +import com.aizistral.nochatreports.encryption.Encryption; + public class CaesarEncryption extends Encryption { protected CaesarEncryption() { diff --git a/src/main/java/com/aizistral/nochatreports/encryption/CaesarEncryptor.java b/src/main/java/com/aizistral/nochatreports/encryption/CaesarEncryptor.java index 926c657..ada6a66 100644 --- a/src/main/java/com/aizistral/nochatreports/encryption/CaesarEncryptor.java +++ b/src/main/java/com/aizistral/nochatreports/encryption/CaesarEncryptor.java @@ -2,6 +2,10 @@ package com.aizistral.nochatreports.encryption; import java.security.InvalidKeyException; +import com.aizistral.nochatreports.encryption.CaesarEncryption; +import com.aizistral.nochatreports.encryption.Encryption; +import com.aizistral.nochatreports.encryption.Encryptor; + public class CaesarEncryptor extends Encryptor { private static final char PARAGRAPH = '\u00a7', PARAGRAPH_PLACEHOLDER = '\uffef', DELETE = '\u007f', DELETE_PLACEHOLDER = '\ufff0'; diff --git a/src/main/java/com/aizistral/nochatreports/encryption/Encryption.java b/src/main/java/com/aizistral/nochatreports/encryption/Encryption.java index 0e32da8..e9e2248 100644 --- a/src/main/java/com/aizistral/nochatreports/encryption/Encryption.java +++ b/src/main/java/com/aizistral/nochatreports/encryption/Encryption.java @@ -6,6 +6,13 @@ import java.util.Base64; import java.util.Collections; import java.util.List; +import com.aizistral.nochatreports.encryption.AESCFB8Encryption; +import com.aizistral.nochatreports.encryption.AESECBEncryption; +import com.aizistral.nochatreports.encryption.AESGCMEncryption; +import com.aizistral.nochatreports.encryption.CaesarEncryption; +import com.aizistral.nochatreports.encryption.Encryption; +import com.aizistral.nochatreports.encryption.Encryptor; + public abstract class Encryption { private static final List REGISTERED = new ArrayList<>(); protected static final Base64.Encoder BASE64_ENCODER = Base64.getEncoder(); diff --git a/src/main/java/com/aizistral/nochatreports/encryption/Encryptor.java b/src/main/java/com/aizistral/nochatreports/encryption/Encryptor.java index 0ccd39c..346db89 100644 --- a/src/main/java/com/aizistral/nochatreports/encryption/Encryptor.java +++ b/src/main/java/com/aizistral/nochatreports/encryption/Encryptor.java @@ -9,6 +9,8 @@ import java.security.InvalidKeyException; import java.security.SecureRandom; import java.util.Arrays; +import com.aizistral.nochatreports.encryption.Encryption; + public abstract class Encryptor { protected static final SecureRandom RANDOM = new SecureRandom(); protected static final Char2CharMap BASE64R_SHIFTS = createBase64RShifts(); diff --git a/src/main/java/com/aizistral/nochatreports/gui/AdvancedImageButton.java b/src/main/java/com/aizistral/nochatreports/gui/AdvancedImageButton.java index 0b1f2d8..25f6d54 100644 --- a/src/main/java/com/aizistral/nochatreports/gui/AdvancedImageButton.java +++ b/src/main/java/com/aizistral/nochatreports/gui/AdvancedImageButton.java @@ -1,5 +1,6 @@ package com.aizistral.nochatreports.gui; +import com.aizistral.nochatreports.gui.AdvancedTooltip; import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; diff --git a/src/main/java/com/aizistral/nochatreports/gui/AdvancedTooltip.java b/src/main/java/com/aizistral/nochatreports/gui/AdvancedTooltip.java index 9523845..0dddb9c 100644 --- a/src/main/java/com/aizistral/nochatreports/gui/AdvancedTooltip.java +++ b/src/main/java/com/aizistral/nochatreports/gui/AdvancedTooltip.java @@ -1,5 +1,6 @@ package com.aizistral.nochatreports.gui; +import com.aizistral.nochatreports.gui.AdvancedTooltip; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; import net.fabricmc.api.EnvType; diff --git a/src/main/java/com/aizistral/nochatreports/gui/EncryptionButton.java b/src/main/java/com/aizistral/nochatreports/gui/EncryptionButton.java index 2b0d94a..9303c18 100644 --- a/src/main/java/com/aizistral/nochatreports/gui/EncryptionButton.java +++ b/src/main/java/com/aizistral/nochatreports/gui/EncryptionButton.java @@ -1,6 +1,10 @@ package com.aizistral.nochatreports.gui; import com.aizistral.nochatreports.config.NCRConfig; +import com.aizistral.nochatreports.gui.AdvancedImageButton; +import com.aizistral.nochatreports.gui.EncryptionConfigScreen; +import com.aizistral.nochatreports.gui.EncryptionWarningScreen; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.ImageButton; import net.minecraft.client.gui.screens.Screen; diff --git a/src/main/java/com/aizistral/nochatreports/gui/EncryptionConfigScreen.java b/src/main/java/com/aizistral/nochatreports/gui/EncryptionConfigScreen.java index 1ecbd34..89fa174 100644 --- a/src/main/java/com/aizistral/nochatreports/gui/EncryptionConfigScreen.java +++ b/src/main/java/com/aizistral/nochatreports/gui/EncryptionConfigScreen.java @@ -3,6 +3,8 @@ package com.aizistral.nochatreports.gui; import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.config.NCRConfigEncryption; import com.aizistral.nochatreports.encryption.Encryption; +import com.aizistral.nochatreports.gui.AdvancedImageButton; +import com.aizistral.nochatreports.gui.AdvancedTooltip; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; diff --git a/src/main/java/com/aizistral/nochatreports/gui/EncryptionWarningScreen.java b/src/main/java/com/aizistral/nochatreports/gui/EncryptionWarningScreen.java index 0882a0a..0c1b9f3 100644 --- a/src/main/java/com/aizistral/nochatreports/gui/EncryptionWarningScreen.java +++ b/src/main/java/com/aizistral/nochatreports/gui/EncryptionWarningScreen.java @@ -1,6 +1,9 @@ package com.aizistral.nochatreports.gui; import com.aizistral.nochatreports.config.NCRConfig; +import com.aizistral.nochatreports.gui.EncryptionConfigScreen; +import com.aizistral.nochatreports.gui.TriageWarningScreen; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.ChatFormatting; diff --git a/src/main/java/com/aizistral/nochatreports/gui/RealmsWarningScreen.java b/src/main/java/com/aizistral/nochatreports/gui/RealmsWarningScreen.java index 3fb2b79..86120a4 100644 --- a/src/main/java/com/aizistral/nochatreports/gui/RealmsWarningScreen.java +++ b/src/main/java/com/aizistral/nochatreports/gui/RealmsWarningScreen.java @@ -1,6 +1,8 @@ package com.aizistral.nochatreports.gui; import com.aizistral.nochatreports.config.NCRConfig; +import com.aizistral.nochatreports.gui.TriageWarningScreen; + import net.minecraft.ChatFormatting; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; diff --git a/src/main/java/com/aizistral/nochatreports/gui/TriageWarningScreen.java b/src/main/java/com/aizistral/nochatreports/gui/TriageWarningScreen.java index 56817c6..03e31f9 100644 --- a/src/main/java/com/aizistral/nochatreports/gui/TriageWarningScreen.java +++ b/src/main/java/com/aizistral/nochatreports/gui/TriageWarningScreen.java @@ -1,5 +1,6 @@ package com.aizistral.nochatreports.gui; +import com.aizistral.nochatreports.gui.AdaptiveWarningScreen; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.Util; import net.minecraft.client.Minecraft; diff --git a/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java b/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java index 36820a8..20c5604 100644 --- a/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java +++ b/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java @@ -4,6 +4,7 @@ import com.aizistral.nochatreports.NoChatReports; import com.aizistral.nochatreports.NoChatReportsClient; import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerSafetyState; +import com.aizistral.nochatreports.gui.AdaptiveWarningScreen; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatComponent.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatComponent.java index b023769..0238320 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatComponent.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatComponent.java @@ -3,6 +3,7 @@ package com.aizistral.nochatreports.mixins.client; import com.aizistral.nochatreports.NoChatReports; import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.EncryptionUtil; + import net.minecraft.ChatFormatting; import net.minecraft.client.GuiMessageTag; import net.minecraft.client.gui.components.ChatComponent; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatListener.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatListener.java index 30ac570..675e642 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatListener.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatListener.java @@ -8,6 +8,7 @@ import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.aizistral.nochatreports.core.ServerSafetyState; import com.aizistral.nochatreports.core.SigningMode; import com.aizistral.nochatreports.gui.UnsafeServerScreen; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.ChatScreen; import net.minecraft.client.multiplayer.chat.ChatListener; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinConnectScreen.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinConnectScreen.java index 75e4705..73ec799 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinConnectScreen.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinConnectScreen.java @@ -3,6 +3,7 @@ package com.aizistral.nochatreports.mixins.client; import com.aizistral.nochatreports.NoChatReports; import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerSafetyState; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.ConnectScreen; import net.minecraft.client.gui.screens.Screen; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinGuiMessageTag.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinGuiMessageTag.java index 754db1f..969afd0 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinGuiMessageTag.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinGuiMessageTag.java @@ -1,12 +1,13 @@ package com.aizistral.nochatreports.mixins.client; -import com.aizistral.nochatreports.config.NCRConfig; import net.minecraft.client.GuiMessageTag; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import com.aizistral.nochatreports.config.NCRConfig; + @Mixin(GuiMessageTag.class) public class MixinGuiMessageTag { diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerStatusPinger$1.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerStatusPinger$1.java index 7da207f..fb0d66b 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerStatusPinger$1.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerStatusPinger$1.java @@ -1,5 +1,7 @@ package com.aizistral.nochatreports.mixins.client; +import java.lang.reflect.Field; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -17,8 +19,18 @@ import net.minecraft.network.protocol.status.ServerStatus; @Mixin(targets = "net/minecraft/client/multiplayer/ServerStatusPinger$1") public class MixinServerStatusPinger$1 { - @Shadow @Final - private ServerData val$data; + private static final Field SERVER_DATA_FIELD; + + static { + // We use reflection here because Mixin's AP dies when trying to process @Shadow of this lol + try { + Class pinger = Class.forName("net.minecraft.client.multiplayer.ServerStatusPinger$1"); + SERVER_DATA_FIELD = pinger.getDeclaredField("val$p_105460_"); + SERVER_DATA_FIELD.setAccessible(true); + } catch (Exception ex) { + throw new RuntimeException("Reflection failed in MixinServerStatusPinger$1", ex); + } + } /** * @reason Ensure "preventsChatReports" property is transferred from {@link ServerStatus} to @@ -29,14 +41,17 @@ public class MixinServerStatusPinger$1 { @Inject(method = "handleStatusResponse(Lnet/minecraft/network/protocol/status/ClientboundStatusResponsePacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/protocol/status/ServerStatus;getPlayers()Lnet/minecraft/network/protocol/status/ServerStatus$Players;", ordinal = 0, shift = At.Shift.BEFORE)) private void getNoChatReports(ClientboundStatusResponsePacket packet, CallbackInfo info) { - boolean preventsReports = ((ServerDataExtension) packet.getStatus()).preventsChatReports(); - ((ServerDataExtension) this.val$data).setPreventsChatReports(preventsReports); - - if (NCRConfig.getCommon().enableDebugLog()) { - NoChatReports.LOGGER.info("Received status response packet from server, preventsChatReports: {}", - preventsReports); + try { + boolean preventsReports = ((ServerDataExtension) packet.getStatus()).preventsChatReports(); + ((ServerDataExtension) SERVER_DATA_FIELD.get(this)).setPreventsChatReports(preventsReports); + + if (NCRConfig.getCommon().enableDebugLog()) { + NoChatReports.LOGGER.info("Received status response packet from server, preventsChatReports: {}", + preventsReports); + } + } catch (IllegalArgumentException | IllegalAccessException ex) { + throw new RuntimeException("Failed to get ServerData field via reflection", ex); } - } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json deleted file mode 100644 index e158781..0000000 --- a/src/main/resources/fabric.mod.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "schemaVersion": 1, - "id": "nochatreports", - "version": "${version}", - - "name": "No Chat Reports", - "description": "Strips cryptographic signatures from player messages, making it impossible to track and associate them with your Mojang/Microsoft account, as well as use Player Chat Reporting feature.", - "authors": [ - "Aizistral" - ], - "contributors": [ - "Madis0 (aka robotkoer)" - ], - "contact": { - "homepage": "https://www.curseforge.com/minecraft/mc-mods/no-chat-reports", - "sources": "https://github.com/Aizistral-Studios/No-Chat-Reports", - "issues": "https://github.com/Aizistral-Studios/No-Chat-Reports/issues" - }, - - "license": "WTFPL", - "icon": "NCR_logo.png", - - "environment": "*", - "entrypoints": { - "main": [ - "com.aizistral.nochatreports.NoChatReports" - ], - "client": [ - "com.aizistral.nochatreports.NoChatReportsClient" - ], - "modmenu": [ - "com.aizistral.nochatreports.config.ModMenuIntegration" - ] - }, - "mixins": [ - "nochatreports.mixins.json" - ], - - "depends": { - "fabricloader": ">=0.14.6", - "fabric-networking-api-v1": "*", - "fabric-screen-api-v1": "*", - "fabric-rendering-v1": "*", - "fabric-resource-loader-v0": "*", - "minecraft": [ ">=1.19.3-alpha.22.44.a" ], - "java": ">=17" - }, - "suggests": {}, - "accessWidener" : "nochatreports.accesswidener", - - "custom": { - "modmenu": { - "links": { - "modmenu.modrinth": "https://modrinth.com/mod/no-chat-reports", - "modmenu.curseforge": "https://www.curseforge.com/minecraft/mc-mods/no-chat-reports" - } - } - } -} diff --git a/src/main/resources/nochatreports.accesswidener b/src/main/resources/nochatreports.accesswidener deleted file mode 100644 index ccf4f65..0000000 --- a/src/main/resources/nochatreports.accesswidener +++ /dev/null @@ -1,28 +0,0 @@ -accessWidener v1 named -mutable field net/minecraft/client/multiplayer/ClientPacketListener callbackScreen Lnet/minecraft/client/gui/screens/Screen; -accessible field net/minecraft/client/multiplayer/ClientPacketListener callbackScreen Lnet/minecraft/client/gui/screens/Screen; -accessible field net/minecraft/client/gui/screens/SimpleOptionsSubScreen list Lnet/minecraft/client/gui/components/OptionsList; -accessible field net/minecraft/client/gui/components/ImageButton xTexStart I -accessible field net/minecraft/client/gui/components/ImageButton yTexStart I -mutable field net/minecraft/client/gui/components/ImageButton xTexStart I -mutable field net/minecraft/client/gui/components/ImageButton yTexStart I -accessible field net/minecraft/network/chat/contents/TranslatableContents args [Ljava/lang/Object; -mutable field net/minecraft/network/chat/contents/TranslatableContents args [Ljava/lang/Object; -accessible field net/minecraft/network/chat/MutableComponent contents Lnet/minecraft/network/chat/ComponentContents; -mutable field net/minecraft/network/chat/MutableComponent contents Lnet/minecraft/network/chat/ComponentContents; -accessible field net/minecraft/client/gui/screens/multiplayer/WarningScreen message Lnet/minecraft/client/gui/components/MultiLineLabel; -accessible field net/minecraft/client/multiplayer/ClientPacketListener signedMessageEncoder Lnet/minecraft/network/chat/SignedMessageChain$Encoder; -accessible field net/minecraft/client/multiplayer/ClientPacketListener chatSession Lnet/minecraft/network/chat/LocalChatSession; -accessible method net/minecraft/client/gui/components/Tooltip (Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/Component;)V -accessible field net/minecraft/client/gui/components/Tooltip MAX_WIDTH I -accessible field net/minecraft/client/gui/components/Tooltip message Lnet/minecraft/network/chat/Component; -accessible field net/minecraft/client/gui/components/Tooltip narration Lnet/minecraft/network/chat/Component; -accessible field net/minecraft/client/gui/components/Tooltip cachedTooltip Ljava/util/List; -accessible field net/minecraft/client/gui/screens/Screen minecraft Lnet/minecraft/client/Minecraft; -accessible field net/minecraft/client/gui/screens/Screen itemRenderer Lnet/minecraft/client/renderer/entity/ItemRenderer; -accessible field net/minecraft/client/gui/screens/Screen font Lnet/minecraft/client/gui/Font; -accessible field net/minecraft/client/gui/components/AbstractWidget tooltip Lnet/minecraft/client/gui/components/Tooltip; -accessible field net/minecraft/client/gui/components/AbstractWidget tooltipMsDelay I -accessible method net/minecraft/client/gui/components/AbstractWidget updateTooltip ()V -extendable method net/minecraft/client/gui/components/AbstractWidget updateTooltip ()V -accessible field net/minecraft/client/gui/screens/OptionsScreen TELEMETRY Lnet/minecraft/network/chat/Component; \ No newline at end of file diff --git a/src/main/resources/nochatreports.mixins.json b/src/main/resources/nochatreports.mixins.json index 82bf72c..c7c2bd0 100644 --- a/src/main/resources/nochatreports.mixins.json +++ b/src/main/resources/nochatreports.mixins.json @@ -39,5 +39,6 @@ ], "injectors": { "defaultRequire": 1 - } + }, + "refmap": "nochatreports.refmap.json" } diff --git a/src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java b/src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java deleted file mode 100644 index 3d04e27..0000000 --- a/src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.aizistral.nochatreports.debug; - -import java.util.UUID; - -import com.mojang.authlib.minecraft.BanDetails; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.networking.v1.PacketSender; -import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; -import net.minecraft.network.chat.Component; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerGamePacketListenerImpl; - -public final class NoChatReportsDebug implements ModInitializer { - @Override - public void onInitialize() { - ServerPlayConnectionEvents.JOIN.register(this::onPlayReady); - } - - private void onPlayReady(ServerGamePacketListenerImpl handler, PacketSender sender, MinecraftServer server) { - server.execute(() -> { - UnrealPlayer player = new UnrealPlayer(UUID.fromString("069a79f4-44e9-4726-a5be-fca90e38aaf5"), "Notch"); - //player.join(server, handler); - Component component = Component.Serializer.fromJson("{\"translate\":\"%s\",\"with\":[{\"extra\":[{\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/tell Aizistral \"},\"hoverEvent\":{\"action\":\"show_entity\",\"contents\":{\"id\":\"bfa45411-874a-4ee0-b3bd-00c716059d95\",\"name\":{\"text\":\"Aizistral\"},\"type\":\"minecraft:player\"}},\"insertion\":\"Aizistral\",\"text\":\"Aizistral\"},{\"text\":\"> \"},{\"text\":\"['(9^~©²~.2>5¶(4,+:.9!¿¿\"}],\"text\":\"<\"},{\"text\":\"['(9^~©²~.2>5¶(4,+:.9!¿¿\"}]}"); - //player.sendSystem(server, handler, component); - - //player.sendMessage(server, handler, "This message is so real and legit", null); - - //UnrealPlayer.DEFAULT.join(server, handler); - //UnrealPlayer.DEFAULT.sendMessage(server, handler, "I'm definitely not gay", "§8I§a'§bM §cG§dA§eY"); - //UnrealPlayer.DEFAULT.sendMessage(server, handler, "gOODBYE LOL", null); - //UnrealPlayer.DEFAULT.leave(server, handler); - - //NoChatReports.LOGGER.info("Unreal player deployed"); - }); - } - - public static BanDetails getFakeBan() { - return null; - // return new BanDetails(UUID.fromString(Minecraft.getInstance().getUser().getUuid()), - // null, null, null); - } - -} diff --git a/src/test/java/com/aizistral/nochatreports/debug/ReportWriter.java b/src/test/java/com/aizistral/nochatreports/debug/ReportWriter.java deleted file mode 100644 index 538841b..0000000 --- a/src/test/java/com/aizistral/nochatreports/debug/ReportWriter.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.aizistral.nochatreports.debug; - -import java.io.BufferedWriter; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Date; - -import com.aizistral.nochatreports.debug.mixins.MixinAbuseReportSenderServices; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.ibm.icu.text.SimpleDateFormat; -import com.mojang.authlib.minecraft.client.ObjectMapper; -import com.mojang.authlib.yggdrasil.request.AbuseReportRequest; - -import net.fabricmc.loader.api.FabricLoader; - -/** - * Allows to save chat reports locally. See {@link MixinAbuseReportSenderServices} for details. - * - * @author Aizistral - */ - -public final class ReportWriter { - private static final ObjectMapper MAPPER = ObjectMapper.create(); - private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); - - public static void saveReport(AbuseReportRequest report) { - String string = MAPPER.writeValueAsString(report); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_hh.mm.ss"); - Path path = FabricLoader.getInstance().getGameDir().resolve("intercepted-reports/report-" - + format.format(Date.from(report.report.createdTime)) + ".json"); - path.getParent().toFile().mkdirs(); - - try (BufferedWriter writer = Files.newBufferedWriter(path)) { - GSON.toJson(GSON.fromJson(string, Object.class), writer); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - -} diff --git a/src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java b/src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java deleted file mode 100644 index 8681ae5..0000000 --- a/src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.aizistral.nochatreports.debug; - -import java.util.UUID; - -/** - * Exists solely to help with testing some of the features of the mod. - * You can use this to trick client into thinking there is another player - * on server, and send chat messages as if they are from that player. - *

- * DON'T FORGET TO TURN "convertToGameMessage" OFF! - * - * @author Aizistral - */ - -public class UnrealPlayer { - public static final UnrealPlayer DEFAULT = new UnrealPlayer(UUID.fromString("bfa45411-874a-4ee0-b3bd-00c716059d95"), "Aizistral"); - private final UUID id; - private final String name; - - public UnrealPlayer(UUID id, String name) { - this.id = id; - this.name = name; - } - - // public void join(MinecraftServer server, ServerGamePacketListenerImpl connection) { - // ClientboundPlayerInfoPacket packet = new ClientboundPlayerInfoPacket(Action.ADD_PLAYER, - // this.getPlayer(server)); - // connection.send(packet); - // } - // - // public void leave(MinecraftServer server, ServerGamePacketListenerImpl connection) { - // ClientboundPlayerInfoPacket packet = new ClientboundPlayerInfoPacket(Action.REMOVE_PLAYER, - // this.getPlayer(server)); - // connection.send(packet); - // } - // - // public ServerPlayer getPlayer(MinecraftServer server) { - // return new ServerPlayer(server, server.overworld(), new GameProfile(this.id, this.name), null); - // } - // - // public void sendSystem(MinecraftServer server, ServerGamePacketListenerImpl connection, Component message) { - // ServerPlayer player = this.getPlayer(server); - // ClientboundSystemChatPacket packet = new ClientboundSystemChatPacket(message, false); - // connection.send(packet); - // } - // - // public void sendMessage(MinecraftServer server, ServerGamePacketListenerImpl connection, String message, @Nullable String unsigned) { - // ServerPlayer player = this.getPlayer(server); - // ClientboundPlayerChatPacket packet = new ClientboundPlayerChatPacket(new PlayerChatMessage( - // new SignedMessageHeader(MessageSignature.EMPTY, this.id), MessageSignature.EMPTY, - // new SignedMessageBody(new ChatMessageContent(message, Component.literal(message)), Instant.now(), 0, - // LastSeenMessages.EMPTY), unsigned != null ? Optional.of(Component.literal(unsigned)) - // : Optional.empty(), FilterMask.PASS_THROUGH), - // ChatType.bind(ChatType.CHAT, player).toNetwork(server.registryAccess())); - // - // - // // new ClientboundPlayerChatPacket(Component.literal(message), - // // unsigned != null ? Optional.of(Component.literal(unsigned)) : Optional.empty(), 0, - // // new ChatSender(this.id, Component.literal(this.name)), Instant.now(), - // // Crypt.SaltSignaturePair.EMPTY); - // connection.send(packet); - // } - -} diff --git a/src/test/java/com/aizistral/nochatreports/debug/mixins/MixinAbuseReportSenderServices.java b/src/test/java/com/aizistral/nochatreports/debug/mixins/MixinAbuseReportSenderServices.java deleted file mode 100644 index a3e7339..0000000 --- a/src/test/java/com/aizistral/nochatreports/debug/mixins/MixinAbuseReportSenderServices.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.aizistral.nochatreports.debug.mixins; - -import java.util.UUID; -import java.util.concurrent.CompletableFuture; - -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; - -import com.aizistral.nochatreports.debug.ReportWriter; -import com.mojang.authlib.minecraft.report.AbuseReport; -import com.mojang.authlib.yggdrasil.request.AbuseReportRequest; -import com.mojang.datafixers.util.Unit; - -import net.minecraft.client.multiplayer.chat.report.AbuseReportSender; -import net.minecraft.client.multiplayer.chat.report.ReportEnvironment; - -@Mixin(AbuseReportSender.Services.class) -public class MixinAbuseReportSenderServices { - @Shadow @Final - private ReportEnvironment environment; - - /** - * @reason Write report locally instead of trying to send it to Mojang. - * Allows to intercept and examine contents of the report. - * @author Aizistral - */ - - @Overwrite - public CompletableFuture send(UUID uuid, AbuseReport abuseReport) { - AbuseReportRequest abuseReportRequest = new AbuseReportRequest(1, uuid, - abuseReport, this.environment.clientInfo(), this.environment.thirdPartyServerInfo(), - this.environment.realmInfo()); - ReportWriter.saveReport(abuseReportRequest); - return CompletableFuture.supplyAsync(() -> Unit.INSTANCE); - } - -} diff --git a/src/test/java/com/aizistral/nochatreports/debug/mixins/MixinMinecraft.java b/src/test/java/com/aizistral/nochatreports/debug/mixins/MixinMinecraft.java deleted file mode 100644 index 34fcf9f..0000000 --- a/src/test/java/com/aizistral/nochatreports/debug/mixins/MixinMinecraft.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.aizistral.nochatreports.debug.mixins; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; - -import com.aizistral.nochatreports.debug.NoChatReportsDebug; -import com.mojang.authlib.minecraft.BanDetails; - -import net.minecraft.client.Minecraft; - -@Mixin(Minecraft.class) -public class MixinMinecraft { - /** - * Replaces real ban screen with a fake one for testing. - * @return Fake ban screen - * @reason Testing - * @author Aizistral - */ - @Overwrite - public BanDetails multiplayerBan() { - return NoChatReportsDebug.getFakeBan(); - } - -} diff --git a/src/test/java/com/aizistral/nochatreports/debug/mixins/MixinPlayerEntry.java b/src/test/java/com/aizistral/nochatreports/debug/mixins/MixinPlayerEntry.java deleted file mode 100644 index e7e4cfc..0000000 --- a/src/test/java/com/aizistral/nochatreports/debug/mixins/MixinPlayerEntry.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.aizistral.nochatreports.debug.mixins; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -import net.minecraft.client.gui.screens.social.PlayerEntry; -import net.minecraft.client.multiplayer.chat.report.AbuseReportSender; - -@Mixin(PlayerEntry.class) -public class MixinPlayerEntry { - - /** - * @reason Always allow to report players on server, even if services are - * unreachable (which they are in IDE). Useful when used along with - * {@link MixinAbuseReportSenderServices}. - * @author Aizistral - */ - - @Redirect(method = "", at = @At(value = "INVOKE", target = - "Lnet/minecraft/client/multiplayer/chat/report/AbuseReportSender;isEnabled()Z")) - private boolean forceEnableReporting(AbuseReportSender sender) { - return true; - } - -} diff --git a/src/test/resources/NCR_logo.png b/src/test/resources/NCR_logo.png deleted file mode 100644 index 9427c0b..0000000 Binary files a/src/test/resources/NCR_logo.png and /dev/null differ diff --git a/src/test/resources/assets/minecraft/textures/gui/title/edition.png b/src/test/resources/assets/minecraft/textures/gui/title/edition.png deleted file mode 100644 index 09004f4..0000000 Binary files a/src/test/resources/assets/minecraft/textures/gui/title/edition.png and /dev/null differ diff --git a/src/test/resources/fabric.mod.json b/src/test/resources/fabric.mod.json deleted file mode 100644 index d364a5f..0000000 --- a/src/test/resources/fabric.mod.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "schemaVersion": 1, - "id": "nochatreportstest", - "version": "${version}", - - "name": "No Chat Reports Test", - "description": "Testmod", - "authors": [ - "Aizistral" - ], - "contact": { - "homepage": "https://www.curseforge.com/minecraft/mc-mods/no-chat-reports", - "sources": "https://github.com/Aizistral-Studios/No-Chat-Reports" - }, - - "license": "WTFPL", - "icon": "NCR_logo.png", - - "environment": "*", - "entrypoints": { - "main": [ - "com.aizistral.nochatreports.debug.NoChatReportsDebug" - ] - }, - "mixins": [ - "nochatreportstest.mixins.json" - ], - - "depends": { - "fabricloader": ">=0.14.6", - "fabric": "*", - "minecraft": "~1.19", - "java": ">=17" - }, - "suggests": {} -} diff --git a/src/test/resources/nochatreportstest.mixins.json b/src/test/resources/nochatreportstest.mixins.json deleted file mode 100644 index 94fec99..0000000 --- a/src/test/resources/nochatreportstest.mixins.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "com.aizistral.nochatreports.debug.mixins", - "compatibilityLevel": "JAVA_17", - "verbose": true, - "mixins": [ - ], - "client": [ - "MixinPlayerEntry", - "MixinAbuseReportSenderServices", - "MixinMinecraft" - ], - "server": [ - ], - "injectors": { - "defaultRequire": 1 - } -} -- cgit v1.2.3