mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Fix crashing on chunk load (chunks are still empty though)
This commit is contained in:
parent
568b4c8e85
commit
b35221bf4f
2 changed files with 14 additions and 12 deletions
|
@ -50,8 +50,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||
PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
|
||||
ChunkWrapper wrap = new ChunkWrapper(area.worldname, c.getX(), c.getZ());
|
||||
ScopedLocalBlockQueue chunk = queue.getForChunk(wrap.x, wrap.z);
|
||||
if (BukkitPlotGenerator.this.plotGenerator
|
||||
.populateChunk(chunk, area)) {
|
||||
if (BukkitPlotGenerator.this.plotGenerator.populateChunk(chunk, area)) {
|
||||
queue.flush();
|
||||
}
|
||||
}
|
||||
|
@ -218,15 +217,16 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||
grid.setBiome(x, z, Biome.PLAINS);
|
||||
}
|
||||
}
|
||||
return result.cd;
|
||||
return result.getCd();
|
||||
}
|
||||
}
|
||||
// Set the chunk location
|
||||
result.setChunk(new ChunkWrapper(world.getName(), cx, cz));
|
||||
// Set the result data
|
||||
result.cd = createChunkData(world);
|
||||
result.setCd(createChunkData(world));
|
||||
result.grid = grid;
|
||||
result.result = generateExtBlockSections(world, random, cx, cz, grid);
|
||||
|
||||
// Catch any exceptions (as exceptions usually thrown)
|
||||
try {
|
||||
// Fill the result data if necessary
|
||||
|
@ -239,7 +239,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||
e.printStackTrace();
|
||||
}
|
||||
// Return the result data
|
||||
return result.cd;
|
||||
return result.getCd();
|
||||
}
|
||||
|
||||
public void generate(World world, ScopedLocalBlockQueue result) {
|
||||
|
@ -272,11 +272,11 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||
// Set the result data
|
||||
result.result = new PlotBlock[16][];
|
||||
result.grid = grid;
|
||||
result.cd = null;
|
||||
// Catch any exceptions (as exceptions usually thrown)
|
||||
try {
|
||||
if (this.platformGenerator != this) {
|
||||
final ChunkData chunkData = this.platformGenerator.generateChunkData(world, r, cx, cz, grid);
|
||||
final ChunkData chunkData =
|
||||
this.platformGenerator.generateChunkData(world, r, cx, cz, grid);
|
||||
final PlotBlock[][] blocks = new PlotBlock[world.getMaxHeight() / 16][];
|
||||
// section ID = Y >> 4
|
||||
for (int x = 0; x < 16; x++) {
|
||||
|
@ -285,7 +285,8 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||
if (blocks[y >> 4] == null) {
|
||||
blocks[y >> 4] = new PlotBlock[4096];
|
||||
}
|
||||
blocks[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = PlotBlock.get(chunkData.getType(x, y, z));
|
||||
blocks[y >> 4][((y & 0xF) << 8) | (z << 4) | x] =
|
||||
PlotBlock.get(chunkData.getType(x, y, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.github.intellectualsites.plotsquared.plot.object.Location;
|
|||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
@ -19,13 +21,12 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||
|
||||
public final Biome[] biomes;
|
||||
public PlotBlock[][] result;
|
||||
public ChunkData cd;
|
||||
public BiomeGrid grid;
|
||||
|
||||
public Chunk chunk;
|
||||
public String world;
|
||||
public int cx;
|
||||
public int cz;
|
||||
@Getter @Setter private ChunkData cd = null;
|
||||
|
||||
public GenChunk(Chunk chunk, ChunkWrapper wrap) {
|
||||
super(null, new Location(null, 0, 0, 0), new Location(null, 15, 255, 15));
|
||||
|
@ -66,8 +67,8 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||
}
|
||||
|
||||
@Override public void setCuboid(Location pos1, Location pos2, PlotBlock block) {
|
||||
if (result != null && pos1.getX() == 0 && pos1.getZ() == 0
|
||||
&& pos2.getX() == 15 && pos2.getZ() == 15) {
|
||||
if (result != null && pos1.getX() == 0 && pos1.getZ() == 0 && pos2.getX() == 15
|
||||
&& pos2.getZ() == 15) {
|
||||
for (int y = pos1.getY(); y <= pos2.getY(); y++) {
|
||||
int layer = y >> 4;
|
||||
PlotBlock[] data = result[layer];
|
||||
|
|
Loading…
Reference in a new issue