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);
|
clientInteractEntityListener = new PacketListenerClientInteract(libsDisguises);
|
||||||
PacketListener tabListListener = new PacketListenerTabList(libsDisguises);
|
PacketListener tabListListener = new PacketListenerTabList(libsDisguises);
|
||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(clientInteractEntityListener);
|
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(clientInteractEntityListener)
|
||||||
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(tabListListener).syncStart();
|
.syncStart();
|
||||||
|
ProtocolLibrary.getProtocolManager().addPacketListener(tabListListener);
|
||||||
|
|
||||||
// Now I call this and the main listener is registered!
|
// Now I call this and the main listener is registered!
|
||||||
setupMainPacketsListener();
|
setupMainPacketsListener();
|
||||||
@ -111,7 +112,7 @@ public class PacketsManager {
|
|||||||
public static void setupMainPacketsListener() {
|
public static void setupMainPacketsListener() {
|
||||||
if (clientInteractEntityListener != null) {
|
if (clientInteractEntityListener != null) {
|
||||||
if (mainListener != null) {
|
if (mainListener != null) {
|
||||||
ProtocolLibrary.getProtocolManager().getAsynchronousManager().unregisterAsyncHandler(mainListener);
|
ProtocolLibrary.getProtocolManager().removePacketListener(mainListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<PacketType> packetsToListen = new ArrayList<>();
|
ArrayList<PacketType> packetsToListen = new ArrayList<>();
|
||||||
@ -164,8 +165,7 @@ public class PacketsManager {
|
|||||||
|
|
||||||
mainListener = new PacketListenerMain(libsDisguises, packetsToListen);
|
mainListener = new PacketListenerMain(libsDisguises, packetsToListen);
|
||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(mainListener)
|
ProtocolLibrary.getProtocolManager().addPacketListener(mainListener);
|
||||||
.syncStart();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,10 +174,9 @@ public class PacketsManager {
|
|||||||
viewDisguisesListenerEnabled = enabled;
|
viewDisguisesListenerEnabled = enabled;
|
||||||
|
|
||||||
if (viewDisguisesListenerEnabled) {
|
if (viewDisguisesListenerEnabled) {
|
||||||
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(viewDisguisesListener)
|
ProtocolLibrary.getProtocolManager().addPacketListener(viewDisguisesListener);
|
||||||
.syncStart();
|
|
||||||
} else {
|
} else {
|
||||||
ProtocolLibrary.getProtocolManager().getAsynchronousManager().unregisterAsyncHandler(viewDisguisesListener);
|
ProtocolLibrary.getProtocolManager().removePacketListener(viewDisguisesListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user