From f570474fa359a4bdaeff13174e51ebfec0535def Mon Sep 17 00:00:00 2001 From: Smart123s <28480228+Smart123s@users.noreply.github.com> Date: Sun, 24 Oct 2021 10:18:34 +0200 Subject: [PATCH] Detect Geyser connections at packet level It is possible to use Geyser without Floodgate by configuring Geyser to use auth-type= 'online' or 'offline'. In that scenario, floodgateService will be either unavailable or empty. --- .../bukkit/listener/protocollib/NameCheckTask.java | 2 +- .../protocolsupport/ProtocolSupportListener.java | 3 ++- .../fastlogin/bungee/task/AsyncPremiumCheck.java | 3 ++- .../games647/fastlogin/core/shared/JoinManagement.java | 9 ++++++++- .../fastlogin/velocity/task/AsyncPremiumCheck.java | 3 ++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/NameCheckTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/NameCheckTask.java index 0114c6a4..289fd358 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/NameCheckTask.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/NameCheckTask.java @@ -54,7 +54,7 @@ public class NameCheckTask extends JoinManagement { protected final FastLoginCore core; protected final AuthPlugin

authHook; private final FloodgateService floodgateService; + private final GeyserService geyserService; - public JoinManagement(FastLoginCore core, AuthPlugin

authHook, FloodgateService floodService) { + public JoinManagement(FastLoginCore core, AuthPlugin

authHook, FloodgateService floodService, GeyserService geyserService) { this.core = core; this.authHook = authHook; this.floodgateService = floodService; + this.geyserService = geyserService; } public void onLogin(String username, S source) { @@ -63,6 +66,10 @@ public abstract class JoinManagement

{ return; } } + //check if the player is connecting through Geyser (without Floodgate) + else if (geyserService != null && geyserService.isGeyserConnection(username)) { + + } callFastLoginPreLoginEvent(username, source, profile); diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/AsyncPremiumCheck.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/AsyncPremiumCheck.java index d219ef46..7a93d8fa 100644 --- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/AsyncPremiumCheck.java +++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/AsyncPremiumCheck.java @@ -50,7 +50,8 @@ public class AsyncPremiumCheck extends JoinManagement