Optimized fastmode clearing

This commit is contained in:
boy0001 2015-04-26 22:11:18 +10:00
parent e8b5edf50b
commit 6c68f88df9
2 changed files with 57 additions and 50 deletions

View File

@ -289,6 +289,8 @@ public class BukkitChunkManager extends ChunkManager {
final Integer task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
long start = System.currentTimeMillis();
while (System.currentTimeMillis() - start < 20) {
if (chunks.size() == 0) {
TaskManager.runTaskLater(whenDone, 1);
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
@ -348,6 +350,7 @@ public class BukkitChunkManager extends ChunkManager {
}
CURRENT_PLOT_CLEAR = null;
}
}
}, 1, 1);
TaskManager.tasks.put(currentIndex, task);
return true;

View File

@ -151,7 +151,11 @@ public class BukkitUtil extends BlockManager {
}
public static void regenerateChunk(final String world, final int x, final int z) {
getWorld(world).regenerateChunk(x, z);
World worldObj = getWorld(world);
Chunk chunk = worldObj.getChunkAt(x, z);
if (chunk.isLoaded() || chunk.load(false)) {
worldObj.regenerateChunk(x, z);
}
}
public static PlotBlock getBlock(final Location loc) {