From 4161dcaa9485c83d03810480edc3aeb4387d664e Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sun, 3 Jan 2016 09:07:48 +0700 Subject: [PATCH] Fix SingleSession check order. --- .../authme/process/join/AsynchronousJoin.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java index 9c763db3e..cbdac41eb 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java @@ -62,6 +62,8 @@ public class AsynchronousJoin { } final String ip = plugin.getIP(player); + + if (Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip, player.getAddress().getHostName())) { sched.scheduleSyncDelayedTask(plugin, new Runnable() { @@ -114,7 +116,6 @@ public class AsynchronousJoin { }); } } - placePlayerSafely(player, spawnLoc); LimboCache.getInstance().updateLimboPlayer(player); @@ -130,6 +131,22 @@ public class AsynchronousJoin { } } + if (Settings.isSessionsEnabled && (PlayerCache.getInstance().isAuthenticated(name) || database.isLogged(name))) { + if (plugin.sessions.containsKey(name)) { + plugin.sessions.get(name).cancel(); + plugin.sessions.remove(name); + } + PlayerAuth auth = database.getAuth(name); + database.setUnlogged(name); + PlayerCache.getInstance().removePlayer(name); + if (auth != null && auth.getIp().equals(ip)) { + m.send(player, MessageKey.SESSION_RECONNECTION); + plugin.getManagement().performLogin(player, "dontneed", true); + return; + } else if (Settings.sessionExpireOnIpChange) { + m.send(player, MessageKey.SESSION_EXPIRED); + } + } } else { if (!Settings.unRegisteredGroup.isEmpty()) { Utils.setGroup(player, Utils.GroupType.UNREGISTERED); @@ -183,7 +200,7 @@ public class AsynchronousJoin { if (Settings.applyBlindEffect) { int blindTimeOut; // Allow infinite blindness effect - if(timeOut <= 0) { + if (timeOut <= 0) { blindTimeOut = 99999; } else { blindTimeOut = timeOut; @@ -200,23 +217,6 @@ public class AsynchronousJoin { LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } - if (Settings.isSessionsEnabled && isAuthAvailable && (PlayerCache.getInstance().isAuthenticated(name) || database.isLogged(name))) { - if (plugin.sessions.containsKey(name)) { - plugin.sessions.get(name).cancel(); - plugin.sessions.remove(name); - } - PlayerAuth auth = database.getAuth(name); - database.setUnlogged(name); - PlayerCache.getInstance().removePlayer(name); - if (auth != null && auth.getIp().equals(ip)) { - m.send(player, MessageKey.SESSION_RECONNECTION); - plugin.getManagement().performLogin(player, "dontneed", true); - return; - } else if (Settings.sessionExpireOnIpChange) { - m.send(player, MessageKey.SESSION_EXPIRED); - } - } - String[] msg; if (isAuthAvailable) { msg = m.retrieve(MessageKey.LOGIN_MESSAGE);