From 5cf84693b9497ee70e91ad2d2c456e73a0e48461 Mon Sep 17 00:00:00 2001 From: Evenprime Date: Wed, 16 Nov 2011 15:28:34 +0100 Subject: [PATCH] Minor security fix for player management and timerelated problems --- .../evenprime/bukkit/nocheat/player/NoCheatPlayerImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cc/co/evenprime/bukkit/nocheat/player/NoCheatPlayerImpl.java b/src/cc/co/evenprime/bukkit/nocheat/player/NoCheatPlayerImpl.java index 9e7d9a01..8539deaa 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/player/NoCheatPlayerImpl.java +++ b/src/cc/co/evenprime/bukkit/nocheat/player/NoCheatPlayerImpl.java @@ -80,10 +80,14 @@ public class NoCheatPlayerImpl implements NoCheatPlayer { } public void setLastUsedTime(long currentTimeInMilliseconds) { - this.lastUsedTime = System.currentTimeMillis(); + this.lastUsedTime = currentTimeInMilliseconds; } public boolean shouldBeRemoved(long currentTimeInMilliseconds) { + if(lastUsedTime > currentTimeInMilliseconds) { + // Should never happen, but if it does, fix it somewhat + lastUsedTime = currentTimeInMilliseconds; + } return lastUsedTime + 60000L < currentTimeInMilliseconds; }