Start isolating Bukkit dependencies, prep code for ports

This commit is contained in:
Mike Primm 2012-01-08 01:47:11 -06:00
parent 6cfeee152c
commit 42418edf1f
42 changed files with 331 additions and 337 deletions

View file

@ -6,7 +6,6 @@ import java.util.List;
import org.bukkit.World;
import org.bukkit.Location;
import org.dynmap.MapType.ImageFormat;
import org.dynmap.debug.Debug;
import org.dynmap.utils.DynmapBufferedImage;
import org.dynmap.utils.FileLockManager;
@ -31,7 +30,7 @@ public class DynmapWorld {
public List<MapType> maps = new ArrayList<MapType>();
public UpdateQueue updates = new UpdateQueue();
public ConfigurationNode configuration;
public List<Location> seedloc;
public List<DynmapLocation> seedloc;
public List<MapChunkCache.VisibilityLimit> visibility_limits;
public List<MapChunkCache.VisibilityLimit> hidden_limits;
public AutoGenerateOption do_autogenerate;
@ -460,7 +459,7 @@ public class DynmapWorld {
if(zf.exists()) {
zf.delete();
hashman.updateHashCode(key, null, tilex, tiley, -1);
MapManager.mapman.pushUpdate(this.world, new Client.Tile(zfname));
MapManager.mapman.pushUpdate(this, new Client.Tile(zfname));
enqueueZoomOutUpdate(zf, pd.zoomlevel+1);
}
}
@ -476,7 +475,7 @@ public class DynmapWorld {
Debug.error("Failed to save zoom-out tile (NullPointerException): " + zf.getName(), e);
}
hashman.updateHashCode(key, null, tilex, tiley, crc);
MapManager.mapman.pushUpdate(this.world, new Client.Tile(zfname));
MapManager.mapman.pushUpdate(this, new Client.Tile(zfname));
enqueueZoomOutUpdate(zf, pd.zoomlevel+1);
}
} finally {
@ -484,4 +483,24 @@ public class DynmapWorld {
DynmapBufferedImage.freeBufferedImage(kzIm);
}
}
/* Test if world is nether */
public boolean isNether() {
return world.getEnvironment() == World.Environment.NETHER;
}
/* Get world name */
public String getName() {
return world.getName();
}
/* Get world spawn location */
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 = sloc.getWorld().getName();
return dloc;
}
public int hashCode() {
return world.hashCode();
}
}