More cleanup and refactoring - get ready to split out core

This commit is contained in:
Mike Primm 2012-01-15 23:19:01 -06:00
parent 1f6eb62cc1
commit eb35dbe1a6
35 changed files with 352 additions and 216 deletions

View File

@ -3,9 +3,9 @@ package org.dynmap;
import java.io.IOException;
import java.io.Writer;
import org.bukkit.ChatColor;
import org.json.simple.JSONAware;
import org.json.simple.JSONStreamAware;
import org.dynmap.common.DynmapChatColor;
public class Client {
public static class Update implements JSONAware, JSONStreamAware {
@ -33,7 +33,7 @@ public class Client {
public ChatMessage(String source, String channel, String playerName, String message, String playeraccount) {
this.source = source;
this.playerName = Client.stripColor(playerName);
this.message = ChatColor.stripColor(message);
this.message = DynmapChatColor.stripColor(message);
this.account = playeraccount;
this.channel = channel;
}
@ -142,7 +142,7 @@ public class Client {
}
public static String stripColor(String s) {
s = ChatColor.stripColor(s); /* Strip standard color encoding */
s = DynmapChatColor.stripColor(s); /* Strip standard color encoding */
/* Handle Essentials nickname encoding too */
int idx = 0;
while((idx = s.indexOf('&', idx)) >= 0) {

View File

@ -7,8 +7,8 @@ import java.io.InputStream;
import java.util.HashMap;
import java.util.Scanner;
import org.dynmap.common.BiomeMap;
import org.dynmap.debug.Debug;
import org.bukkit.block.Biome;
public class ColorScheme {
private static final HashMap<String, ColorScheme> cache = new HashMap<String, ColorScheme>();
@ -58,7 +58,7 @@ public class ColorScheme {
File colorSchemeFile = new File(getColorSchemeDirectory(core), name + ".txt");
Color[][] colors = new Color[256][];
Color[][][] datacolors = new Color[256][][];
Color[][] biomecolors = new Color[Biome.values().length][];
Color[][] biomecolors = new Color[BiomeMap.values().length][];
Color[][] raincolors = new Color[64][];
Color[][] tempcolors = new Color[64][];
@ -101,7 +101,7 @@ public class ColorScheme {
if(idx >= 0) bio = bio.substring(0, idx);
isbiome = true;
id = -1;
for(Biome b : Biome.values()) {
for(BiomeMap b : BiomeMap.values()) {
if(b.toString().equalsIgnoreCase(bio)) {
id = b.ordinal();
break;

View File

@ -1,5 +1,11 @@
package org.dynmap;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Collection;
@ -8,19 +14,44 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;
import org.yaml.snakeyaml.introspector.Property;
import org.yaml.snakeyaml.nodes.CollectionNode;
import org.yaml.snakeyaml.nodes.MappingNode;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.NodeTuple;
import org.yaml.snakeyaml.nodes.SequenceNode;
import org.yaml.snakeyaml.nodes.Tag;
import org.yaml.snakeyaml.reader.UnicodeReader;
import org.yaml.snakeyaml.representer.Represent;
import org.yaml.snakeyaml.representer.Representer;
public class ConfigurationNode implements Map<String, Object> {
public Map<String, Object> entries;
private File f;
private Yaml yaml;
public ConfigurationNode() {
entries = new HashMap<String, Object>();
}
public ConfigurationNode(org.bukkit.util.config.ConfigurationNode node) {
entries = new HashMap<String, Object>();
for(String key : node.getKeys(null)) {
entries.put(key, node.getProperty(key));
private void initparse() {
if(yaml == null) {
DumperOptions options = new DumperOptions();
options.setIndent(4);
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
yaml = new Yaml(new SafeConstructor(), new EmptyNullRepresenter(), options);
}
}
@SuppressWarnings("unchecked")
public ConfigurationNode(File f) {
this.f = f;
entries = new HashMap<String, Object>();
}
public ConfigurationNode(Map<String, Object> map) {
if (map == null) {
@ -29,6 +60,71 @@ public class ConfigurationNode implements Map<String, Object> {
entries = map;
}
public ConfigurationNode(InputStream in) {
load(in);
}
public boolean load(InputStream in) {
initparse();
Object o = yaml.load(new UnicodeReader(in));
if((o != null) && (o instanceof Map))
entries = (Map<String, Object>)o;
return (entries != null);
}
public boolean load() {
initparse();
FileInputStream fis = null;
try {
fis = new FileInputStream(f);
Object o = yaml.load(new UnicodeReader(fis));
if((o != null) && (o instanceof Map))
entries = (Map<String, Object>)o;
fis.close();
} catch(IOException iox) {
Log.severe("Error reading " + f.getPath());
return false;
} finally {
if(fis != null) {
try { fis.close(); } catch (IOException x) {}
}
}
return (entries != null);
}
public boolean save() {
return save(f);
}
public boolean save(File file) {
initparse();
FileOutputStream stream = null;
File parent = file.getParentFile();
if (parent != null) {
parent.mkdirs();
}
try {
stream = new FileOutputStream(file);
OutputStreamWriter writer = new OutputStreamWriter(stream, "UTF-8");
yaml.dump(entries, writer);
return true;
} catch (IOException e) {
} finally {
try {
if (stream != null) {
stream.close();
}
} catch (IOException e) {}
}
return false;
}
@SuppressWarnings("unchecked")
public Object getObject(String path) {
if (path.isEmpty())
@ -133,6 +229,10 @@ public class ConfigurationNode implements Map<String, Object> {
}
}
}
public List<Map<String,Object>> getMapList(String path) {
return getList(path);
}
public ConfigurationNode getNode(String path) {
Map<String, Object> v = null;
@ -282,4 +382,43 @@ public class ConfigurationNode implements Map<String, Object> {
public Set<java.util.Map.Entry<String, Object>> entrySet() {
return entries.entrySet();
}
private class EmptyNullRepresenter extends Representer {
public EmptyNullRepresenter() {
super();
this.nullRepresenter = new EmptyRepresentNull();
}
protected class EmptyRepresentNull implements Represent {
public Node representData(Object data) {
return representScalar(Tag.NULL, ""); // Changed "null" to "" so as to avoid writing nulls
}
}
// Code borrowed from snakeyaml (http://code.google.com/p/snakeyaml/source/browse/src/test/java/org/yaml/snakeyaml/issues/issue60/SkipBeanTest.java)
@Override
protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) {
NodeTuple tuple = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);
Node valueNode = tuple.getValueNode();
if (valueNode instanceof CollectionNode) {
// Removed null check
if (Tag.SEQ.equals(valueNode.getTag())) {
SequenceNode seq = (SequenceNode) valueNode;
if (seq.getValue().isEmpty()) {
return null; // skip empty lists
}
}
if (Tag.MAP.equals(valueNode.getTag())) {
MappingNode seq = (MappingNode) valueNode;
if (seq.getValue().isEmpty()) {
return null; // skip empty maps
}
}
}
return tuple;
}
// End of borrowed code
}
}

View File

@ -18,7 +18,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.configuration.file.YamlConfiguration;
import org.dynmap.common.DynmapCommandSender;
import org.dynmap.common.DynmapListenerManager;
import org.dynmap.common.DynmapListenerManager.EventType;
@ -37,16 +36,12 @@ import org.dynmap.web.FilterHandler;
import org.dynmap.web.HandlerRouter;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.resource.FileResource;
import org.yaml.snakeyaml.Yaml;
import javax.servlet.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
public class DynmapCore {
private DynmapServerInterface server;
@ -206,9 +201,8 @@ public class DynmapCore {
/* If matches naming convention */
if(tname.endsWith(".txt") && (!tname.startsWith(CUSTOM_PREFIX))) {
File tf = new File(templatedir, tname);
org.bukkit.util.config.Configuration cfg = new org.bukkit.util.config.Configuration(tf);
cfg.load();
ConfigurationNode cn = new ConfigurationNode(cfg);
ConfigurationNode cn = new ConfigurationNode(tf);
cn.load();
/* Supplement existing values (don't replace), since configuration.txt is more custom than these */
mergeConfigurationBranch(cn, "templates", false, false);
}
@ -218,9 +212,8 @@ public class DynmapCore {
/* If matches naming convention */
if(tname.endsWith(".txt") && tname.startsWith(CUSTOM_PREFIX)) {
File tf = new File(templatedir, tname);
org.bukkit.util.config.Configuration cfg = new org.bukkit.util.config.Configuration(tf);
cfg.load();
ConfigurationNode cn = new ConfigurationNode(cfg);
ConfigurationNode cn = new ConfigurationNode(tf);
cn.load();
/* This are overrides - replace even configuration.txt content */
mergeConfigurationBranch(cn, "templates", true, false);
}
@ -241,9 +234,8 @@ public class DynmapCore {
}
/* Load configuration.txt */
org.bukkit.util.config.Configuration bukkitConfiguration = new org.bukkit.util.config.Configuration(f);
bukkitConfiguration.load();
configuration = new ConfigurationNode(bukkitConfiguration);
configuration = new ConfigurationNode(f);
configuration.load();
/* Add options to avoid 0.29 re-render (fixes very inconsistent with previous maps) */
HDMapManager.usegeneratedtextures = configuration.getBoolean("use-generated-textures", false);
@ -260,9 +252,8 @@ public class DynmapCore {
if(!createDefaultFileFromResource("/worlds.txt", f)) {
return false;
}
org.bukkit.util.config.Configuration cfg = new org.bukkit.util.config.Configuration(f);
cfg.load();
ConfigurationNode cn = new ConfigurationNode(cfg);
ConfigurationNode cn = new ConfigurationNode(f);
cn.load();
mergeConfigurationBranch(cn, "worlds", true, true);
/* Now, process templates */
@ -419,7 +410,9 @@ public class DynmapCore {
public void loadWebserver() {
webServer = new Server(new InetSocketAddress(configuration.getString("webserver-bindaddress", "0.0.0.0"), configuration.getInteger("webserver-port", 8123)));
webServer.setStopAtShutdown(true);
webServer.setGracefulShutdown(1000);
final boolean allow_symlinks = configuration.getBoolean("allow-symlinks", false);
int maxconnections = configuration.getInteger("max-sessions", 30);
if(maxconnections < 2) maxconnections = 2;
@ -498,6 +491,8 @@ public class DynmapCore {
if (webServer != null) {
try {
webServer.stop();
while(webServer.isStopping())
Thread.sleep(100);
} catch (Exception e) {
Log.severe("Failed to stop WebServer!", e);
}
@ -994,9 +989,10 @@ public class DynmapCore {
return createDefaultFileFromResource(resourcename, deffile);
}
/* Load default from resource */
YamlConfiguration def_fc = YamlConfiguration.loadConfiguration(in);
ConfigurationNode def_fc = new ConfigurationNode(in);
/* Load existing from file */
YamlConfiguration fc = YamlConfiguration.loadConfiguration(deffile);
ConfigurationNode fc = new ConfigurationNode(deffile);
fc.load();
/* Now, get the list associated with the base node default */
List<Map<String,Object>> existing = fc.getMapList(basenode);
Set<String> existing_names = new HashSet<String>();
@ -1025,13 +1021,8 @@ public class DynmapCore {
}
/* If we did update, save existing */
if(did_update) {
try {
fc.set(basenode, existing);
fc.save(deffile);
} catch (IOException iox) {
Log.severe("Error saving migrated file - " + deffile.getPath());
return false;
}
fc.put(basenode, existing);
fc.save(deffile);
Log.info("Updated file " + deffile.getPath());
}
return true;
@ -1118,13 +1109,12 @@ public class DynmapCore {
File f = new File(getDataFolder(), "ids-by-ip.txt");
if(f.exists() == false)
return;
YamlConfiguration fc = new YamlConfiguration();
ConfigurationNode fc = new ConfigurationNode(new File(getDataFolder(), "ids-by-ip.txt"));
try {
fc.load(new File(getDataFolder(), "ids-by-ip.txt"));
fc.load();
ids_by_ip.clear();
Map<String,Object> v = fc.getValues(false);
for(String k : v.keySet()) {
List<String> ids = fc.getStringList(k);
for(String k : fc.keySet()) {
List<String> ids = fc.getList(k);
if(ids != null) {
k = k.replace("_", ".");
ids_by_ip.put(k, new LinkedList<String>(ids));
@ -1136,12 +1126,12 @@ public class DynmapCore {
}
private void saveIDsByIP() {
File f = new File(getDataFolder(), "ids-by-ip.txt");
YamlConfiguration fc = new YamlConfiguration();
ConfigurationNode fc = new ConfigurationNode();
for(String k : ids_by_ip.keySet()) {
List<String> v = ids_by_ip.get(k);
if(v != null) {
k = k.replace(".", "_");
fc.set(k, v);
fc.put(k, v);
}
}
try {

View File

@ -1,36 +0,0 @@
package org.dynmap;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerQuitEvent;
public class DynmapPlayerChatListener extends PlayerListener {
DynmapCore plugin;
public DynmapPlayerChatListener(DynmapCore plugin) {
this.plugin = plugin;
}
@Override
public void onPlayerChat(PlayerChatEvent event) {
if(event.isCancelled()) return;
if(plugin.mapManager != null)
plugin.mapManager.pushUpdate(new Client.ChatMessage("player", "",
event.getPlayer().getDisplayName(), event.getMessage(),
event.getPlayer().getName()));
}
@Override
public void onPlayerJoin(PlayerJoinEvent event) {
if(plugin.mapManager != null)
plugin.mapManager.pushUpdate(new Client.PlayerJoinMessage(event.getPlayer().getDisplayName(), event.getPlayer().getName()));
}
@Override
public void onPlayerQuit(PlayerQuitEvent event) {
if(plugin.mapManager != null)
plugin.mapManager.pushUpdate(new Client.PlayerQuitMessage(event.getPlayer().getDisplayName(), event.getPlayer().getName()));
}
}

View File

@ -1,16 +1,10 @@
package org.dynmap;
import static org.dynmap.JSONUtils.s;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.World;
import org.bukkit.Location;
import org.dynmap.bukkit.NewMapChunkCache;
import org.dynmap.debug.Debug;
import org.dynmap.utils.BlockLightLevel;
import org.dynmap.utils.DynmapBufferedImage;
import org.dynmap.utils.FileLockManager;
import org.dynmap.utils.MapChunkCache;

View File

@ -24,12 +24,12 @@ import java.util.concurrent.atomic.AtomicLong;
import org.dynmap.DynmapCore.CompassMode;
import org.dynmap.DynmapWorld.AutoGenerateOption;
import org.dynmap.bukkit.SnapshotCache;
import org.dynmap.common.DynmapCommandSender;
import org.dynmap.common.DynmapPlayer;
import org.dynmap.debug.Debug;
import org.dynmap.hdmap.HDMapManager;
import org.dynmap.utils.MapChunkCache;
import org.dynmap.utils.SnapshotCache;
import org.dynmap.utils.TileFlags;
public class MapManager {
@ -51,6 +51,8 @@ public class MapManager {
private boolean pauseupdaterenders = false;
private boolean pausefullrenders = false;
private boolean did_start = false;
private int zoomout_period = DEFAULT_ZOOMOUT_PERIOD; /* Zoom-out tile processing period, in seconds */
/* Which fullrenders are active */
private HashMap<String, FullWorldRenderState> active_renders = new HashMap<String, FullWorldRenderState>();
@ -975,9 +977,8 @@ public class MapManager {
String wname = w.getName();
File f = new File(core.getDataFolder(), wname + ".pending");
if(f.exists()) {
org.bukkit.util.config.Configuration saved = new org.bukkit.util.config.Configuration(f);
saved.load();
ConfigurationNode cn = new ConfigurationNode(saved);
ConfigurationNode cn = new ConfigurationNode(f);
cn.load();
/* Get the saved tile definitions */
List<ConfigurationNode> tiles = cn.getNodes("tiles");
if(tiles != null) {
@ -998,6 +999,9 @@ public class MapManager {
try {
FullWorldRenderState j = new FullWorldRenderState(job);
active_renders.put(wname, j);
if(did_start) /* Past initial start */
scheduleDelayedJob(j, 5000);
} catch (Exception x) {
Log.info("Unable to restore render job for world '" + wname + "' - map configuration changed");
}
@ -1012,7 +1016,7 @@ public class MapManager {
for(DynmapWorld w : worlds) {
boolean dosave = false;
File f = new File(core.getDataFolder(), w.getName() + ".pending");
org.bukkit.util.config.Configuration saved = new org.bukkit.util.config.Configuration(f);
ConfigurationNode saved = new ConfigurationNode();
ArrayList<ConfigurationNode> savedtiles = new ArrayList<ConfigurationNode>();
for(MapTile tile : mt) {
if(tile.getDynmapWorld() != w) continue;
@ -1022,18 +1026,18 @@ public class MapManager {
}
}
if(savedtiles.size() > 0) { /* Something to save? */
saved.setProperty("tiles", savedtiles);
saved.put("tiles", savedtiles);
dosave = true;
Log.info("Saved " + savedtiles.size() + " pending tile renders in world '" + w.getName());
}
FullWorldRenderState job = active_renders.get(w.getName());
if(job != null) {
saved.setProperty("job", job.saveState());
saved.put("job", job.saveState());
dosave = true;
Log.info("Saved active render job in world '" + w.getName());
}
if(dosave) {
saved.save();
saved.save(f);
Log.info("Saved " + savedtiles.size() + " pending tile renders in world '" + w.getName());
}
}
@ -1091,6 +1095,7 @@ public class MapManager {
scheduleDelayedJob(job, 5000);
Log.info("Resumed render starting on world '" + job.world.getName() + "'...");
}
did_start = true;
}
public void stopRendering() {
@ -1112,6 +1117,7 @@ public class MapManager {
sscache.cleanup();
sscache = null;
}
did_start = false;
}
public File getTileFile(MapTile tile) {

View File

@ -2,10 +2,6 @@ package org.dynmap;
import static org.dynmap.JSONUtils.s;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.dynmap.common.DynmapListenerManager;
import org.dynmap.common.DynmapListenerManager.ChatEventListener;
import org.dynmap.common.DynmapListenerManager.EventType;

View File

@ -1,4 +1,4 @@
package org.dynmap.utils;
package org.dynmap.bukkit;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

View File

@ -9,7 +9,6 @@ import org.bukkit.World;
import org.dynmap.DynmapChunk;
import org.dynmap.DynmapLocation;
import org.dynmap.DynmapWorld;
import org.dynmap.utils.BlockLightLevel;
import org.dynmap.utils.MapChunkCache;
public class BukkitWorld extends DynmapWorld {
@ -88,7 +87,11 @@ public class BukkitWorld extends DynmapWorld {
@Override
public MapChunkCache getChunkCache(List<DynmapChunk> chunks) {
MapChunkCache c = new NewMapChunkCache();
c.setChunks(world, chunks);
c.setChunks(this, chunks);
return c;
}
public World getWorld() {
return world;
}
}

View File

@ -57,15 +57,16 @@ import org.dynmap.DynmapWebChatEvent;
import org.dynmap.DynmapWorld;
import org.dynmap.Log;
import org.dynmap.MapManager;
import org.dynmap.bukkit.permissions.BukkitPermissions;
import org.dynmap.bukkit.permissions.NijikokunPermissions;
import org.dynmap.bukkit.permissions.OpPermissions;
import org.dynmap.bukkit.permissions.PermissionProvider;
import org.dynmap.common.BiomeMap;
import org.dynmap.common.DynmapCommandSender;
import org.dynmap.common.DynmapPlayer;
import org.dynmap.common.DynmapServerInterface;
import org.dynmap.common.DynmapListenerManager.EventType;
import org.dynmap.markers.MarkerAPI;
import org.dynmap.permissions.BukkitPermissions;
import org.dynmap.permissions.NijikokunPermissions;
import org.dynmap.permissions.OpPermissions;
import org.dynmap.permissions.PermissionProvider;
public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
private DynmapCore core;
@ -217,6 +218,15 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public void broadcastMessage(String msg) {
getServer().broadcastMessage(msg);
}
@Override
public String[] getBiomeIDs() {
BiomeMap[] b = BiomeMap.values();
String[] bname = new String[b.length];
for(int i = 0; i < bname.length; i++)
bname[i] = b[i].toString();
return bname;
}
}
/**
* Player access abstraction class

View File

@ -18,10 +18,9 @@ import org.dynmap.DynmapCore;
import org.dynmap.DynmapWorld;
import org.dynmap.Log;
import org.dynmap.MapManager;
import org.dynmap.common.BiomeMap;
import org.dynmap.utils.MapChunkCache;
import org.dynmap.utils.MapIterator;
import org.dynmap.utils.MapChunkCache.HiddenChunkStyle;
import org.dynmap.utils.MapChunkCache.VisibilityLimit;
import org.dynmap.utils.MapIterator.BlockStep;
/**
@ -41,6 +40,7 @@ public class NewMapChunkCache implements MapChunkCache {
private static final int MAX_TICKLIST = 20000;
private World w;
private DynmapWorld dw;
private Object craftworld;
private List<DynmapChunk> chunks;
private ListIterator<DynmapChunk> iterator;
@ -54,7 +54,7 @@ public class NewMapChunkCache implements MapChunkCache {
private boolean do_save = false;
private boolean isempty = true;
private ChunkSnapshot[] snaparray; /* Index = (x-x_min) + ((z-z_min)*x_dim) */
private Biome[][] snapbiomes; /* Biome cache - getBiome() is expensive */
private BiomeMap[][] snapbiomes; /* Biome cache - getBiome() is expensive */
private TreeSet<?> ourticklist;
private int chunks_read; /* Number of chunks actually loaded */
@ -66,6 +66,8 @@ public class NewMapChunkCache implements MapChunkCache {
private static final BlockStep unstep[] = { BlockStep.X_MINUS, BlockStep.Y_MINUS, BlockStep.Z_MINUS,
BlockStep.X_PLUS, BlockStep.Y_PLUS, BlockStep.Z_PLUS };
private static BiomeMap[] biome_to_bmap;
/**
* Iterator for traversing map chunk cache (base is for non-snapshot)
*/
@ -114,15 +116,17 @@ public class NewMapChunkCache implements MapChunkCache {
public final int getBlockEmittedLight() {
return snap.getBlockEmittedLight(bx, y, bz);
}
public final Biome getBiome() {
Biome[] b = snapbiomes[chunkindex];
public final BiomeMap getBiome() {
BiomeMap[] b = snapbiomes[chunkindex];
if(b == null) {
b = snapbiomes[chunkindex] = new Biome[256];
b = snapbiomes[chunkindex] = new BiomeMap[256];
}
int off = bx + (bz << 4);
Biome bio = b[off];
BiomeMap bio = b[off];
if(bio == null) {
bio = b[off] = snap.getBiome(bx, bz);
Biome bb = snap.getBiome(bx, bz);
if(bb != null)
bio = b[off] = biome_to_bmap[bb.ordinal()];
}
return bio;
}
@ -403,8 +407,9 @@ public class NewMapChunkCache implements MapChunkCache {
}
}
@SuppressWarnings({ "rawtypes" })
public void setChunks(World w, List<DynmapChunk> chunks) {
this.w = w;
public void setChunks(DynmapWorld dw, List<DynmapChunk> chunks) {
this.dw = dw;
this.w = ((BukkitWorld)dw).getWorld();
if((getworldhandle != null) && (craftworld == null)) {
try {
craftworld = getworldhandle.invoke(w); /* World.getHandle() */
@ -439,7 +444,7 @@ public class NewMapChunkCache implements MapChunkCache {
}
snaparray = new ChunkSnapshot[x_dim * (z_max-z_min+1)];
snapbiomes = new Biome[x_dim * (z_max-z_min+1)][];
snapbiomes = new BiomeMap[x_dim * (z_max-z_min+1)][];
}
public int loadChunks(int max_to_load) {
@ -634,9 +639,10 @@ public class NewMapChunkCache implements MapChunkCache {
ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim];
return ss.getBlockEmittedLight(x & 0xF, y, z & 0xF);
}
public Biome getBiome(int x, int z) {
public BiomeMap getBiome(int x, int z) {
ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim];
return ss.getBiome(x & 0xF, z & 0xF);
Biome b = ss.getBiome(x & 0xF, z & 0xF);
return (b != null)?biome_to_bmap[b.ordinal()]:null;
}
public double getRawBiomeTemperature(int x, int z) {
ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim];
@ -727,8 +733,8 @@ public class NewMapChunkCache implements MapChunkCache {
return true;
}
@Override
public World getWorld() {
return w;
public DynmapWorld getWorld() {
return dw;
}
@Override
public int getChunksLoaded() {
@ -767,4 +773,31 @@ public class NewMapChunkCache implements MapChunkCache {
}
return isok;
}
static {
Biome[] b = Biome.values();
biome_to_bmap = new BiomeMap[b.length];
biome_to_bmap[Biome.RAINFOREST.ordinal()] = BiomeMap.RAINFOREST;
biome_to_bmap[Biome.SWAMPLAND.ordinal()] = BiomeMap.SWAMPLAND;
biome_to_bmap[Biome.SEASONAL_FOREST.ordinal()] = BiomeMap.SEASONAL_FOREST;
biome_to_bmap[Biome.FOREST.ordinal()] = BiomeMap.FOREST;
biome_to_bmap[Biome.SAVANNA.ordinal()] = BiomeMap.SAVANNA;
biome_to_bmap[Biome.SHRUBLAND.ordinal()] = BiomeMap.SHRUBLAND;
biome_to_bmap[Biome.TAIGA.ordinal()] = BiomeMap.TAIGA;
biome_to_bmap[Biome.DESERT.ordinal()] = BiomeMap.DESERT;
biome_to_bmap[Biome.PLAINS.ordinal()] = BiomeMap.PLAINS;
biome_to_bmap[Biome.ICE_DESERT.ordinal()] = BiomeMap.ICE_DESERT;
biome_to_bmap[Biome.TUNDRA.ordinal()] = BiomeMap.TUNDRA;
biome_to_bmap[Biome.HELL.ordinal()] = BiomeMap.HELL;
biome_to_bmap[Biome.SKY.ordinal()] = BiomeMap.SKY;
biome_to_bmap[Biome.OCEAN.ordinal()] = BiomeMap.OCEAN;
biome_to_bmap[Biome.RIVER.ordinal()] = BiomeMap.RIVER;
biome_to_bmap[Biome.EXTREME_HILLS.ordinal()] = BiomeMap.EXTREME_HILLS;
biome_to_bmap[Biome.FROZEN_OCEAN.ordinal()] = BiomeMap.FROZEN_OCEAN;
biome_to_bmap[Biome.FROZEN_RIVER.ordinal()] = BiomeMap.FROZEN_RIVER;
biome_to_bmap[Biome.ICE_PLAINS.ordinal()] = BiomeMap.ICE_PLAINS;
biome_to_bmap[Biome.ICE_MOUNTAINS.ordinal()] = BiomeMap.ICE_MOUNTAINS;
biome_to_bmap[Biome.MUSHROOM_ISLAND.ordinal()] = BiomeMap.MUSHROOM_ISLAND;
biome_to_bmap[Biome.MUSHROOM_SHORE.ordinal()] = BiomeMap.MUSHROOM_SHORE;
}
}

View File

@ -1,4 +1,4 @@
package org.dynmap.utils;
package org.dynmap.bukkit;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;

View File

@ -1,4 +1,4 @@
package org.dynmap.permissions;
package org.dynmap.bukkit.permissions;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -1,4 +1,4 @@
package org.dynmap.permissions;
package org.dynmap.bukkit.permissions;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;

View File

@ -1,4 +1,4 @@
package org.dynmap.permissions;
package org.dynmap.bukkit.permissions;
import java.util.HashSet;

View File

@ -1,4 +1,4 @@
package org.dynmap.permissions;
package org.dynmap.bukkit.permissions;
import org.bukkit.command.CommandSender;

View File

@ -0,0 +1,27 @@
package org.dynmap.common;
/* Generic biome mapping */
public enum BiomeMap {
RAINFOREST,
SWAMPLAND,
SEASONAL_FOREST,
FOREST,
SAVANNA,
SHRUBLAND,
TAIGA,
DESERT,
PLAINS,
ICE_DESERT,
TUNDRA,
HELL,
SKY,
OCEAN,
RIVER,
EXTREME_HILLS,
FROZEN_OCEAN,
FROZEN_RIVER,
ICE_PLAINS,
ICE_MOUNTAINS,
MUSHROOM_ISLAND,
MUSHROOM_SHORE
}

View File

@ -1,9 +1,5 @@
package org.dynmap.common;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.ChatColor;
public enum DynmapChatColor {
BLACK(0x0),
@ -34,4 +30,10 @@ public enum DynmapChatColor {
public String toString() {
return str;
}
public static String stripColor(final String input) {
if (input == null) {
return null;
}
return input.replaceAll("(?i)\u00A7[0-9A-F]", "");
}
}

View File

@ -2,7 +2,6 @@ package org.dynmap.common;
import java.net.InetSocketAddress;
import org.bukkit.Location;
import org.dynmap.DynmapLocation;
/**

View File

@ -72,4 +72,8 @@ public interface DynmapServerInterface {
* @param msg
*/
public void broadcastMessage(String msg);
/**
* Get Biome ID list
*/
public String[] getBiomeIDs();
}

View File

@ -1,11 +1,11 @@
package org.dynmap.debug;
import org.bukkit.plugin.java.JavaPlugin;
import org.dynmap.ConfigurationNode;
import org.dynmap.DynmapCore;
import org.dynmap.Log;
public class LogDebugger implements Debugger {
public LogDebugger(JavaPlugin plugin, ConfigurationNode configuration) {
public LogDebugger(DynmapCore core, ConfigurationNode configuration) {
}
@Override

View File

@ -1,12 +1,12 @@
package org.dynmap.debug;
import org.bukkit.plugin.java.JavaPlugin;
import org.dynmap.ConfigurationNode;
import org.dynmap.DynmapCore;
public class NullDebugger implements Debugger {
public static final NullDebugger instance = new NullDebugger(null, null);
public NullDebugger(JavaPlugin plugin, ConfigurationNode configuration) {
public NullDebugger(DynmapCore core, ConfigurationNode configuration) {
}
public void debug(String message) {

View File

@ -1,11 +1,11 @@
package org.dynmap.hdmap;
import static org.dynmap.JSONUtils.s;
import org.bukkit.block.Biome;
import org.dynmap.Color;
import org.dynmap.ColorScheme;
import org.dynmap.ConfigurationNode;
import org.dynmap.DynmapCore;
import org.dynmap.common.BiomeMap;
import org.dynmap.utils.MapChunkCache;
import org.dynmap.utils.MapIterator;
import org.json.simple.JSONObject;
@ -225,7 +225,7 @@ public class DefaultHDShader implements HDShader {
super(mapiter, map);
}
protected Color[] getBlockColors(int blocktype, int blockdata) {
Biome bio = mapiter.getBiome();
BiomeMap bio = mapiter.getBiome();
if(bio != null)
return colorScheme.biomecolors[bio.ordinal()];
return null;

View File

@ -11,7 +11,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.Material;
import org.dynmap.ConfigurationNode;
import org.dynmap.Log;
@ -43,26 +42,6 @@ public class HDBlockModels {
private static HashMap<Integer, HDScaledBlockModels> scaled_models_by_scale = new HashMap<Integer, HDScaledBlockModels>();
/**
* Block definition - copy from other
*/
public HDBlockModels(Material blocktype, int databits, HDBlockModels m) {
this.blockid = blocktype.getId();
this.databits = databits;
this.nativeres = m.nativeres;
this.blockflags = m.blockflags;
}
/**
* Block definition - positions correspond to Bukkit coordinates (+X is south, +Y is up, +Z is west)
* @param blockid - block ID
* @param databits - bitmap of block data bits matching this model (bit N is set if data=N would match)
* @param nativeres - native subblocks per edge of cube (up to 64)
* @param blockflags - array of native^2 long integers representing volume of block (bit X of element (nativeres*Y+Z) is set if that subblock is filled)
* if array is short, other elements area are assumed to be zero (fills from bottom of block up)
*/
public HDBlockModels(Material blocktype, int databits, int nativeres, long[] blockflags) {
this(blocktype.getId(), databits, nativeres, blockflags);
}
/**
* Block definition - positions correspond to Bukkit coordinates (+X is south, +Y is up, +Z is west)
* @param blockid - block ID

View File

@ -32,10 +32,9 @@ public class HDMapManager {
if(!core.updateUsingDefaultResource("/shaders.txt", f, "shaders")) {
return;
}
org.bukkit.util.config.Configuration bukkitShaderConfig = new org.bukkit.util.config.Configuration(f);
bukkitShaderConfig.load();
ConfigurationNode shadercfg = new ConfigurationNode(bukkitShaderConfig);
ConfigurationNode shadercfg = new ConfigurationNode(f);
shadercfg.load();
for(HDShader shader : shadercfg.<HDShader>createInstances("shaders", new Class<?>[] { DynmapCore.class }, new Object[] { core })) {
if(shader.getName() == null) continue;
shaders.put(shader.getName(), shader);
@ -44,9 +43,8 @@ public class HDMapManager {
f = new File(core.getDataFolder(), "custom-shaders.txt");
core.createDefaultFileFromResource("/custom-shaders.txt", f);
if(f.exists()) {
bukkitShaderConfig = new org.bukkit.util.config.Configuration(f);
bukkitShaderConfig.load();
ConfigurationNode customshadercfg = new ConfigurationNode(bukkitShaderConfig);
ConfigurationNode customshadercfg = new ConfigurationNode(f);
customshadercfg.load();
for(HDShader shader : customshadercfg.<HDShader>createInstances("shaders", new Class<?>[] { DynmapCore.class }, new Object[] { core })) {
if(shader.getName() == null) continue;
shaders.put(shader.getName(), shader);
@ -63,9 +61,8 @@ public class HDMapManager {
if(!core.updateUsingDefaultResource("/perspectives.txt", f, "perspectives")) {
return;
}
org.bukkit.util.config.Configuration bukkitPerspectiveConfig = new org.bukkit.util.config.Configuration(f);
bukkitPerspectiveConfig.load();
ConfigurationNode perspectivecfg = new ConfigurationNode(bukkitPerspectiveConfig);
ConfigurationNode perspectivecfg = new ConfigurationNode(f);
perspectivecfg.load();
for(HDPerspective perspective : perspectivecfg.<HDPerspective>createInstances("perspectives", new Class<?>[] { DynmapCore.class }, new Object[] { core })) {
if(perspective.getName() == null) continue;
perspectives.put(perspective.getName(), perspective);
@ -74,9 +71,8 @@ public class HDMapManager {
f = new File(core.getDataFolder(), "custom-perspectives.txt");
core.createDefaultFileFromResource("/custom-perspectives.txt", f);
if(f.exists()) {
bukkitPerspectiveConfig = new org.bukkit.util.config.Configuration(f);
bukkitPerspectiveConfig.load();
perspectivecfg = new ConfigurationNode(bukkitPerspectiveConfig);
perspectivecfg = new ConfigurationNode(f);
perspectivecfg.load();
for(HDPerspective perspective : perspectivecfg.<HDPerspective>createInstances("perspectives", new Class<?>[] { DynmapCore.class }, new Object[] { core })) {
if(perspective.getName() == null) continue;
perspectives.put(perspective.getName(), perspective);
@ -91,9 +87,8 @@ public class HDMapManager {
if(!core.updateUsingDefaultResource("/lightings.txt", f, "lightings")) {
return;
}
org.bukkit.util.config.Configuration bukkitLightingsConfig = new org.bukkit.util.config.Configuration(f);
bukkitLightingsConfig.load();
ConfigurationNode lightingcfg = new ConfigurationNode(bukkitLightingsConfig);
ConfigurationNode lightingcfg = new ConfigurationNode(f);
lightingcfg.load();
for(HDLighting lighting : lightingcfg.<HDLighting>createInstances("lightings", new Class<?>[] { DynmapCore.class }, new Object[] { core })) {
if(lighting.getName() == null) continue;
@ -103,9 +98,8 @@ public class HDMapManager {
f = new File(core.getDataFolder(), "custom-lightings.txt");
core.createDefaultFileFromResource("/custom-lightings.txt", f);
if(f.exists()) {
bukkitLightingsConfig = new org.bukkit.util.config.Configuration(f);
bukkitLightingsConfig.load();
lightingcfg = new ConfigurationNode(bukkitLightingsConfig);
lightingcfg = new ConfigurationNode(f);
lightingcfg.load();
for(HDLighting lighting : lightingcfg.<HDLighting>createInstances("lightings", new Class<?>[] { DynmapCore.class }, new Object[] { core })) {
if(lighting.getName() == null) continue;
lightings.put(lighting.getName(), lighting);

View File

@ -19,12 +19,12 @@ import java.util.zip.ZipFile;
import javax.imageio.ImageIO;
import org.bukkit.block.Biome;
import org.dynmap.Color;
import org.dynmap.ConfigurationNode;
import org.dynmap.DynmapCore;
import org.dynmap.Log;
import org.dynmap.MapManager;
import org.dynmap.common.BiomeMap;
import org.dynmap.utils.DynmapBufferedImage;
import org.dynmap.utils.MapIterator.BlockStep;
import org.dynmap.utils.MapIterator;
@ -1310,7 +1310,7 @@ public class TexturePack {
li = imgs[IMG_FOLIAGECOLOR];
break;
case COLORMOD_WATERTONED:
if(ss.do_swamp_shading && (mapiter.getBiome() == Biome.SWAMPLAND))
if(ss.do_swamp_shading && (mapiter.getBiome() == BiomeMap.SWAMPLAND))
clrmult = 0xFFE0FF70;
break;
case COLORMOD_BIRCHTONED:
@ -1334,7 +1334,7 @@ public class TexturePack {
else {
clrmult = biomeLookup(li.argb, li.width, mapiter.getRawBiomeRainfall(), mapiter.getRawBiomeTemperature());
}
if(ss.do_swamp_shading && (mapiter.getBiome() == Biome.SWAMPLAND))
if(ss.do_swamp_shading && (mapiter.getBiome() == BiomeMap.SWAMPLAND))
clrmult = (clrmult & 0xFF000000) | (((clrmult & 0x00FEFEFE) + 0x4E0E4E) / 2);
}
if((clrmult != -1) && (clrmult != 0)) {

View File

@ -9,7 +9,6 @@ import java.util.HashSet;
import javax.imageio.ImageIO;
import org.bukkit.block.Biome;
import org.dynmap.Client;
import org.dynmap.Color;
import org.dynmap.ColorScheme;
@ -20,6 +19,7 @@ import org.dynmap.MapManager;
import org.dynmap.DynmapCore.CompassMode;
import org.dynmap.MapType.ImageFormat;
import org.dynmap.TileHashManager;
import org.dynmap.common.BiomeMap;
import org.dynmap.debug.Debug;
import org.dynmap.utils.DynmapBufferedImage;
import org.dynmap.utils.FileLockManager;
@ -406,7 +406,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
MapIterator mapiter) {
int lightlevel = 15;
int lightlevel_day = 15;
Biome bio = null;
BiomeMap bio = null;
double rain = 0.0;
double temp = 0.0;
result.setTransparent();

View File

@ -6,8 +6,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.Location;
import org.bukkit.util.config.ConfigurationNode;
import org.dynmap.ConfigurationNode;
import org.dynmap.markers.AreaMarker;
import org.dynmap.markers.MarkerIcon;
import org.dynmap.markers.MarkerSet;
@ -89,8 +88,8 @@ class AreaMarkerImpl implements AreaMarker {
markup = node.getBoolean("markup", false);
ytop = node.getDouble("ytop", 64.0);
ybottom = node.getDouble("ybottom", 64.0);
List<Double> xx = node.getDoubleList("x", null);
List<Double> zz = node.getDoubleList("z", null);
List<Double> xx = node.getList("x");
List<Double> zz = node.getList("z");
corners.clear();
if((xx != null) && (zz != null)) {
for(int i = 0; (i < xx.size()) && (i < zz.size()); i++)
@ -98,11 +97,11 @@ class AreaMarkerImpl implements AreaMarker {
}
world = node.getString("world", "world");
desc = node.getString("desc", null);
lineweight = node.getInt("strokeWeight", 3);
lineweight = node.getInteger("strokeWeight", 3);
lineopacity = node.getDouble("strokeOpacity", 0.8);
linecolor = node.getInt("strokeColor", 0xFF0000);
linecolor = node.getInteger("strokeColor", 0xFF0000);
fillopacity = node.getDouble("fillOpacity", 0.35);
fillcolor = node.getInt("fillColor", 0xFF0000);
fillcolor = node.getInteger("fillColor", 0xFF0000);
ispersistent = true; /* Loaded from config, so must be */
return true;

View File

@ -20,8 +20,7 @@ import java.util.TreeSet;
import javax.imageio.ImageIO;
import org.bukkit.util.config.Configuration;
import org.bukkit.util.config.ConfigurationNode;
import org.dynmap.ConfigurationNode;
import org.dynmap.DynmapCore;
import org.dynmap.DynmapLocation;
import org.dynmap.DynmapWorld;
@ -454,7 +453,7 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
}
private void doSaveMarkers() {
if(api != null) {
Configuration conf = new Configuration(api.markerpersist); /* Make configuration object */
ConfigurationNode conf = new ConfigurationNode(api.markerpersist); /* Make configuration object */
/* First, save icon definitions */
HashMap<String, Object> icons = new HashMap<String,Object>();
for(String id : api.markericons.keySet()) {
@ -464,7 +463,7 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
icons.put(id, dat);
}
}
conf.setProperty("icons", icons);
conf.put("icons", icons);
/* Then, save persistent sets */
HashMap<String, Object> sets = new HashMap<String, Object>();
for(String id : api.markersets.keySet()) {
@ -476,7 +475,7 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
}
}
}
conf.setProperty("sets", sets);
conf.put("sets", sets);
/* And shift old file file out */
if(api.markerpersist_old.exists()) api.markerpersist_old.delete();
if(api.markerpersist.exists()) api.markerpersist.renameTo(api.markerpersist_old);
@ -500,23 +499,24 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
* Load persistence
*/
private boolean loadMarkers() {
Configuration conf = new Configuration(api.markerpersist); /* Make configuration object */
ConfigurationNode conf = new ConfigurationNode(api.markerpersist); /* Make configuration object */
conf.load(); /* Load persistence */
/* Get icons */
Map<String,ConfigurationNode> icons = conf.getNodes("icons");
ConfigurationNode icons = conf.getNode("icons");
if(icons == null) return false;
for(String id : icons.keySet()) {
MarkerIconImpl ico = new MarkerIconImpl(id);
if(ico.loadPersistentData(icons.get(id))) {
if(ico.loadPersistentData(icons.getNode(id))) {
markericons.put(id, ico);
}
}
/* Get marker sets */
Map<String,ConfigurationNode> sets = conf.getNodes("sets");
ConfigurationNode sets = conf.getNode("sets");
if(sets != null) {
for(String id: sets.keySet()) {
MarkerSetImpl set = new MarkerSetImpl(id);
if(set.loadPersistentData(sets.get(id))) {
if(set.loadPersistentData(sets.getNode(id))) {
markersets.put(id, set);
}
}

View File

@ -7,7 +7,7 @@ import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.util.config.ConfigurationNode;
import org.dynmap.ConfigurationNode;
import org.dynmap.Log;
import org.dynmap.markers.MarkerIcon;

View File

@ -4,8 +4,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.bukkit.Location;
import org.bukkit.util.config.ConfigurationNode;
import org.dynmap.ConfigurationNode;
import org.dynmap.markers.Marker;
import org.dynmap.markers.MarkerIcon;
import org.dynmap.markers.MarkerSet;

View File

@ -7,8 +7,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.Location;
import org.bukkit.util.config.ConfigurationNode;
import org.dynmap.ConfigurationNode;
import org.dynmap.Log;
import org.dynmap.markers.AreaMarker;
import org.dynmap.markers.Marker;
@ -263,7 +262,7 @@ class MarkerSetImpl implements MarkerSet {
label = node.getString("label", setid); /* Get label */
ConfigurationNode markernode = node.getNode("markers");
if(markernode != null) {
for(String id : markernode.getKeys()) {
for(String id : markernode.keySet()) {
MarkerImpl marker = new MarkerImpl(id, this); /* Make and load marker */
if(marker.loadPersistentData(markernode.getNode(id))) {
markers.put(id, marker);
@ -276,7 +275,7 @@ class MarkerSetImpl implements MarkerSet {
}
ConfigurationNode areamarkernode = node.getNode("areas");
if(areamarkernode != null) {
for(String id : areamarkernode.getKeys()) {
for(String id : areamarkernode.keySet()) {
AreaMarkerImpl marker = new AreaMarkerImpl(id, this); /* Make and load marker */
if(marker.loadPersistentData(areamarkernode.getNode(id))) {
areamarkers.put(id, marker);
@ -287,7 +286,7 @@ class MarkerSetImpl implements MarkerSet {
}
}
}
List<String> allowed = node.getStringList("allowedicons", null);
List<String> allowed = node.getList("allowedicons");
if(allowed != null) {
for(String id : allowed) {
MarkerIconImpl icon = MarkerAPIImpl.getMarkerIconImpl(id);
@ -298,8 +297,8 @@ class MarkerSetImpl implements MarkerSet {
}
}
hide_by_def = node.getBoolean("hide", false);
prio = node.getInt("layerprio", 0);
minzoom = node.getInt("minzoom", 0);
prio = node.getInteger("layerprio", 0);
minzoom = node.getInteger("minzoom", 0);
ispersistent = true;
return true;

View File

@ -1,10 +1,9 @@
package org.dynmap.utils;
import org.bukkit.World;
import org.bukkit.block.Biome;
import java.util.List;
import org.dynmap.DynmapChunk;
import org.dynmap.DynmapWorld;
import org.dynmap.common.BiomeMap;
public interface MapChunkCache {
public enum HiddenChunkStyle {
@ -18,7 +17,7 @@ public interface MapChunkCache {
/**
* Set chunks to load, and world to load from
*/
void setChunks(World w, List<DynmapChunk> chunks);
void setChunks(DynmapWorld w, List<DynmapChunk> chunks);
/**
* Set chunk data type needed
* @param blockdata - need block type and data for chunk
@ -69,7 +68,7 @@ public interface MapChunkCache {
/**
* Get biome at coordinates
*/
public Biome getBiome(int x, int z);
public BiomeMap getBiome(int x, int z);
/**
* Get raw temperature data (0.0-1.0)
*/
@ -105,7 +104,7 @@ public interface MapChunkCache {
/**
* Get world
*/
public World getWorld();
public DynmapWorld getWorld();
/**
* Get total chunks loaded
* @return

View File

@ -1,6 +1,6 @@
package org.dynmap.utils;
import org.bukkit.block.Biome;
import org.dynmap.common.BiomeMap;
/**
* Iterator for traversing map chunk cache (base is for non-snapshot)
@ -52,7 +52,7 @@ public interface MapIterator {
/**
* Get biome at coordinates
*/
public Biome getBiome();
public BiomeMap getBiome();
/**
* Get raw temperature data (0.0-1.0)
*/