mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 10:47:33 +02:00
@ -123,17 +123,21 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin<Comman
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BukkitLoginSession getSession(InetSocketAddress addr) {
|
public BukkitLoginSession getSession(InetSocketAddress addr) {
|
||||||
String id = addr.getAddress().getHostAddress() + ':' + addr.getPort();
|
String id = getSessionId(addr);
|
||||||
return loginSession.get(id);
|
return loginSession.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSessionId(InetSocketAddress addr) {
|
||||||
|
return addr.getAddress().getHostAddress() + ':' + addr.getPort();
|
||||||
|
}
|
||||||
|
|
||||||
public void putSession(InetSocketAddress addr, BukkitLoginSession session) {
|
public void putSession(InetSocketAddress addr, BukkitLoginSession session) {
|
||||||
String id = addr.getAddress().getHostAddress() + ':' + addr.getPort();
|
String id = getSessionId(addr);
|
||||||
loginSession.put(id, session);
|
loginSession.put(id, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSession(InetSocketAddress addr) {
|
public void removeSession(InetSocketAddress addr) {
|
||||||
String id = addr.getAddress().getHostAddress() + ':' + addr.getPort();
|
String id = getSessionId(addr);
|
||||||
loginSession.remove(id);
|
loginSession.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ public class BungeeListener implements PluginMessageListener {
|
|||||||
Type type = message.getType();
|
Type type = message.getType();
|
||||||
|
|
||||||
InetSocketAddress address = player.getAddress();
|
InetSocketAddress address = player.getAddress();
|
||||||
|
plugin.getLog().info("Player info {} command for {} from proxy", type, playerName);
|
||||||
if (type == Type.LOGIN) {
|
if (type == Type.LOGIN) {
|
||||||
onLoginMessage(player, playerName, address);
|
onLoginMessage(player, playerName, address);
|
||||||
} else if (type == Type.REGISTER) {
|
} else if (type == Type.REGISTER) {
|
||||||
@ -103,7 +104,9 @@ public class BungeeListener implements PluginMessageListener {
|
|||||||
plugin.putSession(player.getAddress(), session);
|
plugin.putSession(player.getAddress(), session);
|
||||||
|
|
||||||
// only start a new login task if the join event fired earlier. This event then didn
|
// only start a new login task if the join event fired earlier. This event then didn
|
||||||
if (plugin.getBungeeManager().didJoinEventFired(player)) {
|
boolean result = plugin.getBungeeManager().didJoinEventFired(player);
|
||||||
|
plugin.getLog().info("Delaying force login until join event fired?: {}", result);
|
||||||
|
if (result) {
|
||||||
Runnable forceLoginTask = new ForceLoginTask(plugin.getCore(), player, session);
|
Runnable forceLoginTask = new ForceLoginTask(plugin.getCore(), player, session);
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, forceLoginTask);
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, forceLoginTask);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,8 @@ public class ConnectionListener implements Listener {
|
|||||||
// having the login session from the login process
|
// having the login session from the login process
|
||||||
BukkitLoginSession session = plugin.getSession(player.getAddress());
|
BukkitLoginSession session = plugin.getSession(player.getAddress());
|
||||||
if (session == null) {
|
if (session == null) {
|
||||||
plugin.getLog().info("No on-going login session for player: {}", player);
|
String sessionId = plugin.getSessionId(player.getAddress());
|
||||||
|
plugin.getLog().info("No on-going login session for player: {} with ID {}", player, sessionId);
|
||||||
} else {
|
} else {
|
||||||
Runnable forceLoginTask = new ForceLoginTask(plugin.getCore(), player, session);
|
Runnable forceLoginTask = new ForceLoginTask(plugin.getCore(), player, session);
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, forceLoginTask);
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, forceLoginTask);
|
||||||
|
@ -20,7 +20,13 @@ public abstract class ForceLoginManagement<P extends C, C, L extends LoginSessio
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!isOnline(player) || session == null) {
|
if (!isOnline(player)) {
|
||||||
|
core.getPlugin().getLog().info("Player {} disconnected", player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (session == null) {
|
||||||
|
core.getPlugin().getLog().info("No valid session found for {}", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user