Remove players from internal map immediately.

Should resolve #117
This commit is contained in:
t00thpick1 2014-12-07 14:52:56 -05:00
parent e9b0a4d67c
commit b8f742a588
2 changed files with 5 additions and 8 deletions

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.util;
import com.massivecraft.factions.*;
import com.massivecraft.factions.struct.Role;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
@ -15,7 +16,7 @@ public class AutoLeaveProcessTask extends BukkitRunnable {
private transient double toleranceMillis;
public AutoLeaveProcessTask() {
ArrayList<FPlayer> fplayers = new ArrayList<FPlayer>(FPlayers.getInstance().getAllFPlayers());
ArrayList<FPlayer> fplayers = (ArrayList<FPlayer>) FPlayers.getInstance().getAllFPlayers();
this.iterator = fplayers.listIterator();
this.toleranceMillis = Conf.autoLeaveAfterDaysOfInactivity * 24 * 60 * 60 * 1000;
this.readyToGo = true;

View File

@ -1,32 +1,28 @@
package com.massivecraft.factions.zcore.persist.json;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.zcore.persist.MemoryFPlayer;
public class JSONFPlayer extends MemoryFPlayer {
private transient boolean remove = false;
public JSONFPlayer(MemoryFPlayer arg0) {
super(arg0);
}
public JSONFPlayer() {
remove = false;
}
public JSONFPlayer(String id) {
super(id);
}
@Override
public void remove() {
remove = true;
((JSONFPlayers) FPlayers.getInstance()).fPlayers.remove(getId());
}
public boolean shouldBeSaved() {
if (!this.hasFaction() && (this.getPowerRounded() == this.getPowerMaxRounded() || this.getPowerRounded() == (int) Math.round(Conf.powerPlayerStarting))) {
return false;
}
return !remove;
return true;
}
}