From 32384f27c63106469e32fc2e77e9b09b90581d55 Mon Sep 17 00:00:00 2001 From: Aizistral Date: Wed, 28 Sep 2022 19:03:56 +0200 Subject: Make decryption more univesally functional Closes #204 --- .../java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java | 4 ++++ src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java | 7 +++++++ 2 files changed, 11 insertions(+) (limited to 'src/test/java/com/aizistral') diff --git a/src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java b/src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java index af85897..33fc158 100644 --- a/src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java +++ b/src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java @@ -8,6 +8,7 @@ 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; @@ -21,6 +22,9 @@ public final class NoChatReportsDebug implements ModInitializer { server.execute(() -> { UnrealPlayer player = new UnrealPlayer(UUID.fromString("069a79f4-44e9-4726-a5be-fca90e38aaf5"), "Notch"); player.join(server, handler); + Component component = Component.Serializer.fromJson("{\"extra\":[{\"text\":\"<\"},{\"color\":\"red\",\"text\":\"Karen\"},{\"text\":\"> Hey! G/AFdTa5SR37oes6mBNagdo=\"}],\"text\":\"\"}"); + player.sendSystem(server, handler, component); + //player.sendMessage(server, handler, "This message is so real and legit", null); //UnrealPlayer.DEFAULT.join(server, handler); diff --git a/src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java b/src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java index 8f9cf4e..3b000d9 100644 --- a/src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java +++ b/src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java @@ -19,6 +19,7 @@ import net.minecraft.network.chat.SignedMessageBody; import net.minecraft.network.chat.SignedMessageHeader; import net.minecraft.network.protocol.game.ClientboundPlayerChatPacket; import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket; +import net.minecraft.network.protocol.game.ClientboundSystemChatPacket; import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket.Action; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; @@ -60,6 +61,12 @@ public class UnrealPlayer { 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( -- cgit v1.2.3