From b937c4bf3842ff1cb35ee50635ddf3c2e3035198 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Sun, 26 Jun 2011 14:31:40 -0500 Subject: [PATCH] Add option to have Dynmap STFU during start (verbose: false) Add softdep, authors, stats commands to plugin.yml --- configuration.txt | 4 ++++ src/main/java/org/dynmap/DynmapPlugin.java | 10 ++++++---- src/main/java/org/dynmap/Log.java | 5 +++++ src/main/java/org/dynmap/MapManager.java | 2 +- src/main/java/org/dynmap/herochat/HeroChatHandler.java | 4 ++-- src/main/java/org/dynmap/kzedmap/KzedMap.java | 4 ++-- src/main/resources/plugin.yml | 6 ++++++ 7 files changed, 26 insertions(+), 9 deletions(-) diff --git a/configuration.txt b/configuration.txt index 806a62e6..6124e527 100644 --- a/configuration.txt +++ b/configuration.txt @@ -417,6 +417,10 @@ worlds: # maximumheight: 127 # 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. #debuggers: # - class: org.dynmap.debug.LogDebugger diff --git a/src/main/java/org/dynmap/DynmapPlugin.java b/src/main/java/org/dynmap/DynmapPlugin.java index e7687ae0..5dde9505 100644 --- a/src/main/java/org/dynmap/DynmapPlugin.java +++ b/src/main/java/org/dynmap/DynmapPlugin.java @@ -78,6 +78,8 @@ public class DynmapPlugin extends JavaPlugin { bukkitConfiguration.load(); configuration = new ConfigurationNode(bukkitConfiguration); + Log.verbose = configuration.getBoolean("verbose", true); + loadDebuggers(); tilesDirectory = getFile(configuration.getString("tilespath", "web/tiles")); @@ -106,7 +108,7 @@ public class DynmapPlugin extends JavaPlugin { for(Component component : configuration.createInstances("components", new Class[] { DynmapPlugin.class }, new Object[] { this })) { componentManager.add(component); } - Log.info("Loaded " + componentManager.components.size() + " components."); + Log.verboseinfo("Loaded " + componentManager.components.size() + " components."); registerEvents(); @@ -456,9 +458,9 @@ public class DynmapPlugin extends JavaPlugin { finalConfiguration.extend(templateConfiguration); finalConfiguration.extend(worldConfiguration); - Log.info("Configuration of world " + world.getName()); + Log.verboseinfo("Configuration of world " + world.getName()); for(Map.Entry e : finalConfiguration.entrySet()) { - Log.info(e.getKey() + ": " + e.getValue()); + Log.verboseinfo(e.getKey() + ": " + e.getValue()); } return finalConfiguration; @@ -467,7 +469,7 @@ public class DynmapPlugin extends JavaPlugin { private ConfigurationNode getDefaultTemplateConfigurationNode(World world) { Environment environment = world.getEnvironment(); String environmentName = environment.name().toLowerCase(); - Log.info("Using environment as template: " + environmentName); + Log.verboseinfo("Using environment as template: " + environmentName); return getTemplateConfigurationNode(environmentName); } diff --git a/src/main/java/org/dynmap/Log.java b/src/main/java/org/dynmap/Log.java index f896bed6..85ffcad9 100644 --- a/src/main/java/org/dynmap/Log.java +++ b/src/main/java/org/dynmap/Log.java @@ -6,9 +6,14 @@ import java.util.logging.Logger; public class Log { protected static final Logger log = Logger.getLogger("Minecraft"); protected static final String LOG_PREFIX = "[dynmap] "; + public static boolean verbose = false; public static void info(String 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) { log.log(Level.SEVERE, LOG_PREFIX + "Exception occured: ", e); } diff --git a/src/main/java/org/dynmap/MapManager.java b/src/main/java/org/dynmap/MapManager.java index cfd0681e..030758ac 100644 --- a/src/main/java/org/dynmap/MapManager.java +++ b/src/main/java/org/dynmap/MapManager.java @@ -384,7 +384,7 @@ public class MapManager { DynmapWorld dynmapWorld = new DynmapWorld(); dynmapWorld.world = w; dynmapWorld.configuration = worldConfiguration; - Log.info("Loading maps of world '" + worldName + "'..."); + Log.verboseinfo("Loading maps of world '" + worldName + "'..."); for(MapType map : worldConfiguration.createInstances("maps", new Class[0], new Object[0])) { map.onTileInvalidated.addListener(invalitateListener); dynmapWorld.maps.add(map); diff --git a/src/main/java/org/dynmap/herochat/HeroChatHandler.java b/src/main/java/org/dynmap/herochat/HeroChatHandler.java index c92ffef1..f3771183 100644 --- a/src/main/java/org/dynmap/herochat/HeroChatHandler.java +++ b/src/main/java/org/dynmap/herochat/HeroChatHandler.java @@ -245,7 +245,7 @@ public class HeroChatHandler { public HeroChatHandler(ConfigurationNode cfg, DynmapPlugin plugin, Server server) { /* If we're enabling hero chat support */ - Log.info("HeroChat support configured"); + Log.verboseinfo("HeroChat support configured"); this.plugin = plugin; /* Now, get the monitored channel list */ hcchannels = cfg.getStrings("herochatchannels", DEF_CHANNELS); @@ -278,7 +278,7 @@ public class HeroChatHandler { /* Register event handler */ plugin.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, new OurEventListener(), Event.Priority.Monitor, plugin); - Log.info("HeroChat integration active"); + Log.verboseinfo("HeroChat integration active"); } /** * Send message from web to appropriate HeroChat channel diff --git a/src/main/java/org/dynmap/kzedmap/KzedMap.java b/src/main/java/org/dynmap/kzedmap/KzedMap.java index 1cd5b6d5..e4858fc6 100644 --- a/src/main/java/org/dynmap/kzedmap/KzedMap.java +++ b/src/main/java/org/dynmap/kzedmap/KzedMap.java @@ -62,11 +62,11 @@ public class KzedMap extends MapType { private static final int CACHE_LIMIT = 10; public KzedMap(ConfigurationNode configuration) { - Log.info("Loading renderers for map '" + getClass().toString() + "'..."); + Log.verboseinfo("Loading renderers for map '" + getClass().toString() + "'..."); List renderers = configuration.createInstances("renderers", new Class[0], new Object[0]); this.renderers = new MapTileRenderer[renderers.size()]; 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 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 631edad0..251a5135 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,8 @@ name: dynmap main: org.dynmap.DynmapPlugin version: 0.19 +authors: [FrozenCow, mikeprimm, zeeZ] +softdepend: [Permissions] commands: dynmap: description: Controls Dynmap. @@ -12,3 +14,7 @@ commands: / render - Renders the tile at your location. / fullrender - (Attempts to) render entire world from your location. / fullrender world - (Attempts to) render entire world 'world'. + / stats - Show render statistics. + / stats world - Show render statistics for maps on world 'world'. + / resetstats - Reset render statistics. + / resetstats world - Reset render statistics for maps on world 'world'.