From 55a5aacfce657fbf95ea7fdad16e27e7ddc7d783 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Sun, 24 Feb 2013 20:24:05 -0600 Subject: [PATCH] Drop autogenerate option --- .../java/org/dynmap/bukkit/DynmapPlugin.java | 1 - .../org/dynmap/bukkit/NewMapChunkCache.java | 22 ++----------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/dynmap/bukkit/DynmapPlugin.java b/src/main/java/org/dynmap/bukkit/DynmapPlugin.java index 5c8f2bfb..268fae2c 100644 --- a/src/main/java/org/dynmap/bukkit/DynmapPlugin.java +++ b/src/main/java/org/dynmap/bukkit/DynmapPlugin.java @@ -433,7 +433,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI { c.setVisibleRange(limit); } c.setHiddenFillStyle(w.hiddenchunkstyle); - c.setAutoGenerateVisbileRanges(w.do_autogenerate); } if(w.hidden_limits != null) { for(VisibilityLimit limit: w.hidden_limits) { diff --git a/src/main/java/org/dynmap/bukkit/NewMapChunkCache.java b/src/main/java/org/dynmap/bukkit/NewMapChunkCache.java index c998507e..2c2f1dd1 100644 --- a/src/main/java/org/dynmap/bukkit/NewMapChunkCache.java +++ b/src/main/java/org/dynmap/bukkit/NewMapChunkCache.java @@ -42,8 +42,6 @@ public class NewMapChunkCache implements MapChunkCache { private HiddenChunkStyle hidestyle = HiddenChunkStyle.FILL_AIR; private List visible_limits = null; private List hidden_limits = null; - private boolean do_generate = false; - private boolean do_save = false; private boolean isempty = true; private ChunkSnapshot[] snaparray; /* Index = (x-x_min) + ((z-z_min)*x_dim) */ private DynIntHashMap[] snaptile; @@ -860,9 +858,6 @@ public class NewMapChunkCache implements MapChunkCache { } } boolean didgenerate = false; - /* If we didn't load, and we're supposed to generate, do it */ - if((!didload) && do_generate && vis) - didgenerate = didload = w.loadChunk(chunk.x, chunk.z, true); /* If it did load, make cache of it */ if(didload) { tileData = new DynIntHashMap(); @@ -942,16 +937,14 @@ public class NewMapChunkCache implements MapChunkCache { chunks_read++; /* It looks like bukkit "leaks" entities - they don't get removed from the world-level table * when chunks are unloaded but not saved - removing them seems to do the trick */ - if(!(didgenerate && do_save)) { - helper.removeEntitiesFromChunk(c); - } + helper.removeEntitiesFromChunk(c); /* Since we only remember ones we loaded, and we're synchronous, no player has * moved, so it must be safe (also prevent chunk leak, which appears to happen * because isChunkInUse defined "in use" as being within 256 blocks of a player, * while the actual in-use chunk area for a player where the chunks are managed * by the MC base server is 21x21 (or about a 160 block radius). * Also, if we did generate it, need to save it */ - w.unloadChunk(chunk.x, chunk.z, didgenerate && do_save, false); + w.unloadChunk(chunk.x, chunk.z, false, false); } else if (isunloadpending) { /* Else, if loaded and unload is pending */ w.unloadChunkRequest(chunk.x, chunk.z); /* Request new unload */ @@ -1037,17 +1030,6 @@ public class NewMapChunkCache implements MapChunkCache { public void setHiddenFillStyle(HiddenChunkStyle style) { this.hidestyle = style; } - /** - * Set autogenerate - must be done after at least one visible range has been set - */ - public void setAutoGenerateVisbileRanges(DynmapWorld.AutoGenerateOption generateopt) { - if((generateopt != DynmapWorld.AutoGenerateOption.NONE) && ((visible_limits == null) || (visible_limits.size() == 0))) { - Log.severe("Cannot setAutoGenerateVisibleRanges() without visible ranges defined"); - return; - } - this.do_generate = (generateopt != DynmapWorld.AutoGenerateOption.NONE); - this.do_save = (generateopt == DynmapWorld.AutoGenerateOption.PERMANENT); - } /** * Add visible area limit - can be called more than once * Needs to be set before chunks are loaded