Merge pull request #243 from mikeprimm/master

Add verbose: false option to make dynmap much less chatty during startup
This commit is contained in:
mikeprimm 2011-06-26 12:33:55 -07:00
commit dbbff3d04f
7 changed files with 26 additions and 9 deletions

View File

@ -417,6 +417,10 @@ worlds:
# maximumheight: 127 # maximumheight: 127
# colorscheme: default # colorscheme: default
# Set to true to enable verbose startup messages - can help with debugging map configuration problems
# Set to false for a much quieter startup log
verbose: true
# Enables debugging. # Enables debugging.
#debuggers: #debuggers:
# - class: org.dynmap.debug.LogDebugger # - class: org.dynmap.debug.LogDebugger

View File

@ -78,6 +78,8 @@ public class DynmapPlugin extends JavaPlugin {
bukkitConfiguration.load(); bukkitConfiguration.load();
configuration = new ConfigurationNode(bukkitConfiguration); configuration = new ConfigurationNode(bukkitConfiguration);
Log.verbose = configuration.getBoolean("verbose", true);
loadDebuggers(); loadDebuggers();
tilesDirectory = getFile(configuration.getString("tilespath", "web/tiles")); tilesDirectory = getFile(configuration.getString("tilespath", "web/tiles"));
@ -106,7 +108,7 @@ public class DynmapPlugin extends JavaPlugin {
for(Component component : configuration.<Component>createInstances("components", new Class<?>[] { DynmapPlugin.class }, new Object[] { this })) { for(Component component : configuration.<Component>createInstances("components", new Class<?>[] { DynmapPlugin.class }, new Object[] { this })) {
componentManager.add(component); componentManager.add(component);
} }
Log.info("Loaded " + componentManager.components.size() + " components."); Log.verboseinfo("Loaded " + componentManager.components.size() + " components.");
registerEvents(); registerEvents();
@ -456,9 +458,9 @@ public class DynmapPlugin extends JavaPlugin {
finalConfiguration.extend(templateConfiguration); finalConfiguration.extend(templateConfiguration);
finalConfiguration.extend(worldConfiguration); finalConfiguration.extend(worldConfiguration);
Log.info("Configuration of world " + world.getName()); Log.verboseinfo("Configuration of world " + world.getName());
for(Map.Entry<String, Object> e : finalConfiguration.entrySet()) { for(Map.Entry<String, Object> e : finalConfiguration.entrySet()) {
Log.info(e.getKey() + ": " + e.getValue()); Log.verboseinfo(e.getKey() + ": " + e.getValue());
} }
return finalConfiguration; return finalConfiguration;
@ -467,7 +469,7 @@ public class DynmapPlugin extends JavaPlugin {
private ConfigurationNode getDefaultTemplateConfigurationNode(World world) { private ConfigurationNode getDefaultTemplateConfigurationNode(World world) {
Environment environment = world.getEnvironment(); Environment environment = world.getEnvironment();
String environmentName = environment.name().toLowerCase(); String environmentName = environment.name().toLowerCase();
Log.info("Using environment as template: " + environmentName); Log.verboseinfo("Using environment as template: " + environmentName);
return getTemplateConfigurationNode(environmentName); return getTemplateConfigurationNode(environmentName);
} }

View File

@ -6,9 +6,14 @@ import java.util.logging.Logger;
public class Log { public class Log {
protected static final Logger log = Logger.getLogger("Minecraft"); protected static final Logger log = Logger.getLogger("Minecraft");
protected static final String LOG_PREFIX = "[dynmap] "; protected static final String LOG_PREFIX = "[dynmap] ";
public static boolean verbose = false;
public static void info(String msg) { public static void info(String msg) {
log.log(Level.INFO, LOG_PREFIX + msg); log.log(Level.INFO, LOG_PREFIX + msg);
} }
public static void verboseinfo(String msg) {
if(verbose)
log.log(Level.INFO, LOG_PREFIX + msg);
}
public static void severe(Exception e) { public static void severe(Exception e) {
log.log(Level.SEVERE, LOG_PREFIX + "Exception occured: ", e); log.log(Level.SEVERE, LOG_PREFIX + "Exception occured: ", e);
} }

View File

@ -384,7 +384,7 @@ public class MapManager {
DynmapWorld dynmapWorld = new DynmapWorld(); DynmapWorld dynmapWorld = new DynmapWorld();
dynmapWorld.world = w; dynmapWorld.world = w;
dynmapWorld.configuration = worldConfiguration; dynmapWorld.configuration = worldConfiguration;
Log.info("Loading maps of world '" + worldName + "'..."); Log.verboseinfo("Loading maps of world '" + worldName + "'...");
for(MapType map : worldConfiguration.<MapType>createInstances("maps", new Class<?>[0], new Object[0])) { for(MapType map : worldConfiguration.<MapType>createInstances("maps", new Class<?>[0], new Object[0])) {
map.onTileInvalidated.addListener(invalitateListener); map.onTileInvalidated.addListener(invalitateListener);
dynmapWorld.maps.add(map); dynmapWorld.maps.add(map);

View File

@ -245,7 +245,7 @@ public class HeroChatHandler {
public HeroChatHandler(ConfigurationNode cfg, DynmapPlugin plugin, Server server) { public HeroChatHandler(ConfigurationNode cfg, DynmapPlugin plugin, Server server) {
/* If we're enabling hero chat support */ /* If we're enabling hero chat support */
Log.info("HeroChat support configured"); Log.verboseinfo("HeroChat support configured");
this.plugin = plugin; this.plugin = plugin;
/* Now, get the monitored channel list */ /* Now, get the monitored channel list */
hcchannels = cfg.getStrings("herochatchannels", DEF_CHANNELS); hcchannels = cfg.getStrings("herochatchannels", DEF_CHANNELS);
@ -278,7 +278,7 @@ public class HeroChatHandler {
/* Register event handler */ /* Register event handler */
plugin.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, plugin.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT,
new OurEventListener(), Event.Priority.Monitor, plugin); new OurEventListener(), Event.Priority.Monitor, plugin);
Log.info("HeroChat integration active"); Log.verboseinfo("HeroChat integration active");
} }
/** /**
* Send message from web to appropriate HeroChat channel * Send message from web to appropriate HeroChat channel

View File

@ -62,11 +62,11 @@ public class KzedMap extends MapType {
private static final int CACHE_LIMIT = 10; private static final int CACHE_LIMIT = 10;
public KzedMap(ConfigurationNode configuration) { public KzedMap(ConfigurationNode configuration) {
Log.info("Loading renderers for map '" + getClass().toString() + "'..."); Log.verboseinfo("Loading renderers for map '" + getClass().toString() + "'...");
List<MapTileRenderer> renderers = configuration.<MapTileRenderer>createInstances("renderers", new Class<?>[0], new Object[0]); List<MapTileRenderer> renderers = configuration.<MapTileRenderer>createInstances("renderers", new Class<?>[0], new Object[0]);
this.renderers = new MapTileRenderer[renderers.size()]; this.renderers = new MapTileRenderer[renderers.size()];
renderers.toArray(this.renderers); renderers.toArray(this.renderers);
Log.info("Loaded " + renderers.size() + " renderers for map '" + getClass().toString() + "'."); Log.verboseinfo("Loaded " + renderers.size() + " renderers for map '" + getClass().toString() + "'.");
} }
@Override @Override

View File

@ -1,6 +1,8 @@
name: dynmap name: dynmap
main: org.dynmap.DynmapPlugin main: org.dynmap.DynmapPlugin
version: 0.19 version: 0.19
authors: [FrozenCow, mikeprimm, zeeZ]
softdepend: [Permissions]
commands: commands:
dynmap: dynmap:
description: Controls Dynmap. description: Controls Dynmap.
@ -12,3 +14,7 @@ commands:
/<command> render - Renders the tile at your location. /<command> render - Renders the tile at your location.
/<command> fullrender - (Attempts to) render entire world from your location. /<command> fullrender - (Attempts to) render entire world from your location.
/<command> fullrender world - (Attempts to) render entire world 'world'. /<command> fullrender world - (Attempts to) render entire world 'world'.
/<command> stats - Show render statistics.
/<command> stats world - Show render statistics for maps on world 'world'.
/<command> resetstats - Reset render statistics.
/<command> resetstats world - Reset render statistics for maps on world 'world'.