From 3efe3c3d3d4f67fc705da160170856f3376a828f Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Wed, 8 May 2013 19:35:45 -0500 Subject: [PATCH] Additional check on loaded chunks : avoid getChunkAt rare exception --- .../java/org/dynmap/bukkit/NewMapChunkCache.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/dynmap/bukkit/NewMapChunkCache.java b/src/main/java/org/dynmap/bukkit/NewMapChunkCache.java index 75f13b9f..c5fd1199 100644 --- a/src/main/java/org/dynmap/bukkit/NewMapChunkCache.java +++ b/src/main/java/org/dynmap/bukkit/NewMapChunkCache.java @@ -849,7 +849,6 @@ public class NewMapChunkCache implements MapChunkCache { } chunks_attempted++; boolean wasLoaded = w.isChunkLoaded(chunk.x, chunk.z); - boolean didload = false; boolean isunloadpending = false; if (queue != null) { isunloadpending = helper.isInUnloadQueue(queue, chunk.x, chunk.z); @@ -859,18 +858,12 @@ public class NewMapChunkCache implements MapChunkCache { } try { if (!wasLoaded) { - didload = w.loadChunk(chunk.x, chunk.z, false); - } - else { /* If already was loaded, no need to load */ - didload = true; + w.loadChunk(chunk.x, chunk.z, false); } } catch (Throwable t) { /* Catch chunk error from Bukkit */ Log.warning("Bukkit error loading chunk " + chunk.x + "," + chunk.z + " on " + w.getName()); - if(!wasLoaded) { /* If wasn't loaded, we loaded it if it now is */ - didload = w.isChunkLoaded(chunk.x, chunk.z); - } } - boolean didgenerate = false; + boolean didload = w.isChunkLoaded(chunk.x, chunk.z); /* If it did load, make cache of it */ if(didload) { tileData = new DynIntHashMap(); @@ -905,7 +898,7 @@ public class NewMapChunkCache implements MapChunkCache { } /* Get tile entity data */ List vals = new ArrayList(); - Map tileents = helper.getTileEntitiesForChunk(c); + Map tileents = helper.getTileEntitiesForChunk(c); for(Object t : tileents.values()) { int te_x = helper.getTileEntityX(t); int te_y = helper.getTileEntityY(t);