From baaabb22d4ab1215cb1c9e2f5f0d86b69289e7bb Mon Sep 17 00:00:00 2001 From: Sattera Date: Tue, 4 Apr 2023 09:08:07 +0800 Subject: [PATCH] =?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 | 8 +++++++- .../properties/RestrictionSettings.java | 3 +++ src/main/resources/plugin.yml | 1 + 4 files changed, 27 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..778fc994 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; @@ -93,6 +94,8 @@ public class PlayerListener implements Listener { private PermissionsManager permissionsManager; @Inject private QuickCommandsProtectionManager quickCommandsProtectionManager; + @Inject + private FloodgateApi Floodgate; // Lowest priority to apply fast protection checks @EventHandler(priority = EventPriority.LOWEST) @@ -112,7 +115,9 @@ public class PlayerListener implements Listener { if (validationService.isUnrestricted(name)) { return; } - + if (settings.getProperty(RestrictionSettings.HOOK_FLOODGATE_PLAYER) && Floodgate.isFloodgateId(event.getUniqueId())){ + return; + } // Non-blocking checks try { onJoinVerifier.checkIsValidName(name); @@ -120,6 +125,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