From fcec8e41a2f25d50987065d7914b2ebb229a5f50 Mon Sep 17 00:00:00 2001 From: HaHaWTH Date: Sun, 19 Nov 2023 11:36:42 +0800 Subject: [PATCH] Patch --- src/main/java/fr/xephi/authme/listener/GuiCaptchaHandler.java | 4 +++- .../fr/xephi/authme/settings/properties/SecuritySettings.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/GuiCaptchaHandler.java b/src/main/java/fr/xephi/authme/listener/GuiCaptchaHandler.java index 8aa6e73c..6fbfddf8 100644 --- a/src/main/java/fr/xephi/authme/listener/GuiCaptchaHandler.java +++ b/src/main/java/fr/xephi/authme/listener/GuiCaptchaHandler.java @@ -59,6 +59,7 @@ public class GuiCaptchaHandler implements Listener { private PacketAdapter chatPacketListener; private PacketAdapter windowPacketListener; + //define timesLeft private int timesLeft = 3; //Use ConcurrentHashMap to store player and their close reason @@ -76,10 +77,12 @@ public class GuiCaptchaHandler implements Listener { public GuiCaptchaHandler() { } + protected List whiteList = AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_COUNTRY_WHITELIST); private boolean isBedrockPlayer(UUID uuid) { return settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && settings.getProperty(SecuritySettings.GUI_CAPTCHA_BE_COMPATIBILITY) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(uuid) && getServer().getPluginManager().getPlugin("floodgate") != null; } + private void removePacketListeners() { ProtocolLibrary.getProtocolManager().removePacketListener(windowPacketListener); ProtocolLibrary.getProtocolManager().removePacketListener(chatPacketListener); @@ -111,7 +114,6 @@ public class GuiCaptchaHandler implements Listener { String name = playerunreg.getName(); if (!authmeApi.isRegistered(name) && !isNpc(playerunreg)) { String ip = getPlayerIp(playerunreg); - List whiteList = settings.getProperty(SecuritySettings.GUI_CAPTCHA_COUNTRY_WHITELIST); if (whiteList.isEmpty() || !whiteList.contains(authmeApi.getCountryCode(ip))) { if (isBedrockPlayer(playerunreg.getUniqueId())) { closeReasonMap.put(playerunreg, "verified"); diff --git a/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java b/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java index 6490079b..92eed4b4 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java @@ -24,7 +24,7 @@ public final class SecuritySettings implements SettingsHolder { @Comment({"Should send GUI captcha by country code whitelist?", "If the country of the player is in this list, the captcha won't be sent."}) public static final Property> GUI_CAPTCHA_COUNTRY_WHITELIST = - newListProperty("3rdPartyFeature.captcha.whitelist"); + newListProperty("3rdPartyFeature.captcha.whiteList"); @Comment({"Should we let Bedrock players login automatically?", "(Requires hookFloodgate to be true & floodgate loaded)"})