Merge pull request #323 from mikeprimm/master

Add support for 'defaultmap' setting in configuration.txt
This commit is contained in:
mikeprimm 2011-07-25 19:29:12 -07:00
commit 5762340238
3 changed files with 8 additions and 2 deletions

View File

@ -18,11 +18,12 @@ public class ClientConfigurationComponent extends Component {
s(t, "joinmessage", c.getString("joinmessage", "%playername% joined")); s(t, "joinmessage", c.getString("joinmessage", "%playername% joined"));
s(t, "quitmessage", c.getString("quitmessage", "%playername% quit")); s(t, "quitmessage", c.getString("quitmessage", "%playername% quit"));
s(t, "spammessage", c.getString("spammessage", "You may only chat once every %interval% seconds.")); 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, "defaultzoom", c.getInteger("defaultzoom", 0));
s(t, "sidebaropened", c.getBoolean("sidebaropened", false)); s(t, "sidebaropened", c.getBoolean("sidebaropened", false));
DynmapWorld defaultWorld = null; DynmapWorld defaultWorld = null;
String defmap = null;
for(DynmapWorld world : plugin.mapManager.getWorlds()) { for(DynmapWorld world : plugin.mapManager.getWorlds()) {
if (defaultWorld == null) defaultWorld = world; if (defaultWorld == null) defaultWorld = world;
ConfigurationNode wn = world.configuration; ConfigurationNode wn = world.configuration;
@ -38,9 +39,11 @@ public class ClientConfigurationComponent extends Component {
for(MapType mt : world.maps) { for(MapType mt : world.maps) {
mt.buildClientConfiguration(wo, world); mt.buildClientConfiguration(wo, world);
if(defmap == null) defmap = mt.getName();
} }
} }
s(t, "defaultworld", c.getString("defaultworld", defaultWorld == null ? "world" : defaultWorld.world.getName())); s(t, "defaultworld", c.getString("defaultworld", defaultWorld == null ? "world" : defaultWorld.world.getName()));
s(t, "defaultmap", c.getString("defaultmap", defmap == null ? "surface" : defmap));
} }
}); });
} }

View File

@ -148,8 +148,10 @@ websuffix: "&color;f"
# Enable checking for banned IPs via banned-ips.txt (internal web server only) # Enable checking for banned IPs via banned-ips.txt (internal web server only)
check-banned-ips: true check-banned-ips: true
# Default selection when map page is loaded
defaultzoom: 0 defaultzoom: 0
defaultworld: world defaultworld: world
defaultmap: flat
# Set to true to enable verbose startup messages - can help with debugging map configuration problems # Set to true to enable verbose startup messages - can help with debugging map configuration problems
# Set to false for a much quieter startup log # Set to false for a much quieter startup log

View File

@ -118,7 +118,8 @@ DynMap.prototype = {
dynmap: me dynmap: me
}); });
map = world.maps[mapentry.name] = maptypes[mapentry.type](map); 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; world.defaultmap = world.defaultmap || map;
}); });
me.defaultworld = me.defaultworld || world; me.defaultworld = me.defaultworld || world;