Implemented Chunk.getWorld()

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
CraftBukkit/Spigot 2011-01-04 14:17:05 +00:00
parent 21271ef958
commit 596035458a
2 changed files with 14 additions and 2 deletions

View file

@ -2,16 +2,28 @@
package org.bukkit.craftbukkit; package org.bukkit.craftbukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.World;
public class CraftChunk implements Chunk { public class CraftChunk implements Chunk {
private final CraftWorld world;
private final int x; private final int x;
private final int z; 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.x = x;
this.z = z; this.z = z;
} }
/**
* Gets the world containing this chunk
*
* @return World
*/
public World getWorld() {
return world;
}
/** /**
* Gets the X-coordinate of this chunk * Gets the X-coordinate of this chunk
* *

View file

@ -52,7 +52,7 @@ public class CraftWorld implements World {
Chunk chunk = chunkCache.get(loc); Chunk chunk = chunkCache.get(loc);
if (chunk == null) { if (chunk == null) {
chunk = new CraftChunk(x, z); chunk = new CraftChunk(this, x, z);
chunkCache.put(loc, chunk); chunkCache.put(loc, chunk);
} }