Only dispose users who are offline at point of disposal.

This should cater for quick reconnects on lagged servers.
This commit is contained in:
KHobbits 2014-05-10 15:36:58 +01:00
parent f09180659d
commit b00c31730f
2 changed files with 64 additions and 59 deletions

View File

@ -208,23 +208,25 @@ public class EssentialsPlayerListener implements Listener
} }
ess.getBackup().onPlayerJoin(); ess.getBackup().onPlayerJoin();
final User user = ess.getUser(player); final User dUser = ess.getUser(player);
if (user.isNPC()) if (dUser.isNPC())
{ {
user.setNPC(false); dUser.setNPC(false);
} }
final long currentTime = System.currentTimeMillis(); final long currentTime = System.currentTimeMillis();
user.checkMuteTimeout(currentTime); dUser.checkMuteTimeout(currentTime);
user.updateActivity(false); dUser.updateActivity(false);
ess.scheduleSyncDelayedTask(new Runnable() ess.scheduleSyncDelayedTask(new Runnable()
{ {
@Override @Override
public void run() public void run()
{ {
final User user = ess.getUser(player);
if (!user.getBase().isOnline()) if (!user.getBase().isOnline())
{ {
return; return;

View File

@ -237,7 +237,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
private void _dispose() private void _dispose()
{ {
this.base = new OfflinePlayer(base.getUniqueId(), ess.getServer()); if (!base.isOnline())
{
this.base = new OfflinePlayer(base.getUniqueId(), ess.getServer());
}
} }
@Override @Override