summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEvilSeph <evilseph@gmail.com>2011-07-28 00:32:58 -0400
committerEvilSeph <evilseph@gmail.com>2011-07-28 00:32:58 -0400
commit5b7b46593cbdee284ad27a0360e5bd18b9b360d6 (patch)
tree25bddeec90c283d222c953848698482391f263ac /src
parent226318d8af3a20746230b9e81985e618fabcf915 (diff)
downloadcraftbukkit-5b7b46593cbdee284ad27a0360e5bd18b9b360d6.tar
craftbukkit-5b7b46593cbdee284ad27a0360e5bd18b9b360d6.tar.gz
craftbukkit-5b7b46593cbdee284ad27a0360e5bd18b9b360d6.tar.lz
craftbukkit-5b7b46593cbdee284ad27a0360e5bd18b9b360d6.tar.xz
craftbukkit-5b7b46593cbdee284ad27a0360e5bd18b9b360d6.zip
Added various utility methods to make chunk handling easier. Thanks Meaglin!
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftChunk.java26
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftWorld.java4
2 files changed, 29 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index cf99b8dc..adea00a1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -109,6 +109,30 @@ public class CraftChunk implements Chunk {
return entities;
}
+ public boolean isLoaded() {
+ return getWorld().isChunkLoaded(this);
+ }
+
+ public boolean load() {
+ return getWorld().loadChunk(getX(), getZ(), true);
+ }
+
+ public boolean load(boolean generate) {
+ return getWorld().loadChunk(getX(), getZ(), generate);
+ }
+
+ public boolean unload() {
+ return getWorld().unloadChunk(getX(), getZ());
+ }
+
+ public boolean unload(boolean save) {
+ return getWorld().unloadChunk(getX(), getZ(), save);
+ }
+
+ public boolean unload(boolean save, boolean safe) {
+ return getWorld().unloadChunk(getX(), getZ(), save, safe);
+ }
+
public ChunkSnapshot getChunkSnapshot() {
return getChunkSnapshot(true, false, false);
}
@@ -200,4 +224,4 @@ public class CraftChunk implements Chunk {
}
return new EmptyChunkSnapshot(x, z, world.getName(), world.getFullTime(), biome, biomeTemp, biomeRain);
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 7acb5aa1..74e48d62 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -120,6 +120,10 @@ public class CraftWorld implements World {
loadChunk(x, z, true);
}
+ public boolean unloadChunk(Chunk chunk) {
+ return unloadChunk(chunk.getX(), chunk.getZ());
+ }
+
public boolean unloadChunk(int x, int z) {
return unloadChunk(x, z, true);
}