diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/PacketsManager.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/PacketsManager.java index 644030c8..4b5bb7a4 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/PacketsManager.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/PacketsManager.java @@ -35,8 +35,7 @@ public class PacketsManager { clientInteractEntityListener = new PacketListenerClientInteract(libsDisguises); PacketListener tabListListener = new PacketListenerTabList(libsDisguises); - ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(clientInteractEntityListener) - .syncStart(); + ProtocolLibrary.getProtocolManager().addPacketListener(clientInteractEntityListener); ProtocolLibrary.getProtocolManager().addPacketListener(tabListListener); // Now I call this and the main listener is registered! diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerMain.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerMain.java index 4f3d2be3..13f9360f 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerMain.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/packetlisteners/PacketListenerMain.java @@ -40,23 +40,20 @@ public class PacketListenerMain extends PacketAdapter { int entityId = event.getPacket().getIntegers().read(Server.COLLECT == event.getPacketType() ? 1 : 0); - Entity entity = DisguiseUtilities.getEntity(observer.getWorld(), entityId); + final Disguise disguise = DisguiseUtilities.getDisguise(observer, entityId); // If the entity is the same as the sender. Don't disguise! // Prevents problems and there is no advantage to be gained. // Or if they are null and there's no disguise - if (entity == observer || entity == null) - return; - - final Disguise disguise = DisguiseAPI.getDisguise(observer, entity); - - if (disguise == null) + if (disguise == null || disguise.getEntity() == observer) { return; + } LibsPackets packets; try { - packets = PacketsManager.getPacketsHandler().transformPacket(event.getPacket(), disguise, observer, entity); + packets = PacketsManager.getPacketsHandler() + .transformPacket(event.getPacket(), disguise, observer, disguise.getEntity()); } catch (Exception ex) { ex.printStackTrace();