closes #673
closes #668
closes #672
closes #664 (hopefully)
This commit is contained in:
Jesse Boyd
2015-10-17 22:50:52 +11:00
parent 50c6753bf4
commit 54655c1a72
11 changed files with 139 additions and 101 deletions

View File

@@ -310,7 +310,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
}
entity.remove();
}
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void PlayerCommand(final PlayerCommandPreprocessEvent event) {

View File

@@ -130,21 +130,22 @@ public class BukkitChunkManager extends ChunkManager {
final World newWorld = Bukkit.getWorld(newPos.getWorld());
final ArrayList<Chunk> chunks = new ArrayList<>();
initMaps();
ChunkManager.chunkTask(pos1, pos2, new RunnableVal<int[]>() {
@Override
public void run() {
initMaps();
final int bx = value[2];
final int bz = value[3];
final int tx = value[4];
final int tz = value[5];
// Load chunks
final ChunkLoc loc1 = new ChunkLoc(value[0], value[1]);
final ChunkLoc loc2 = new ChunkLoc(loc1.x + relCX, loc1.z + relCZ);
final Chunk c1 = oldWorld.getChunkAt(loc1.x, loc1.z);
final Chunk c2 = oldWorld.getChunkAt(loc2.x, loc2.z);
final Chunk c2 = newWorld.getChunkAt(loc2.x, loc2.z);
c1.load(true);
c2.load(true);
chunks.add(c2);
@@ -165,11 +166,11 @@ public class BukkitChunkManager extends ChunkManager {
// restore chunk
restoreBlocks(newWorld, relX, relZ);
restoreEntities(newWorld, relX, relZ);
BukkitSetBlockManager.setBlockManager.update(chunks);
}
}, new Runnable() {
@Override
public void run() {
BukkitSetBlockManager.setBlockManager.update(chunks);
TaskManager.runTask(whenDone);
}
}, 5);
@@ -854,7 +855,8 @@ public class BukkitChunkManager extends ChunkManager {
@Override
public boolean loadChunk(final String world, final ChunkLoc loc, final boolean force) {
return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(force);
boolean result = BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(force);
return result;
}
@Override

View File

@@ -121,11 +121,11 @@ public class SendChunk {
@Override
public void run() {
try {
chunk.unload(true, false);
chunk.unload(true, false);
} catch (final Throwable e) {
final String worldname = chunk.getWorld().getName();
PS.debug("$4Could not save chunk: " + worldname + ";" + chunk.getX() + ";" + chunk.getZ());
PS.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
PS.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
PS.debug("$3 - $4" + worldname + "/level.dat or " + worldname + "/level_old.dat may be corrupt (try repairing or removing these)");
}
}

View File

@@ -94,7 +94,7 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
}, 1);
chunksender = new SendChunk();
}
private ChunkLoc lastLoc = null;
/**
@@ -109,6 +109,18 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
*/
@SuppressWarnings("deprecation")
@Override
public void set(final World world, final int x, final int y, final int z, final int id, final byte data) {
final int X = x >> 4;
final int Z = z >> 4;
final ChunkLoc loc = new ChunkLoc(X, Z);
if (lastLoc == null || loc.x != lastLoc.x || loc.z != lastLoc.z) {
lastLoc = loc;
Chunk chunk = toUpdate.get(loc);
if (chunk == null) {
chunk = world.getChunkAt(X, Z);
toUpdate.put(loc, chunk);
}
chunk.load(true);
}
if (id == -1) {
world.getBlockAt(x, y, z).setData(data, false);
@@ -313,17 +325,7 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
}
}
// End blockstate workaround //
final int X = x >> 4;
final int Z = z >> 4;
final ChunkLoc loc = new ChunkLoc(X, Z);
if (!loc.equals(lastLoc)) {
Chunk chunk = toUpdate.get(loc);
if (chunk == null) {
chunk = world.getChunkAt(X, Z);
toUpdate.put(loc, chunk);
}
chunk.load(false);
// check sign
final Object w = methodGetHandle.of(world).call();