mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 03:05:28 +01:00
Add workaround for Spigot 1.13.2 bug with loadChunk(x,z,false)
Workaround problem with fact that World.loadChunk(x, z, false) fails when called on existing chunks that have not been migrated to 1.13.x format.
This commit is contained in:
parent
24c62e80ec
commit
12c4df777d
@ -2,6 +2,7 @@ package org.dynmap.bukkit.helper.v113_2;
|
|||||||
|
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.ChunkSnapshot;
|
import org.bukkit.ChunkSnapshot;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.dynmap.bukkit.helper.AbstractMapChunkCache;
|
import org.dynmap.bukkit.helper.AbstractMapChunkCache;
|
||||||
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
||||||
import org.dynmap.renderer.DynmapBlockState;
|
import org.dynmap.renderer.DynmapBlockState;
|
||||||
@ -63,4 +64,25 @@ public class MapChunkCache113_2 extends AbstractMapChunkCache {
|
|||||||
public Snapshot wrapChunkSnapshot(ChunkSnapshot css) {
|
public Snapshot wrapChunkSnapshot(ChunkSnapshot css) {
|
||||||
return new WrappedSnapshot(css);
|
return new WrappedSnapshot(css);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public boolean loadChunkNoGenerate(World w, int x, int z) {
|
||||||
|
boolean rslt = w.loadChunk(x, z, false);
|
||||||
|
// Workaround for Spigot 1.13.2 bug - check if generated and do load-with-generate if so to drive migration of old chunks
|
||||||
|
if (!rslt) {
|
||||||
|
boolean generated = true;
|
||||||
|
// Check one in each direction: see if all are generated
|
||||||
|
for (int xx = x-3; xx <= x+3; xx++) {
|
||||||
|
for (int zz = z-3; zz <= z+3; zz++) {
|
||||||
|
if (w.isChunkGenerated(xx, zz) == false) {
|
||||||
|
generated = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (generated) {
|
||||||
|
rslt = w.loadChunk(x, z, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rslt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -796,7 +796,7 @@ public abstract class AbstractMapChunkCache extends MapChunkCache {
|
|||||||
wasLoaded = true;
|
wasLoaded = true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
didload = w.loadChunk(chunk.x, chunk.z, false);
|
didload = loadChunkNoGenerate(w, chunk.x, chunk.z);
|
||||||
} catch (Throwable t) { /* Catch chunk error from Bukkit */
|
} catch (Throwable t) { /* Catch chunk error from Bukkit */
|
||||||
Log.warning("Bukkit error loading chunk " + chunk.x + "," + chunk.z + " on " + w.getName());
|
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 */
|
if(!wasLoaded) { /* If wasn't loaded, we loaded it if it now is */
|
||||||
@ -1013,6 +1013,10 @@ public abstract class AbstractMapChunkCache extends MapChunkCache {
|
|||||||
return dw;
|
return dw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean loadChunkNoGenerate(World w, int x, int z) {
|
||||||
|
return w.loadChunk(x, z, false);
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Biome[] b = Biome.values();
|
Biome[] b = Biome.values();
|
||||||
BiomeMap[] bm = BiomeMap.values();
|
BiomeMap[] bm = BiomeMap.values();
|
||||||
|
Loading…
Reference in New Issue
Block a user