diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandessentials.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java index 00153c61e..07f27b1be 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java @@ -247,14 +247,23 @@ public class Commandessentials extends EssentialsCommand } int ban = user.getBanReason().equals("") ? 0 : 1; - long timeDiff = System.currentTimeMillis() - user.getLastLogout(); + long lastLog = user.getLastLogout(); + long timeDiff = System.currentTimeMillis() - lastLog; long milliDays = daysArg * 24 * 60 * 60; + int homeCount = user.getHomes().size(); + double moneyCount = user.getMoney(); - if ((ban > bansArg) || (timeDiff < milliDays) - || (user.getHomes().size() > homesArg) || (user.getMoney() > moneyArg)) + if ((lastLog == 0) || (ban > bansArg) || (timeDiff < milliDays) + || (homeCount > homesArg) || (moneyCount > moneyArg)) { continue; } + + if (ess.getSettings().isDebug()) + { + ess.getLogger().info("Deleting user: " + user.getName() + " Money: " + moneyCount + " Homes: " + homeCount + " Last seen: " + Util.formatDateDiff(lastLog)); + } + user.reset(); } sender.sendMessage(_("cleaned")); |