summaryrefslogtreecommitdiffstats
path: root/src/test/java/com
diff options
context:
space:
mode:
authorAizistral2022-09-28 19:03:56 +0200
committerAizistral2022-09-28 19:03:56 +0200
commit32384f27c63106469e32fc2e77e9b09b90581d55 (patch)
tree82ff6119f2bbf4b86de247389fa2173eba22ebd2 /src/test/java/com
parent41c2215468090ac1817f1430f287671173a1633f (diff)
Make decryption more univesally functional
Closes #204
Diffstat (limited to 'src/test/java/com')
-rw-r--r--src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java4
-rw-r--r--src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java7
2 files changed, 11 insertions, 0 deletions
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(