Correctly remove faction warps in unclaimed land

This commit is contained in:
eueln 2015-01-06 11:57:33 -06:00
parent 5799a0480b
commit d36e88f2c0
3 changed files with 5 additions and 18 deletions

View File

@ -25,8 +25,6 @@ public interface Faction extends EconomyParticipator {
public boolean removeWarp(String name); public boolean removeWarp(String name);
public boolean removeWarp(LazyLocation loc);
public void clearWarps(); public void clearWarps();
public void addAnnouncement(FPlayer fPlayer, String msg); public void addAnnouncement(FPlayer fPlayer, String msg);

View File

@ -47,9 +47,10 @@ public abstract class MemoryBoard extends Board {
public void removeAt(FLocation flocation) { public void removeAt(FLocation flocation) {
Faction faction = getFactionAt(flocation); Faction faction = getFactionAt(flocation);
for (LazyLocation loc : faction.getWarps().values()) { Iterator<LazyLocation> it = faction.getWarps().values().iterator();
if (flocation.isInChunk(loc.getLocation())) { while (it.hasNext()) {
faction.removeWarp(loc); if (flocation.isInChunk(it.next().getLocation())) {
it.remove();
} }
} }
clearOwnershipAt(flocation); clearOwnershipAt(flocation);

View File

@ -86,19 +86,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
} }
public boolean removeWarp(String name) { public boolean removeWarp(String name) {
if (warps.containsKey(name)) { return warps.remove(name) != null;
warps.remove(name);
return true;
}
return false;
}
public boolean removeWarp(LazyLocation loc) {
if (warps.containsValue(loc)) {
warps.remove(loc);
return true;
}
return false;
} }
public void clearWarps() { public void clearWarps() {