From a2c944d3c0409568109dfb9ceb1f47f896bf29fd Mon Sep 17 00:00:00 2001 From: Dinnerbone Date: Tue, 4 Jan 2011 14:17:05 +0000 Subject: Implemented Chunk.getWorld() --- src/main/java/org/bukkit/craftbukkit/CraftChunk.java | 14 +++++++++++++- src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/main/java/org/bukkit') diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index 003ee0f4..1d278fc9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -2,16 +2,28 @@ package org.bukkit.craftbukkit; import org.bukkit.Chunk; +import org.bukkit.World; public class CraftChunk implements Chunk { + private final CraftWorld world; private final int x; private final int z; - protected CraftChunk(final int x, final int z) { + protected CraftChunk(final CraftWorld world, final int x, final int z) { + this.world = world; this.x = x; this.z = z; } + /** + * Gets the world containing this chunk + * + * @return World + */ + public World getWorld() { + return world; + } + /** * Gets the X-coordinate of this chunk * diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 31b9d0f0..75dc1b45 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -52,7 +52,7 @@ public class CraftWorld implements World { Chunk chunk = chunkCache.get(loc); if (chunk == null) { - chunk = new CraftChunk(x, z); + chunk = new CraftChunk(this, x, z); chunkCache.put(loc, chunk); } -- cgit v1.2.3