Don't overwrite last location on logout

Logout position is saved as logoutlocation now in users yml
This commit is contained in:
snowleo 2013-02-08 21:22:35 +01:00
parent 335d8b7f20
commit 5b975672e8
4 changed files with 20 additions and 4 deletions

View file

@ -138,10 +138,7 @@ public class EssentialsPlayerListener implements Listener
{
user.toggleVanished();
}
if (!user.isJailed())
{
user.setLastLocation();
}
user.setLogoutLocation();
if (user.isRecipeSee())
{
user.getPlayer().getOpenInventory().getTopInventory().clear();

View file

@ -48,4 +48,6 @@ public interface IUser extends Player
boolean isAfk();
void setAfk(final boolean set);
void setLogoutLocation();
}

View file

@ -253,6 +253,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
setLastLocation(getLocation());
}
@Override
public void setLogoutLocation()
{
setLogoutLocation(getLocation());
}
public void requestTeleport(final User player, final boolean here)
{

View file

@ -318,6 +318,17 @@ public abstract class UserData extends PlayerExtension implements IConf
config.setProperty("lastlocation", loc);
config.save();
}
public void setLogoutLocation(Location loc)
{
if (loc == null || loc.getWorld() == null)
{
return;
}
config.setProperty("logoutlocation", loc);
config.save();
}
private long lastTeleportTimestamp;
private long _getLastTeleportTimestamp()