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