From bc43afe3d04201b97d97deb6db10cb64eba1fa40 Mon Sep 17 00:00:00 2001 From: Sattera Date: Tue, 4 Apr 2023 09:08:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9=20floodgate=20?= =?UTF-8?q?=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 17 ++++++++++++++++- .../xephi/authme/listener/PlayerListener.java | 6 +++++- .../properties/RestrictionSettings.java | 3 +++ src/main/resources/plugin.yml | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 92a99432..27fc081c 100644 --- a/pom.xml +++ b/pom.xml @@ -598,11 +598,26 @@ true + + opencollab-snapshot + https://repo.opencollab.dev/maven-snapshots/ + + false + + + true + + - + + org.geysermc.floodgate + api + 2.2.0-SNAPSHOT + provided + ch.jalu diff --git a/src/main/java/fr/xephi/authme/listener/PlayerListener.java b/src/main/java/fr/xephi/authme/listener/PlayerListener.java index b8173056..97d0cc8c 100644 --- a/src/main/java/fr/xephi/authme/listener/PlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/PlayerListener.java @@ -52,6 +52,7 @@ import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerShearEntityEvent; import org.bukkit.event.player.PlayerSwapHandItemsEvent; import org.bukkit.inventory.InventoryView; +import org.geysermc.floodgate.api.FloodgateApi; import javax.inject.Inject; import java.util.Locale; @@ -112,7 +113,9 @@ public class PlayerListener implements Listener { if (validationService.isUnrestricted(name)) { return; } - + if (settings.getProperty(RestrictionSettings.HOOK_FLOODGATE_PLAYER) && FloodgateApi.getInstance().isFloodgateId(event.getUniqueId())){ + return; + } // Non-blocking checks try { onJoinVerifier.checkIsValidName(name); @@ -120,6 +123,7 @@ public class PlayerListener implements Listener { event.setKickMessage(messages.retrieveSingle(name, e.getReason(), e.getArgs())); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); } + } /* diff --git a/src/main/java/fr/xephi/authme/settings/properties/RestrictionSettings.java b/src/main/java/fr/xephi/authme/settings/properties/RestrictionSettings.java index cc92aade..478e7051 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/RestrictionSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/RestrictionSettings.java @@ -125,6 +125,9 @@ public final class RestrictionSettings implements SettingsHolder { public static final Property ALLOWED_NICKNAME_CHARACTERS = newProperty("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_]*"); + @Comment("Allow FloodGatePlayer Join Without checkIsValidName()") + public static final Property HOOK_FLOODGATE_PLAYER = + newProperty("settings.restrictions.hookFloodGatePlayer", false); @Comment({ "How far can unregistered players walk?", "Set to 0 for unlimited radius" diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index cd0d90be..1e7fdeed 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -15,6 +15,7 @@ softdepend: - Essentials - EssentialsSpawn - ProtocolLib + - floodgate commands: authme: description: AuthMe op commands From a4bf7adb60cd2ed119ca209597136159da13a14e Mon Sep 17 00:00:00 2001 From: Sattera Date: Thu, 6 Apr 2023 09:42:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9=20floodgate=20?= =?UTF-8?q?=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/fr/xephi/authme/listener/PlayerListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/PlayerListener.java b/src/main/java/fr/xephi/authme/listener/PlayerListener.java index 97d0cc8c..7ec67f76 100644 --- a/src/main/java/fr/xephi/authme/listener/PlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/PlayerListener.java @@ -94,7 +94,7 @@ public class PlayerListener implements Listener { private PermissionsManager permissionsManager; @Inject private QuickCommandsProtectionManager quickCommandsProtectionManager; - + FloodgateApi Floodgate = org.geysermc.floodgate.api.FloodgateApi.getInstance(); // Lowest priority to apply fast protection checks @EventHandler(priority = EventPriority.LOWEST) public void onAsyncPlayerPreLoginEventLowest(AsyncPlayerPreLoginEvent event) { @@ -113,7 +113,7 @@ public class PlayerListener implements Listener { if (validationService.isUnrestricted(name)) { return; } - if (settings.getProperty(RestrictionSettings.HOOK_FLOODGATE_PLAYER) && FloodgateApi.getInstance().isFloodgateId(event.getUniqueId())){ + if (settings.getProperty(RestrictionSettings.HOOK_FLOODGATE_PLAYER) && Floodgate.isFloodgateId(event.getUniqueId())){ return; } // Non-blocking checks