Fix SingleSession check order.

This commit is contained in:
DNx5 2016-01-03 09:07:48 +07:00
parent 052e414ff3
commit 4161dcaa94

View File

@ -62,6 +62,8 @@ public class AsynchronousJoin {
} }
final String ip = plugin.getIP(player); final String ip = plugin.getIP(player);
if (Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip, player.getAddress().getHostName())) { if (Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip, player.getAddress().getHostName())) {
sched.scheduleSyncDelayedTask(plugin, new Runnable() { sched.scheduleSyncDelayedTask(plugin, new Runnable() {
@ -114,7 +116,6 @@ public class AsynchronousJoin {
}); });
} }
} }
placePlayerSafely(player, spawnLoc); placePlayerSafely(player, spawnLoc);
LimboCache.getInstance().updateLimboPlayer(player); 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 { } else {
if (!Settings.unRegisteredGroup.isEmpty()) { if (!Settings.unRegisteredGroup.isEmpty()) {
Utils.setGroup(player, Utils.GroupType.UNREGISTERED); Utils.setGroup(player, Utils.GroupType.UNREGISTERED);
@ -183,7 +200,7 @@ public class AsynchronousJoin {
if (Settings.applyBlindEffect) { if (Settings.applyBlindEffect) {
int blindTimeOut; int blindTimeOut;
// Allow infinite blindness effect // Allow infinite blindness effect
if(timeOut <= 0) { if (timeOut <= 0) {
blindTimeOut = 99999; blindTimeOut = 99999;
} else { } else {
blindTimeOut = timeOut; blindTimeOut = timeOut;
@ -200,23 +217,6 @@ public class AsynchronousJoin {
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); 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; String[] msg;
if (isAuthAvailable) { if (isAuthAvailable) {
msg = m.retrieve(MessageKey.LOGIN_MESSAGE); msg = m.retrieve(MessageKey.LOGIN_MESSAGE);