From 3bccd1edae8934f25f9e9a3a3bfcbd5fbe82cff6 Mon Sep 17 00:00:00 2001 From: Chipmunk <65827213+ChipmunkMC@users.noreply.github.com> Date: Wed, 12 Apr 2023 13:04:38 -0400 Subject: [PATCH] chat improvements --- src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java | 2 +- .../land/chipmunk/chipmunkbot/systemChat/KaboomChatParser.java | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java b/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java index abe943c..2595fc2 100644 --- a/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java +++ b/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java @@ -79,7 +79,7 @@ public class ChatPlugin extends SessionAdapter { public void packetReceived (Session session, ClientboundPlayerChatPacket packet) { final MutablePlayerListEntry sender = client.playerList().getEntry(packet.getSender()); if (sender == null) return; - final PlayerMessage playerMessage = new PlayerMessage(sender, Component.text(packet.getContent()), "minecraft:chat", packet.getName()); // TODO: Fix chatType + final PlayerMessage playerMessage = new PlayerMessage(sender, packet.getUnsignedContent(), "minecraft:chat", packet.getName()); // TODO: Fix chatType for (Listener listener : this.listeners) { listener.playerMessageReceived(playerMessage); diff --git a/src/main/java/land/chipmunk/chipmunkbot/systemChat/KaboomChatParser.java b/src/main/java/land/chipmunk/chipmunkbot/systemChat/KaboomChatParser.java index 85abf9e..bb64ef9 100644 --- a/src/main/java/land/chipmunk/chipmunkbot/systemChat/KaboomChatParser.java +++ b/src/main/java/land/chipmunk/chipmunkbot/systemChat/KaboomChatParser.java @@ -56,8 +56,6 @@ public class KaboomChatParser implements SystemChatParser { } MutablePlayerListEntry sender = client.playerList().getEntry(Component.empty().append(prefix).append(displayName)); - if (sender == null) sender = client.playerList().getEntry(prefix.append(displayName)); // deprecated - if (sender == null) sender = new MutablePlayerListEntry(new GameProfile(new UUID(0l, 0l), null), GameMode.SURVIVAL, false, 0, displayName, 0L, null, new byte[0]); return new PlayerMessage(sender, contents, "minecraft:chat", displayName); }