From 7591e3537f089b8f22389bb7d83756e2868fb225 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 15 Jun 2019 13:07:29 +1200 Subject: [PATCH] #361 --- .../utilities/packets/PacketsManager.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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 d55a723e..644030c8 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,9 @@ public class PacketsManager { clientInteractEntityListener = new PacketListenerClientInteract(libsDisguises); PacketListener tabListListener = new PacketListenerTabList(libsDisguises); - ProtocolLibrary.getProtocolManager().addPacketListener(clientInteractEntityListener); - ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(tabListListener).syncStart(); + ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(clientInteractEntityListener) + .syncStart(); + ProtocolLibrary.getProtocolManager().addPacketListener(tabListListener); // Now I call this and the main listener is registered! setupMainPacketsListener(); @@ -111,7 +112,7 @@ public class PacketsManager { public static void setupMainPacketsListener() { if (clientInteractEntityListener != null) { if (mainListener != null) { - ProtocolLibrary.getProtocolManager().getAsynchronousManager().unregisterAsyncHandler(mainListener); + ProtocolLibrary.getProtocolManager().removePacketListener(mainListener); } ArrayList packetsToListen = new ArrayList<>(); @@ -164,8 +165,7 @@ public class PacketsManager { mainListener = new PacketListenerMain(libsDisguises, packetsToListen); - ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(mainListener) - .syncStart(); + ProtocolLibrary.getProtocolManager().addPacketListener(mainListener); } } @@ -174,10 +174,9 @@ public class PacketsManager { viewDisguisesListenerEnabled = enabled; if (viewDisguisesListenerEnabled) { - ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(viewDisguisesListener) - .syncStart(); + ProtocolLibrary.getProtocolManager().addPacketListener(viewDisguisesListener); } else { - ProtocolLibrary.getProtocolManager().getAsynchronousManager().unregisterAsyncHandler(viewDisguisesListener); + ProtocolLibrary.getProtocolManager().removePacketListener(viewDisguisesListener); } for (Player player : Bukkit.getOnlinePlayers()) {