From f118ada39e5e3eefbd2ef8548b8f846412893466 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Tue, 28 Jun 2011 11:00:05 -0500 Subject: [PATCH] Fix 'visibleregions' option on JSON (gotta kill those parallel code paths at some point....) --- .../org/dynmap/regions/RegionsComponent.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/org/dynmap/regions/RegionsComponent.java b/src/main/java/org/dynmap/regions/RegionsComponent.java index 61f49a9e..519d3e74 100644 --- a/src/main/java/org/dynmap/regions/RegionsComponent.java +++ b/src/main/java/org/dynmap/regions/RegionsComponent.java @@ -4,6 +4,9 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; import java.util.Map; import org.bukkit.World; @@ -67,6 +70,19 @@ public class RegionsComponent extends ClientComponent { File webWorldPath = new File(plugin.getWebPath()+"/standalone/", outputFileName); Map regionData = (Map) regionConfig.getProperty(configuration.getString("basenode", "regions")); + /* See if we have explicit list of regions to report - limit to this list if we do */ + List idlist = configuration.getStrings("visibleregions", null); + if(idlist != null) { + @SuppressWarnings("unchecked") + HashSet ids = new HashSet((Collection) regionData.keySet()); + for(String id : ids) { + /* If not in list, remove it */ + if(!idlist.contains(id)) { + regionData.remove(id); + } + } + } + if (webWorldPath.isAbsolute()) outputFile = webWorldPath; else {