chat improvements

This commit is contained in:
Chipmunk 2023-04-12 13:04:38 -04:00
parent e7cb46c07c
commit 3bccd1edae
2 changed files with 1 additions and 3 deletions

View file

@ -79,7 +79,7 @@ public class ChatPlugin extends SessionAdapter {
public void packetReceived (Session session, ClientboundPlayerChatPacket packet) { public void packetReceived (Session session, ClientboundPlayerChatPacket packet) {
final MutablePlayerListEntry sender = client.playerList().getEntry(packet.getSender()); final MutablePlayerListEntry sender = client.playerList().getEntry(packet.getSender());
if (sender == null) return; 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) { for (Listener listener : this.listeners) {
listener.playerMessageReceived(playerMessage); listener.playerMessageReceived(playerMessage);

View file

@ -56,8 +56,6 @@ public class KaboomChatParser implements SystemChatParser {
} }
MutablePlayerListEntry sender = client.playerList().getEntry(Component.empty().append(prefix).append(displayName)); 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); return new PlayerMessage(sender, contents, "minecraft:chat", displayName);
} }