Workaround explosion in getSnapshot in Bukkit when biome data requested on nether in 1.8 Bukkit

This commit is contained in:
Mike Primm 2011-09-17 13:49:21 +08:00 committed by mikeprimm
parent 7cf9f2f1e4
commit bc17045196

View File

@ -8,6 +8,7 @@ import java.util.ListIterator;
import org.bukkit.World;
import org.bukkit.Chunk;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
import org.bukkit.entity.Entity;
import org.bukkit.ChunkSnapshot;
@ -357,6 +358,9 @@ public class NewMapChunkCache implements MapChunkCache {
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setChunks(World w, List<DynmapChunk> chunks) {
this.w = w;
if(w.getEnvironment() != Environment.NORMAL) {
biome = biomeraw = false;
}
this.chunks = chunks;
if(poppreservedchunk == null) {
/* Get CraftWorld.popPreservedChunk(x,z) - reduces memory bloat from map traversals (optional) */
@ -469,6 +473,7 @@ public class NewMapChunkCache implements MapChunkCache {
iterator = chunks.listIterator();
DynmapPlugin.setIgnoreChunkLoads(true);
boolean isnormral = w.getEnvironment() == Environment.NORMAL;
// Load the required chunks.
while((cnt < max_to_load) && iterator.hasNext()) {
DynmapChunk chunk = iterator.next();
@ -733,8 +738,13 @@ public class NewMapChunkCache implements MapChunkCache {
}
@Override
public boolean setChunkDataTypes(boolean blockdata, boolean biome, boolean highestblocky, boolean rawbiome) {
this.biome = biome;
this.biomeraw = rawbiome;
if((w != null) && (w.getEnvironment() != Environment.NORMAL)) {
this.biome = this.biomeraw = false;
}
else {
this.biome = biome;
this.biomeraw = rawbiome;
}
this.highesty = highestblocky;
this.blockdata = blockdata;
return true;