This commit is contained in:
HaHaWTH 2023-11-19 11:36:42 +08:00
parent ee24cabbed
commit fcec8e41a2
2 changed files with 4 additions and 2 deletions

View File

@ -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<String> 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<String> whiteList = settings.getProperty(SecuritySettings.GUI_CAPTCHA_COUNTRY_WHITELIST);
if (whiteList.isEmpty() || !whiteList.contains(authmeApi.getCountryCode(ip))) {
if (isBedrockPlayer(playerunreg.getUniqueId())) {
closeReasonMap.put(playerunreg, "verified");

View File

@ -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<List<String>> 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)"})