mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-05 09:09:40 +01:00
This commit is contained in:
parent
e338a44ed5
commit
7591e3537f
@ -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<PacketType> 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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user