mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-06 09:19:35 +01:00
This commit is contained in:
parent
823bf4f7c8
commit
de9088dee8
@ -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().addPacketListener(tabListListener);
|
.syncStart();
|
||||||
|
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(tabListListener).syncStart();
|
||||||
|
|
||||||
// Now I call this and the main listener is registered!
|
// Now I call this and the main listener is registered!
|
||||||
setupMainPacketsListener();
|
setupMainPacketsListener();
|
||||||
@ -90,9 +91,10 @@ public class PacketsManager {
|
|||||||
inventoryModifierEnabled = enabled;
|
inventoryModifierEnabled = enabled;
|
||||||
|
|
||||||
if (inventoryModifierEnabled) {
|
if (inventoryModifierEnabled) {
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(inventoryListener);
|
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(inventoryListener)
|
||||||
|
.syncStart();
|
||||||
} else {
|
} else {
|
||||||
ProtocolLibrary.getProtocolManager().removePacketListener(inventoryListener);
|
ProtocolLibrary.getProtocolManager().getAsynchronousManager().unregisterAsyncHandler(inventoryListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
@ -111,7 +113,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().removePacketListener(mainListener);
|
ProtocolLibrary.getProtocolManager().getAsynchronousManager().unregisterAsyncHandler(mainListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<PacketType> packetsToListen = new ArrayList<>();
|
ArrayList<PacketType> packetsToListen = new ArrayList<>();
|
||||||
@ -164,7 +166,8 @@ public class PacketsManager {
|
|||||||
|
|
||||||
mainListener = new PacketListenerMain(libsDisguises, packetsToListen);
|
mainListener = new PacketListenerMain(libsDisguises, packetsToListen);
|
||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(mainListener);
|
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(mainListener)
|
||||||
|
.syncStart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,9 +176,10 @@ public class PacketsManager {
|
|||||||
viewDisguisesListenerEnabled = enabled;
|
viewDisguisesListenerEnabled = enabled;
|
||||||
|
|
||||||
if (viewDisguisesListenerEnabled) {
|
if (viewDisguisesListenerEnabled) {
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(viewDisguisesListener);
|
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(mainListener)
|
||||||
|
.syncStart();
|
||||||
} else {
|
} else {
|
||||||
ProtocolLibrary.getProtocolManager().removePacketListener(viewDisguisesListener);
|
ProtocolLibrary.getProtocolManager().getAsynchronousManager().unregisterAsyncHandler(mainListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user