package org.dynmap.bukkit;
/**
 * Bukkit specific implementation of DynmapWorld
 */
import java.util.List;

import org.bukkit.Location;
import org.bukkit.World;
import org.dynmap.DynmapChunk;
import org.dynmap.DynmapLocation;
import org.dynmap.DynmapWorld;
import org.dynmap.utils.MapChunkCache;

public class BukkitWorld extends DynmapWorld {
    private World world;
    
    public BukkitWorld(World w) {
        super(w.getName(), w.getMaxHeight(), w.getSeaLevel());
        
        world = w;
    }
    /* Test if world is nether */
    @Override
    public boolean isNether() {
        return world.getEnvironment() == World.Environment.NETHER;
    }
    /* Get world spawn location */
    @Override
    public DynmapLocation getSpawnLocation() {
        DynmapLocation dloc = new DynmapLocation();
        Location sloc = world.getSpawnLocation();
        dloc.x = sloc.getBlockX(); dloc.y = sloc.getBlockY();
        dloc.z = sloc.getBlockZ(); dloc.world = normalizeWorldName(sloc.getWorld().getName());
        return dloc;
    }
    /* Get world time */
    @Override
    public long getTime() {
        return world.getTime();
    }
    /* World is storming */
    @Override
    public boolean hasStorm() {
        return world.hasStorm();
    }
    /* World is thundering */
    @Override
    public boolean isThundering() {
        return world.isThundering();
    }
    /* World is loaded */
    @Override
    public boolean isLoaded() {
        return (world != null);
    }
    /* Get light level of block */
    @Override
    public int getLightLevel(int x, int y, int z) {
        return world.getBlockAt(x, y, z).getLightLevel();
    }
    /* Get highest Y coord of given location */
    @Override
    public int getHighestBlockYAt(int x, int z) {
        return world.getHighestBlockYAt(x, z);
    }
    /* Test if sky light level is requestable */
    @Override
    public boolean canGetSkyLightLevel() {
        return true;
    }
    /* Return sky light level */
    @Override
    public int getSkyLightLevel(int x, int y, int z) {
        return world.getBlockAt(x, y, z).getLightFromSky();
    }
    /**
     * Get world environment ID (lower case - normal, the_end, nether)
     */
    @Override
    public String getEnvironment() {
        return world.getEnvironment().name().toLowerCase();
    }
    /**
     * Get map chunk cache for world
     */
    @Override
    public MapChunkCache getChunkCache(List<DynmapChunk> chunks) {
        NewMapChunkCache c = new NewMapChunkCache();
        c.setChunks(this, chunks);
        return c;
    }
    
    public World getWorld() {
        return world;
    }
}

@@ -150,24 +150,115 @@
 kkit.World;%0A
+import org.bukkit.permissions.Permission;%0Aimport org.bukkit.permissions.PermissionDefault;%0A
 import org.d
@@ -276,16 +276,16 @@
 pChunk;%0A
-
 import o
@@ -449,24 +449,53 @@
 orld world;%0A
+    private Permission perm;%0A
     %0A    pub
@@ -588,17 +588,8 @@
 ));%0A
-        %0A
     
@@ -603,16 +603,138 @@
 ld = w;%0A
+        perm = new Permission(%22dynmap.world.%22 + getName(), %22Dynmap access for world %22 + getName(), PermissionDefault.OP);%0A
     %7D%0A  

Declare world permission nodes