From 98b98256b794af72965f40a1b1166037d50189e7 Mon Sep 17 00:00:00 2001 From: GJ Date: Thu, 13 Jun 2013 12:23:58 -0400 Subject: [PATCH] Make our oldUserRemover actually work... --- .../nossr50/database/FlatfileDatabaseManager.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java index d4208b08a..f32724f77 100644 --- a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java @@ -13,19 +13,17 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.bukkit.entity.Player; +import org.bukkit.OfflinePlayer; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.database.PlayerStat; -import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.spout.huds.HudType; import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.player.UserManager; public final class FlatfileDatabaseManager implements DatabaseManager { private final HashMap> playerStatHash = new HashMap>(); @@ -61,10 +59,8 @@ public final class FlatfileDatabaseManager implements DatabaseManager { mcMMO.p.getLogger().info("Purging old users..."); - for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers().values()) { - Player player = mcMMOPlayer.getPlayer(); - - if (currentTime - player.getLastPlayed() > PURGE_TIME && removeUser(player.getName())) { + for (OfflinePlayer player : mcMMO.p.getServer().getOfflinePlayers()) { + if (!player.isOnline() && (currentTime - player.getLastPlayed() > PURGE_TIME && removeUser(player.getName()))) { removedPlayers++; } }