From 8e9f13befbbb50f8db7d1c4bdcb5f2e50e365f7d Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Fri, 29 Jul 2022 16:04:07 +1000 Subject: [PATCH] SPIGOT-7123: NullPointerException thrown by Player#chat method By: md_5 --- .../main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 8b1f5e06d1..a7cda388de 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -30,8 +30,7 @@ import net.minecraft.advancements.AdvancementProgress; import net.minecraft.core.BlockPosition; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketDataSerializer; -import net.minecraft.network.chat.ChatMessageType; -import net.minecraft.network.chat.ChatSender; +import net.minecraft.network.chat.ChatMessageContent; import net.minecraft.network.chat.IChatBaseComponent; import net.minecraft.network.chat.PlayerChatMessage; import net.minecraft.network.protocol.game.ClientboundClearTitlesPacket; @@ -381,7 +380,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void chat(String msg) { if (getHandle().connection == null) return; - getHandle().connection.chat(msg, null, false); + getHandle().connection.chat(msg, PlayerChatMessage.system(new ChatMessageContent(msg)), false); } @Override