1
0
mirror of https://github.com/AuthMe/AuthMeReloaded.git synced 2024-12-26 02:27:50 +01:00

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);
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);