Skip to content

Commit

Permalink
ProtocolPacketListener update
Browse files Browse the repository at this point in the history
  • Loading branch information
HaHaWTH committed Oct 21, 2023
1 parent 1ef7ed4 commit 3cc8128
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/fr/xephi/authme/listener/GuiCaptchaHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class GuiCaptchaHandler implements Listener{

private PacketAdapter windowPacketListener;
//define timesLeft
public int timesLeft = 3;
private int timesLeft = 3;
//Use ConcurrentHashMap to store player and their close reason
/* We used many async tasks so there is concurrent**/
public static ConcurrentHashMap<Player, String> closeReasonMap = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -93,6 +93,8 @@ public void onPlayerJoin(PlayerJoinEvent event) {
playerunreg.sendMessage("§a基岩版自动验证完成");
return;
}
ProtocolLibrary.getProtocolManager().addPacketListener(windowPacketListener);
ProtocolLibrary.getProtocolManager().addPacketListener(chatPacketListener);
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
StringBuilder sb = new StringBuilder();
howLongIsRandomString = (howManyRandom.nextInt(3) + 1);
Expand Down Expand Up @@ -180,7 +182,6 @@ public void onPacketReceiving(PacketEvent event) {
}
}
};
ProtocolLibrary.getProtocolManager().addPacketListener(windowPacketListener);
});
Bukkit.getScheduler().runTask(this.plugin, () -> {
chatPacketListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) {
Expand All @@ -192,7 +193,6 @@ public void onPacketReceiving(PacketEvent event) {
}
}
};
ProtocolLibrary.getProtocolManager().addPacketListener(chatPacketListener);
});
});
});
Expand Down

0 comments on commit 3cc8128

Please sign in to comment.