fix player messages
This commit is contained in:
parent
cee88ffa3d
commit
f5db2e02a3
1 changed files with 12 additions and 1 deletions
|
@ -86,7 +86,18 @@ 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, packet.getUnsignedContent(), "minecraft:chat", packet.getName()); // TODO: Fix chatType
|
||||
|
||||
PlayerMessage parsedFromMessage = null;
|
||||
final Component component = packet.getUnsignedContent();
|
||||
|
||||
for (SystemChatParser parser : systemChatParsers) {
|
||||
parsedFromMessage = parser.parse(component);
|
||||
if (parsedFromMessage != null) break;
|
||||
}
|
||||
|
||||
if (parsedFromMessage == null) return;
|
||||
|
||||
final PlayerMessage playerMessage = new PlayerMessage(sender, parsedFromMessage.contents(), "minecraft:chat", packet.getName()); // TODO: Fix chatType
|
||||
|
||||
for (Listener listener : this.listeners) {
|
||||
listener.playerMessageReceived(playerMessage);
|
||||
|
|
Loading…
Reference in a new issue