Potential fixes

This commit is contained in:
boy0001
2015-09-27 16:43:11 +10:00
parent a93e8fac38
commit 3336d302ac
10 changed files with 42 additions and 46 deletions

View File

@@ -22,15 +22,15 @@ public abstract class BukkitPlotPopulator extends BlockPopulator {
public int X;
public int Z;
public String worldname;
private World world;
private Chunk chunk;
@Override
public void populate(final World world, final Random rand, final Chunk chunk) {
try {
this.world = world;
this.chunk = chunk;
worldname = world.getName();
X = chunk.getX() << 4;
Z = chunk.getZ() << 4;
X = this.chunk.getX() << 4;
Z = this.chunk.getZ() << 4;
if (ChunkManager.FORCE_PASTE) {
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {
@@ -92,7 +92,7 @@ public abstract class BukkitPlotPopulator extends BlockPopulator {
*/
public void setBlock(final int x, final int y, final int z, final byte data) {
if (data != 0) {
world.getBlockAt(X + x, y, Z + z).setData(data);
chunk.getBlock(x, y, z).setData(data);
}
}
@@ -104,7 +104,7 @@ public abstract class BukkitPlotPopulator extends BlockPopulator {
* @param data
*/
public void setBlockAbs(final int x, final int y, final int z, final byte data) {
world.getBlockAt(X + x, y, Z + z).setData(data);
chunk.getBlock(x, y, z).setData(data);
}
/**

View File

@@ -107,7 +107,6 @@ public class HybridPop extends BukkitPlotPopulator {
@Override
public void populate(final World world, final RegionWrapper requiredRegion, final PseudoRandom random, final int cx, final int cz) {
PS.get().getPlotManager(world.getName());
PS.get().getPlotManager(world.getName());
int sx = (short) ((X - plotworld.ROAD_OFFSET_X) % size);
int sz = (short) ((Z - plotworld.ROAD_OFFSET_Z) % size);

View File

@@ -940,8 +940,18 @@ public class BukkitChunkManager extends ChunkManager {
}
@Override
public boolean unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe) {
return BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
public void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe) {
if (!PS.get().isMainThread(Thread.currentThread())) {
TaskManager.runTask(new Runnable() {
@Override
public void run() {
BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
}
});
}
else {
BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
}
}
public static void swapChunk(final World world1, final World world2, final Chunk pos1, final Chunk pos2, final RegionWrapper r1, final RegionWrapper r2) {