loadChunk will keep chunks loaded forever, so do not use that

This commit is contained in:
Brokkonaut
2019-06-20 05:37:55 +02:00
parent 05d7652bcc
commit 3efd92d9df
2 changed files with 1 additions and 7 deletions

View File

@@ -348,9 +348,6 @@ public class WorldEditor implements Runnable {
return PerformResult.BLACKLISTED;
}
final Block block = loc.getBlock();
if (!world.isChunkLoaded(block.getChunk())) {
world.loadChunk(block.getChunk());
}
if (BukkitUtils.isEmpty(replacedBlock.getMaterial()) && BukkitUtils.isEmpty(block.getType())) {
return PerformResult.NO_ACTION;
}

View File

@@ -589,9 +589,6 @@ public class BukkitUtils {
public static int saveSpawnHeight(Location loc) {
final World world = loc.getWorld();
final Chunk chunk = world.getChunkAt(loc);
if (!world.isChunkLoaded(chunk)) {
world.loadChunk(chunk);
}
final int x = loc.getBlockX(), z = loc.getBlockZ();
int y = loc.getBlockY();
boolean lower = world.getBlockAt(x, y, z).isEmpty(), upper = world.getBlockAt(x, y + 1, z).isEmpty();
@@ -814,7 +811,7 @@ public class BukkitUtils {
int x = i < 3 ? chunkx - 1 : (i < 5 ? chunkx : chunkx + 1);
int z = i == 0 || i == 3 || i == 5 ? chunkz - 1 : (i == 1 || i == 6 ? chunkz : chunkz + 1);
if (!chunk.getWorld().isChunkLoaded(x, z)) {
chunk.getWorld().loadChunk(x, z);
chunk.getWorld().getChunkAt(x, z);
e = Bukkit.getEntity(uuid);
if (e != null) {
return e;