From d36e88f2c0a9ce5ad80c9127a8a3f3f62699bdd3 Mon Sep 17 00:00:00 2001 From: eueln Date: Tue, 6 Jan 2015 11:57:33 -0600 Subject: [PATCH] Correctly remove faction warps in unclaimed land --- .../java/com/massivecraft/factions/Faction.java | 2 -- .../factions/zcore/persist/MemoryBoard.java | 7 ++++--- .../factions/zcore/persist/MemoryFaction.java | 14 +------------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/Faction.java b/src/main/java/com/massivecraft/factions/Faction.java index de171488..11ff53e0 100644 --- a/src/main/java/com/massivecraft/factions/Faction.java +++ b/src/main/java/com/massivecraft/factions/Faction.java @@ -25,8 +25,6 @@ public interface Faction extends EconomyParticipator { public boolean removeWarp(String name); - public boolean removeWarp(LazyLocation loc); - public void clearWarps(); public void addAnnouncement(FPlayer fPlayer, String msg); diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java index d392c304..e476d6f8 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java @@ -47,9 +47,10 @@ public abstract class MemoryBoard extends Board { public void removeAt(FLocation flocation) { Faction faction = getFactionAt(flocation); - for (LazyLocation loc : faction.getWarps().values()) { - if (flocation.isInChunk(loc.getLocation())) { - faction.removeWarp(loc); + Iterator it = faction.getWarps().values().iterator(); + while (it.hasNext()) { + if (flocation.isInChunk(it.next().getLocation())) { + it.remove(); } } clearOwnershipAt(flocation); diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java index a9298cc8..90bcee3f 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java @@ -86,19 +86,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } public boolean removeWarp(String name) { - if (warps.containsKey(name)) { - warps.remove(name); - return true; - } - return false; - } - - public boolean removeWarp(LazyLocation loc) { - if (warps.containsValue(loc)) { - warps.remove(loc); - return true; - } - return false; + return warps.remove(name) != null; } public void clearWarps() {