diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index 6424572ff0..84028e18c0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -147,6 +147,16 @@ public class CraftChunk implements Chunk { return getWorld().unloadChunk(getX(), getZ(), save, safe); } + @Override + public boolean isForceLoaded() { + return getWorld().isChunkForceLoaded(getX(), getZ()); + } + + @Override + public void setForceLoaded(boolean forced) { + getWorld().setChunkForceLoaded(getX(), getZ(), forced); + } + public ChunkSnapshot getChunkSnapshot() { return getChunkSnapshot(true, false, false); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 77019f79dc..200b5c17c1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -2,6 +2,7 @@ package org.bukkit.craftbukkit; import com.google.common.base.Preconditions; import com.google.common.util.concurrent.Futures; +import it.unimi.dsi.fastutil.longs.LongSet; import java.io.File; import java.util.ArrayList; import java.util.Collection; @@ -278,6 +279,27 @@ public class CraftWorld implements World { ((CraftChunk) getChunkAt(chunk.getX(), chunk.getZ())).getHandle().bukkitChunk = chunk; } + @Override + public boolean isChunkForceLoaded(int x, int z) { + return getHandle().isForceLoaded(x, z); + } + + @Override + public void setChunkForceLoaded(int x, int z, boolean forced) { + getHandle().setForceLoaded(x, z, forced); + } + + @Override + public Collection getForceLoadedChunks() { + Set chunks = new HashSet<>(); + + for (long coord : getHandle().ag()) { // PAIL + chunks.add(getChunkAt(ChunkCoordIntPair.a(coord), ChunkCoordIntPair.b(coord))); + } + + return Collections.unmodifiableCollection(chunks); + } + public WorldServer getHandle() { return world; }