Try this way to fix quitloc

This commit is contained in:
Xephi59 2015-07-31 14:39:49 +02:00
parent 84a1227afd
commit 4ecbd7b526

View File

@ -46,16 +46,13 @@ public class AsyncronousQuit {
return;
}
Location loc = player.getLocation();
String ip = plugin.getIP(player);
if (PlayerCache.getInstance().isAuthenticated(name) && !player.isDead()) {
if (Settings.isSaveQuitLocationEnabled && database.isAuthAvailable(name)) {
final PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName(), player.getName());
try {
database.updateQuitLoc(auth);
} catch (NullPointerException npe) {
}
Location loc = player.getLocation();
PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName(), player.getName());
database.updateQuitLoc(auth);
}
PlayerAuth auth = new PlayerAuth(name, ip, System.currentTimeMillis(), player.getName());
database.updateSession(auth);
@ -78,19 +75,19 @@ public class AsyncronousQuit {
LimboCache.getInstance().deleteLimboPlayer(name);
}
if (Settings.isSessionsEnabled && !isKick) {
if (Settings.getSessionTimeout != 0){
BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
PlayerCache.getInstance().removePlayer(name);
if (database.isLogged(name))
database.setUnlogged(name);
plugin.sessions.remove(name);
}
}, Settings.getSessionTimeout * 20 * 60);
plugin.sessions.put(name, task);
if (Settings.getSessionTimeout != 0) {
BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
PlayerCache.getInstance().removePlayer(name);
if (database.isLogged(name))
database.setUnlogged(name);
plugin.sessions.remove(name);
}
}, Settings.getSessionTimeout * 20 * 60);
plugin.sessions.put(name, task);
}
} else {
PlayerCache.getInstance().removePlayer(name);