From 08bee8afd83a77d160020bd0e0f0d4e1f1059512 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 23 May 2020 18:43:51 +1200 Subject: [PATCH] Better channel register packet --- .../PacketListenerChannelRegister.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerChannelRegister.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerChannelRegister.java index 8bc06a76..1bdb5ac7 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerChannelRegister.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerChannelRegister.java @@ -24,6 +24,10 @@ public class PacketListenerChannelRegister extends PacketAdapter { @Override public void onPacketReceiving(PacketEvent event) { + if (event.isPlayerTemporary()) { + return; + } + if (NmsVersion.v1_13.isSupported()) { if (!event.getPacket().getMinecraftKeys().read(0).getFullKey().equals("minecraft:brand")) { return; @@ -34,12 +38,16 @@ public class PacketListenerChannelRegister extends PacketAdapter { } } + Player player = event.getPlayer(); + + if (player == null) { + return; + } + new BukkitRunnable() { @Override public void run() { - Player player = event.getPlayer(); - - if (player == null || player.hasMetadata("ld_loggedin")) { + if (!player.isOnline() || player.hasMetadata("ld_loggedin")) { return; }