From 23f5ec5a2717731f69709e830737412133b25871 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Sun, 22 May 2011 19:21:27 -0500 Subject: [PATCH 1/3] Fix handling of existing maps tag under world definitions --- src/main/java/org/dynmap/DynmapPlugin.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/dynmap/DynmapPlugin.java b/src/main/java/org/dynmap/DynmapPlugin.java index f7036a68..60bf6c5b 100644 --- a/src/main/java/org/dynmap/DynmapPlugin.java +++ b/src/main/java/org/dynmap/DynmapPlugin.java @@ -30,20 +30,14 @@ import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; -import org.dynmap.Event.Listener; import org.dynmap.debug.Debug; import org.dynmap.debug.Debugger; import org.dynmap.permissions.NijikokunPermissions; import org.dynmap.permissions.OpPermissions; import org.dynmap.permissions.PermissionProvider; -import org.dynmap.regions.RegionHandler; import org.dynmap.web.HttpServer; -import org.dynmap.web.Json; import org.dynmap.web.handlers.ClientConfigurationHandler; -import org.dynmap.web.handlers.ClientUpdateHandler; import org.dynmap.web.handlers.FilesystemHandler; -import org.dynmap.web.handlers.SendMessageHandler; -import org.json.simple.JSONObject; public class DynmapPlugin extends JavaPlugin { public HttpServer webServer = null; @@ -54,6 +48,8 @@ public class DynmapPlugin extends JavaPlugin { public PermissionProvider permissions; public ComponentManager componentManager = new ComponentManager(); public Events events = new Events(); + /* Flag to let code know that we're doing reload - make sure we don't double-register event handlers */ + public boolean is_reload = false; public static File dataDirectory; public static File tilesDirectory; @@ -347,8 +343,10 @@ public class DynmapPlugin extends JavaPlugin { } } else if (c.equals("reload") && checkPlayerPermission(sender, "reload")) { sender.sendMessage("Reloading Dynmap..."); + is_reload = true; onDisable(); onEnable(); + is_reload = false; sender.sendMessage("Dynmap reloaded"); return true; } @@ -413,13 +411,13 @@ public class DynmapPlugin extends JavaPlugin { else { /* Else, definition is there, but may be incomplete */ boolean wupd = false; List tempmaps = typetemplate.getList("maps"); - if((tempmaps != null) && (world.getNode("maps") == null)) { /* World with no maps section */ + if((tempmaps != null) && (world.get("maps") == null)) { /* World with no maps section */ world.put("maps", tempmaps); Log.info("World '" + w.getName() + "' configuration inherited maps from template"); wupd = true; } ConfigurationNode tempcenter = typetemplate.getNode("center"); - if((tempcenter != null) && (world.getNode("center") == null)) { /* World with no center */ + if((tempcenter != null) && (world.get("center") == null)) { /* World with no center */ world.put("center", new ConfigurationNode(new HashMap(tempcenter))); Log.info("World '" + w.getName() + "' configuration inherited center from template"); wupd = true; @@ -439,4 +437,8 @@ public class DynmapPlugin extends JavaPlugin { node.put("worlds", worlds); } } + + public boolean isReload() { + return is_reload; + } } From 7cf75873b87d5292c1ccd4461014fa6f7d0b0e0a Mon Sep 17 00:00:00 2001 From: mikeprimm Date: Mon, 23 May 2011 08:06:08 -0700 Subject: [PATCH 2/3] Add hiddenworlds attribute to suppress templates on selected worlds --- src/main/java/org/dynmap/DynmapPlugin.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/dynmap/DynmapPlugin.java b/src/main/java/org/dynmap/DynmapPlugin.java index 60bf6c5b..b5618831 100644 --- a/src/main/java/org/dynmap/DynmapPlugin.java +++ b/src/main/java/org/dynmap/DynmapPlugin.java @@ -379,13 +379,18 @@ public class DynmapPlugin extends JavaPlugin { worlds = new ArrayList(); worldsupdated = true; } + List hiddenworlds = node.getStrings("hiddenworlds", Collections.EMPTY_LIST); + /* Iternate by world type - so that order in templateworldtypes drives our default order */ for(int wtype = 0; wtype < templateworldtypes.length; wtype++) { ConfigurationNode typetemplate = template.getNode(templateworldtypes[wtype]); if(typetemplate == null) continue; for(World w : getServer().getWorlds()) { /* Roll through worlds */ - String wn = w.getName(); + String wn = w.getName(); + /* Skip processing on hidden worlds */ + if(hiddenworlds.contains(wn)) + continue; /* Find node for this world, if any */ ConfigurationNode world = null; int index; From d0ab3b6fe50073970b9a601b402ccca8d18a02ef Mon Sep 17 00:00:00 2001 From: mikeprimm Date: Mon, 23 May 2011 08:08:06 -0700 Subject: [PATCH 3/3] Add sample hiddenworlds settings with harmless defaults --- configuration.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configuration.txt b/configuration.txt index fa99060b..a9c99d4c 100644 --- a/configuration.txt +++ b/configuration.txt @@ -169,7 +169,10 @@ template: prefix: nt maximumheight: 127 colorscheme: default - +# This list of worlds will be hidden - they will not be automatically initialized by templates +hiddenworlds: + - MyHiddenWorld + - AnotherHiddenWorld # The maptypes Dynmap will use to render. worlds: