From 5a9c28ae27a239a74f60c4edb73db7089c2ef62a Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Mon, 25 Jul 2011 21:16:42 -0500 Subject: [PATCH] Add support for 'defaultmap' setting in configuration.txt --- src/main/java/org/dynmap/ClientConfigurationComponent.java | 5 ++++- src/main/resources/configuration.txt | 2 ++ web/js/map.js | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/dynmap/ClientConfigurationComponent.java b/src/main/java/org/dynmap/ClientConfigurationComponent.java index 3d2479aa..82da1775 100644 --- a/src/main/java/org/dynmap/ClientConfigurationComponent.java +++ b/src/main/java/org/dynmap/ClientConfigurationComponent.java @@ -18,11 +18,12 @@ public class ClientConfigurationComponent extends Component { s(t, "joinmessage", c.getString("joinmessage", "%playername% joined")); s(t, "quitmessage", c.getString("quitmessage", "%playername% quit")); s(t, "spammessage", c.getString("spammessage", "You may only chat once every %interval% seconds.")); - s(t, "webprefix", c.getString("webprefix", "[WEB] ")); + s(t, "webprefix", unescapeString(c.getString("webprefix", "[WEB] "))); s(t, "defaultzoom", c.getInteger("defaultzoom", 0)); s(t, "sidebaropened", c.getBoolean("sidebaropened", false)); DynmapWorld defaultWorld = null; + String defmap = null; for(DynmapWorld world : plugin.mapManager.getWorlds()) { if (defaultWorld == null) defaultWorld = world; ConfigurationNode wn = world.configuration; @@ -38,9 +39,11 @@ public class ClientConfigurationComponent extends Component { for(MapType mt : world.maps) { mt.buildClientConfiguration(wo, world); + if(defmap == null) defmap = mt.getName(); } } s(t, "defaultworld", c.getString("defaultworld", defaultWorld == null ? "world" : defaultWorld.world.getName())); + s(t, "defaultmap", c.getString("defaultmap", defmap == null ? "surface" : defmap)); } }); } diff --git a/src/main/resources/configuration.txt b/src/main/resources/configuration.txt index fc23bb06..33ed4b1a 100644 --- a/src/main/resources/configuration.txt +++ b/src/main/resources/configuration.txt @@ -148,8 +148,10 @@ websuffix: "&color;f" # Enable checking for banned IPs via banned-ips.txt (internal web server only) check-banned-ips: true +# Default selection when map page is loaded defaultzoom: 0 defaultworld: world +defaultmap: surface # Set to true to enable verbose startup messages - can help with debugging map configuration problems # Set to false for a much quieter startup log diff --git a/web/js/map.js b/web/js/map.js index 09fa7d58..1bced0fe 100644 --- a/web/js/map.js +++ b/web/js/map.js @@ -118,7 +118,8 @@ DynMap.prototype = { dynmap: me }); map = world.maps[mapentry.name] = maptypes[mapentry.type](map); - + if(me.options.defaultmap && me.options.defaultmap == mapentry.name) + world.defaultmap = map; world.defaultmap = world.defaultmap || map; }); me.defaultworld = me.defaultworld || world;