Skip to content

Commit 8e6221d

Browse files
Smart123sBOT-Neil
authored andcommitted
Fix delayed force login for Floodgate players
Login checks are done by bungee, so Bukkit doesn't have to do anything. The session is set for them by the plugin messages, however, force login may be delayed. In that case, the player should be logged in at the onPlayerJoin event. However, FloodgateAuthTask was run at onPlayerJoin, even if the player allready had a valid login session. And FloodgateAuthTask always deffers force login if bungee is present. As a result, the Floodgate player will never get logged in, if the force login was delayed by the plugin message. Co-authored-by: BOT-Neil <[email protected]>
1 parent 7a049b9 commit 8e6221d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/ConnectionListener.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,20 @@ private void delayForceLogin(Player player) {
8181
// cases: Paper (firing BungeeCord message before PlayerJoinEvent) or not running BungeeCord and already
8282
// having the login session from the login process
8383
BukkitLoginSession session = plugin.getSession(player.getAddress());
84-
FloodgateService floodgateService = plugin.getFloodgateService();
85-
if (floodgateService != null) {
86-
FloodgatePlayer floodgatePlayer = floodgateService.getBedrockPlayer(player.getUniqueId());
87-
if (floodgatePlayer != null) {
88-
Runnable floodgateAuthTask = new FloodgateAuthTask(plugin.getCore(), player, floodgatePlayer);
89-
Bukkit.getScheduler().runTaskAsynchronously(plugin, floodgateAuthTask);
90-
return;
91-
}
92-
}
9384

9485
if (session == null) {
86+
// Floodgate players usually don't have a session at this point
87+
// exception: if force login by bungee message had been delayed
88+
FloodgateService floodgateService = plugin.getFloodgateService();
89+
if (floodgateService != null) {
90+
FloodgatePlayer floodgatePlayer = floodgateService.getBedrockPlayer(player.getUniqueId());
91+
if (floodgatePlayer != null) {
92+
Runnable floodgateAuthTask = new FloodgateAuthTask(plugin.getCore(), player, floodgatePlayer);
93+
Bukkit.getScheduler().runTaskAsynchronously(plugin, floodgateAuthTask);
94+
return;
95+
}
96+
}
97+
9598
String sessionId = plugin.getSessionId(player.getAddress());
9699
plugin.getLog().info("No on-going login session for player: {} with ID {}", player, sessionId);
97100
} else {

0 commit comments

Comments
 (0)