mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-29 18:27:36 +02:00
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.
This commit is contained in:
@ -54,7 +54,7 @@ public class NameCheckTask extends JoinManagement<Player, CommandSender, Protoco
|
||||
|
||||
public NameCheckTask(FastLoginBukkit plugin, Random random, Player player, PacketEvent packetEvent,
|
||||
String username, PublicKey publicKey) {
|
||||
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getFloodgateService());
|
||||
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getFloodgateService(), plugin.getGeyserService());
|
||||
|
||||
this.plugin = plugin;
|
||||
this.packetEvent = packetEvent;
|
||||
|
@ -53,7 +53,8 @@ public class ProtocolSupportListener extends JoinManagement<Player, CommandSende
|
||||
private final RateLimiter rateLimiter;
|
||||
|
||||
public ProtocolSupportListener(FastLoginBukkit plugin, RateLimiter rateLimiter) {
|
||||
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getFloodgateService());
|
||||
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getFloodgateService(),
|
||||
plugin.getGeyserService());
|
||||
|
||||
this.plugin = plugin;
|
||||
this.rateLimiter = rateLimiter;
|
||||
|
@ -49,7 +49,8 @@ public class AsyncPremiumCheck extends JoinManagement<ProxiedPlayer, CommandSend
|
||||
|
||||
public AsyncPremiumCheck(FastLoginBungee plugin, PreLoginEvent preLoginEvent, PendingConnection connection,
|
||||
String username) {
|
||||
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getFloodgateService());
|
||||
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getFloodgateService(),
|
||||
plugin.getGeyserService());
|
||||
|
||||
this.plugin = plugin;
|
||||
this.preLoginEvent = preLoginEvent;
|
||||
|
@ -30,6 +30,7 @@ import com.github.games647.craftapi.resolver.RateLimitException;
|
||||
import com.github.games647.fastlogin.core.StoredProfile;
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
import com.github.games647.fastlogin.core.hooks.FloodgateService;
|
||||
import com.github.games647.fastlogin.core.hooks.GeyserService;
|
||||
import com.github.games647.fastlogin.core.shared.event.FastLoginPreLoginEvent;
|
||||
|
||||
import java.util.Optional;
|
||||
@ -41,11 +42,13 @@ public abstract class JoinManagement<P extends C, C, S extends LoginSource> {
|
||||
protected final FastLoginCore<P, C, ?> core;
|
||||
protected final AuthPlugin<P> authHook;
|
||||
private final FloodgateService floodgateService;
|
||||
private final GeyserService geyserService;
|
||||
|
||||
public JoinManagement(FastLoginCore<P, C, ?> core, AuthPlugin<P> authHook, FloodgateService floodService) {
|
||||
public JoinManagement(FastLoginCore<P, C, ?> core, AuthPlugin<P> 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<P extends C, C, S extends LoginSource> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//check if the player is connecting through Geyser (without Floodgate)
|
||||
else if (geyserService != null && geyserService.isGeyserConnection(username)) {
|
||||
|
||||
}
|
||||
|
||||
callFastLoginPreLoginEvent(username, source, profile);
|
||||
|
||||
|
@ -50,7 +50,8 @@ public class AsyncPremiumCheck extends JoinManagement<Player, CommandSource, Vel
|
||||
private final InboundConnection connection;
|
||||
|
||||
public AsyncPremiumCheck(FastLoginVelocity plugin, InboundConnection connection, String username, Continuation continuation, PreLoginEvent preLoginEvent) {
|
||||
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getFloodgateService());
|
||||
super(plugin.getCore(), plugin.getCore().getAuthPluginHook(), plugin.getFloodgateService(),
|
||||
plugin.getGeyserService());
|
||||
this.plugin = plugin;
|
||||
this.connection = connection;
|
||||
this.username = username;
|
||||
|
Reference in New Issue
Block a user