Search in sources :

Example 1 with FloodgateAuthTask

use of com.github.games647.fastlogin.bungee.task.FloodgateAuthTask in project FastLogin by games647.

the class ConnectionListener method delayForceLogin.

private void delayForceLogin(Player player) {
    // session exists so the player is ready for force login
    // cases: Paper (firing BungeeCord message before PlayerJoinEvent) or not running BungeeCord and already
    // having the login session from the login process
    BukkitLoginSession session = plugin.getSession(player.getAddress());
    if (session == null) {
        // Floodgate players usually don't have a session at this point
        // exception: if force login by bungee message had been delayed
        FloodgateService floodgateService = plugin.getFloodgateService();
        if (floodgateService != null) {
            FloodgatePlayer floodgatePlayer = floodgateService.getBedrockPlayer(player.getUniqueId());
            if (floodgatePlayer != null) {
                Runnable floodgateAuthTask = new FloodgateAuthTask(plugin.getCore(), player, floodgatePlayer);
                Bukkit.getScheduler().runTaskAsynchronously(plugin, floodgateAuthTask);
                return;
            }
        }
        String sessionId = plugin.getSessionId(player.getAddress());
        plugin.getLog().info("No on-going login session for player: {} with ID {}. ", player, sessionId);
        plugin.getLog().info("Setups using Minecraft proxies will start delayed " + "when the command from the proxy is received");
    } else {
        Runnable forceLoginTask = new ForceLoginTask(plugin.getCore(), player, session);
        Bukkit.getScheduler().runTaskAsynchronously(plugin, forceLoginTask);
    }
    plugin.getBungeeManager().markJoinEventFired(player);
}
Also used : ForceLoginTask(com.github.games647.fastlogin.bukkit.task.ForceLoginTask) FloodgatePlayer(org.geysermc.floodgate.api.player.FloodgatePlayer) FloodgateService(com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService) BukkitLoginSession(com.github.games647.fastlogin.bukkit.BukkitLoginSession) FloodgateAuthTask(com.github.games647.fastlogin.bukkit.task.FloodgateAuthTask)

Example 2 with FloodgateAuthTask

use of com.github.games647.fastlogin.bungee.task.FloodgateAuthTask in project FastLogin by games647.

the class ConnectListener method onServerConnected.

@EventHandler
public void onServerConnected(ServerConnectedEvent serverConnectedEvent) {
    ProxiedPlayer player = serverConnectedEvent.getPlayer();
    Server server = serverConnectedEvent.getServer();
    FloodgateService floodgateService = plugin.getFloodgateService();
    if (floodgateService != null) {
        FloodgatePlayer floodgatePlayer = floodgateService.getBedrockPlayer(player.getUniqueId());
        if (floodgatePlayer != null) {
            Runnable floodgateAuthTask = new FloodgateAuthTask(plugin.getCore(), player, floodgatePlayer, server);
            plugin.getScheduler().runAsync(floodgateAuthTask);
            return;
        }
    }
    BungeeLoginSession session = plugin.getSession().get(player.getPendingConnection());
    if (session == null) {
        return;
    }
    // delay sending force command, because Paper will process the login event asynchronously
    // In this case it means that the force command (plugin message) is already received and processed while
    // player is still in the login phase and reported to be offline.
    Runnable loginTask = new ForceLoginTask(plugin.getCore(), player, server, session);
    plugin.getScheduler().runAsync(loginTask);
}
Also used : ForceLoginTask(com.github.games647.fastlogin.bungee.task.ForceLoginTask) ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) FloodgatePlayer(org.geysermc.floodgate.api.player.FloodgatePlayer) FloodgateService(com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService) Server(net.md_5.bungee.api.connection.Server) BungeeLoginSession(com.github.games647.fastlogin.bungee.BungeeLoginSession) FloodgateAuthTask(com.github.games647.fastlogin.bungee.task.FloodgateAuthTask) EventHandler(net.md_5.bungee.event.EventHandler)

Aggregations

FloodgateService (com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService)2 FloodgatePlayer (org.geysermc.floodgate.api.player.FloodgatePlayer)2 BukkitLoginSession (com.github.games647.fastlogin.bukkit.BukkitLoginSession)1 FloodgateAuthTask (com.github.games647.fastlogin.bukkit.task.FloodgateAuthTask)1 ForceLoginTask (com.github.games647.fastlogin.bukkit.task.ForceLoginTask)1 BungeeLoginSession (com.github.games647.fastlogin.bungee.BungeeLoginSession)1 FloodgateAuthTask (com.github.games647.fastlogin.bungee.task.FloodgateAuthTask)1 ForceLoginTask (com.github.games647.fastlogin.bungee.task.ForceLoginTask)1 ProxiedPlayer (net.md_5.bungee.api.connection.ProxiedPlayer)1 Server (net.md_5.bungee.api.connection.Server)1 EventHandler (net.md_5.bungee.event.EventHandler)1