Rollback the packetlistener changes, its broke. I hate paper.

This commit is contained in:
libraryaddict 2020-03-25 23:08:03 +13:00
parent 356519be19
commit 912ca85aff
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
3 changed files with 6 additions and 15 deletions

View File

@ -109,8 +109,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().removePacketListener(mainListener);
ProtocolLibrary.getProtocolManager().getAsynchronousManager().unregisterAsyncHandler(mainListener);
} }
ArrayList<PacketType> packetsToListen = new ArrayList<>(); ArrayList<PacketType> packetsToListen = new ArrayList<>();
@ -163,9 +162,7 @@ public class PacketsManager {
mainListener = new PacketListenerMain(LibsDisguises.getInstance(), packetsToListen); mainListener = new PacketListenerMain(LibsDisguises.getInstance(), packetsToListen);
// ProtocolLibrary.getProtocolManager().addPacketListener(mainListener); ProtocolLibrary.getProtocolManager().addPacketListener(mainListener);
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(mainListener)
.syncStart(10, TimeUnit.SECONDS);
} }
} }
@ -174,13 +171,9 @@ public class PacketsManager {
viewDisguisesListenerEnabled = enabled; viewDisguisesListenerEnabled = enabled;
if (viewDisguisesListenerEnabled) { if (viewDisguisesListenerEnabled) {
//ProtocolLibrary.getProtocolManager().addPacketListener(viewDisguisesListener); ProtocolLibrary.getProtocolManager().addPacketListener(viewDisguisesListener);
ProtocolLibrary.getProtocolManager().getAsynchronousManager()
.registerAsyncHandler(viewDisguisesListener).syncStart(10, TimeUnit.SECONDS);
} else { } else {
ProtocolLibrary.getProtocolManager().getAsynchronousManager() ProtocolLibrary.getProtocolManager().removePacketListener(viewDisguisesListener);
.unregisterAsyncHandler(viewDisguisesListener);
// ProtocolLibrary.getProtocolManager().removePacketListener(viewDisguisesListener);
} }
for (Player player : Bukkit.getOnlinePlayers()) { for (Player player : Bukkit.getOnlinePlayers()) {

View File

@ -29,8 +29,7 @@ public class PacketListenerMain extends PacketAdapter {
final Player observer = event.getPlayer(); final Player observer = event.getPlayer();
if (observer == null || observer.getName() == null || if (observer.getName().contains("UNKNOWN[")) // If the player is temporary
observer.getName().contains("UNKNOWN[")) // If the player is temporary
return; return;
// First get the entity, the one sending this packet // First get the entity, the one sending this packet

View File

@ -40,8 +40,7 @@ public class PacketListenerViewSelfDisguise extends PacketAdapter {
try { try {
final Player observer = event.getPlayer(); final Player observer = event.getPlayer();
if (observer == null || observer.getName() == null || if (observer.getName().contains("UNKNOWN[")) {// If the player is temporary
observer.getName().contains("UNKNOWN[")) {// If the player is temporary
return; return;
} }