Add support for 'defaultmap' setting in configuration.txt

This commit is contained in:
Mike Primm 2011-07-25 21:16:42 -05:00
parent aa29ddf141
commit 5a9c28ae27
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, "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));
}
});
}

View File

@ -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

View File

@ -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;