Start logging players last login address.

This commit is contained in:
KHobbits 2011-11-04 15:28:51 +00:00
parent fd4c82b0eb
commit d8f7c82e2d
2 changed files with 24 additions and 1 deletions

View File

@ -213,7 +213,7 @@ public class EssentialsPlayerListener extends PlayerListener
user.setNPC(false);
final long currentTime = System.currentTimeMillis();
boolean banExpired = user.checkBanTimeout(currentTime);
final boolean banExpired = user.checkBanTimeout(currentTime);
user.checkMuteTimeout(currentTime);
user.checkJailTimeout(currentTime);
@ -232,6 +232,7 @@ public class EssentialsPlayerListener extends PlayerListener
event.allow();
user.setLastLogin(System.currentTimeMillis());
user.setLastLoginAddress(user.getAddress().getAddress().getHostAddress());
updateCompass(user);
}

View File

@ -52,6 +52,7 @@ public abstract class UserData extends PlayerExtension implements IConf
jailTimeout = _getJailTimeout();
lastLogin = _getLastLogin();
lastLogout = _getLastLogout();
lastLoginAddress = _getLastLoginAddress();
afk = getAfk();
newplayer = getNew();
geolocation = _getGeoLocation();
@ -668,6 +669,7 @@ public abstract class UserData extends PlayerExtension implements IConf
config.setProperty("timestamps.login", time);
config.save();
}
private long lastLogout;
private long _getLastLogout()
@ -686,6 +688,26 @@ public abstract class UserData extends PlayerExtension implements IConf
config.setProperty("timestamps.logout", time);
config.save();
}
private String lastLoginAddress;
private String _getLastLoginAddress()
{
return config.getString("ipAddress", "");
}
public String getLastLoginAddress()
{
return lastLoginAddress;
}
public void setLastLoginAddress(String address)
{
lastLoginAddress = address;
config.setProperty("ipAddress", address);
config.save();
}
private boolean afk;
private boolean getAfk()