From ccd8720b098a6dcc451448b057fa9a9f3e431c7d Mon Sep 17 00:00:00 2001 From: drtshock Date: Sat, 8 Nov 2014 14:59:45 -0600 Subject: [PATCH] Fix keySetView issue on non java8 servers. --- pom.xml | 2 +- src/main/java/com/massivecraft/factions/Faction.java | 2 ++ .../massivecraft/factions/zcore/persist/MemoryBoard.java | 8 ++++---- .../factions/zcore/persist/MemoryFaction.java | 8 ++++++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 26588891..ad0c81a4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.massivecraft Factions - 1.6.9.5-U0.1.10 + 1.6.9.5-U0.1.11-SNAPSHOT jar Factions diff --git a/src/main/java/com/massivecraft/factions/Faction.java b/src/main/java/com/massivecraft/factions/Faction.java index 11ff53e0..de171488 100644 --- a/src/main/java/com/massivecraft/factions/Faction.java +++ b/src/main/java/com/massivecraft/factions/Faction.java @@ -25,6 +25,8 @@ 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 6cc2f4a4..b79d8a2a 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.zcore.persist; import com.massivecraft.factions.*; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.util.AsciiCompass; +import com.massivecraft.factions.util.LazyLocation; import org.bukkit.ChatColor; import java.util.ArrayList; @@ -47,10 +48,9 @@ public abstract class MemoryBoard extends Board { public void removeAt(FLocation flocation) { Faction faction = getFactionAt(flocation); - for (String s : faction.getWarps().keySet()) { - if (flocation.isInChunk(faction.getWarp(s).getLocation())) { - faction.removeWarp(s); - P.p.log(Level.INFO, "Removed warp %s from faction %s", s, faction.getTag()); + for(LazyLocation loc : faction.getWarps().values()) { + if(flocation.isInChunk(loc.getLocation())) { + faction.removeWarp(loc); } } 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 f603a6ef..ad01ae98 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java @@ -92,6 +92,14 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { return false; } + public boolean removeWarp(LazyLocation loc) { + if(warps.containsValue(loc)) { + warps.remove(loc); + return true; + } + return false; + } + public void clearWarps() { warps.clear(); }