Fix NPE when using broadcast as players are joining

This commit is contained in:
Shane Freeder 2021-06-29 22:21:42 +01:00
parent 0e2c1c7288
commit 5a5d27f6a1

View file

@ -2241,6 +2241,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) {
+ if (getHandle().connection == null) return;
+ final ClientboundChatPacket packet = new ClientboundChatPacket(null, type == net.kyori.adventure.audience.MessageType.CHAT ? net.minecraft.network.chat.ChatType.CHAT : net.minecraft.network.chat.ChatType.SYSTEM, identity.uuid());
+ packet.adventure$message = message;
+ this.getHandle().connection.send(packet);