From d8f7c82e2d9aad8242bdfc24e4595a4ead380c75 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Fri, 4 Nov 2011 15:28:51 +0000 Subject: [PATCH] Start logging players last login address. --- .../essentials/EssentialsPlayerListener.java | 3 ++- .../src/com/earth2me/essentials/UserData.java | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 3205d4d91..c53c42b70 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -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); } diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index f0a461b70..dcf67bfc8 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -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()