mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Optimized fastmode clearing
This commit is contained in:
parent
e8b5edf50b
commit
6c68f88df9
@ -289,6 +289,8 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
final Integer task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
final Integer task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
while (System.currentTimeMillis() - start < 20) {
|
||||||
if (chunks.size() == 0) {
|
if (chunks.size() == 0) {
|
||||||
TaskManager.runTaskLater(whenDone, 1);
|
TaskManager.runTaskLater(whenDone, 1);
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||||
@ -348,6 +350,7 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
}
|
}
|
||||||
CURRENT_PLOT_CLEAR = null;
|
CURRENT_PLOT_CLEAR = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, 1, 1);
|
}, 1, 1);
|
||||||
TaskManager.tasks.put(currentIndex, task);
|
TaskManager.tasks.put(currentIndex, task);
|
||||||
return true;
|
return true;
|
||||||
|
@ -151,7 +151,11 @@ public class BukkitUtil extends BlockManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void regenerateChunk(final String world, final int x, final int z) {
|
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) {
|
public static PlotBlock getBlock(final Location loc) {
|
||||||
|
Loading…
Reference in New Issue
Block a user