mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-28 19:47:45 +01:00
Added configuration and renamed Map to MapType.
This commit is contained in:
parent
ce60452a35
commit
3aa48f2215
@ -1,5 +1,8 @@
|
||||
<project name="dynmap" default="dist" basedir=".">
|
||||
<include file="build_parameters.xml"/>
|
||||
<property name="bukkit.jar" location="C:\Users\Bob\Desktop\minecraft_server\bukkit-0.0.1-SNAPSHOT.jar"/>
|
||||
<property name="minecraft" location="C:\Users\Bob\Desktop\minecraft_server"/>
|
||||
<property name="plugins" location="${minecraft}/plugins/"/>
|
||||
<property name="http_root" location="/srv/http/dynmap/"/>
|
||||
<property name="pluginname" value="dynmap"/>
|
||||
|
||||
<property name="src" location="src"/>
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
import org.bukkit.plugin.*;
|
||||
import org.bukkit.plugin.java.*;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
import org.dynmap.debug.BukkitPlayerDebugger;
|
||||
|
||||
public class DynmapPlugin extends JavaPlugin {
|
||||
@ -30,12 +31,17 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void onEnable() {
|
||||
if (!this.getDataFolder().isDirectory())
|
||||
this.getDataFolder().mkdirs();
|
||||
Configuration configuration = new Configuration(new File(this.getDataFolder(), "configuration.txt"));
|
||||
configuration.load();
|
||||
|
||||
debugger.enable();
|
||||
mgr = new MapManager(getWorld(), debugger);
|
||||
mgr = new MapManager(getWorld(), debugger, configuration);
|
||||
mgr.startManager();
|
||||
|
||||
try {
|
||||
server = new WebServer(mgr.serverport, mgr, getServer(), debugger);
|
||||
server = new WebServer(mgr.serverport, mgr, getServer(), debugger, configuration);
|
||||
} catch(IOException e) {
|
||||
log.info("position failed to start WebServer (IOException)");
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.util.config.ConfigurationNode;
|
||||
import org.dynmap.debug.Debugger;
|
||||
import org.dynmap.kzedmap.KzedMap;
|
||||
|
||||
@ -13,7 +14,7 @@ public class MapManager extends Thread {
|
||||
|
||||
private World world;
|
||||
private Debugger debugger;
|
||||
private org.dynmap.Map map;
|
||||
private MapType map;
|
||||
public StaleQueue staleQueue;
|
||||
|
||||
/* lock for our data structures */
|
||||
@ -42,7 +43,7 @@ public class MapManager extends Thread {
|
||||
debugger.debug(msg);
|
||||
}
|
||||
|
||||
public MapManager(World world, Debugger debugger)
|
||||
public MapManager(World world, Debugger debugger, ConfigurationNode configuration)
|
||||
{
|
||||
this.world = world;
|
||||
this.debugger = debugger;
|
||||
@ -59,7 +60,7 @@ public class MapManager extends Thread {
|
||||
//webPath = "/srv/http/dynmap/";
|
||||
webPath = "[JAR]";
|
||||
|
||||
map = new KzedMap(this, world, debugger);
|
||||
map = new KzedMap(this, world, debugger, configuration);
|
||||
}
|
||||
|
||||
/* initialize and start map manager */
|
||||
|
@ -1,14 +1,14 @@
|
||||
package org.dynmap;
|
||||
|
||||
public abstract class MapTile {
|
||||
private Map map;
|
||||
public Map getMap() {
|
||||
private MapType map;
|
||||
public MapType getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public abstract String getName();
|
||||
|
||||
public MapTile(Map map) {
|
||||
public MapTile(MapType map) {
|
||||
this.map = map;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.debug.Debugger;
|
||||
|
||||
public abstract class Map {
|
||||
public abstract class MapType {
|
||||
private MapManager manager;
|
||||
public MapManager getMapManager() {
|
||||
return manager;
|
||||
@ -20,7 +20,7 @@ public abstract class Map {
|
||||
return debugger;
|
||||
}
|
||||
|
||||
public Map(MapManager manager, World world, Debugger debugger) {
|
||||
public MapType(MapManager manager, World world, Debugger debugger) {
|
||||
this.manager = manager;
|
||||
this.world = world;
|
||||
this.debugger = debugger;
|
@ -7,6 +7,7 @@ import java.net.Socket;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.util.config.ConfigurationNode;
|
||||
import org.dynmap.debug.Debugger;
|
||||
|
||||
public class WebServer extends Thread {
|
||||
@ -22,7 +23,7 @@ public class WebServer extends Thread {
|
||||
private MapManager mgr;
|
||||
private Server server;
|
||||
|
||||
public WebServer(int port, MapManager mgr, Server server, Debugger debugger) throws IOException
|
||||
public WebServer(int port, MapManager mgr, Server server, Debugger debugger, ConfigurationNode configuration) throws IOException
|
||||
{
|
||||
this.mgr = mgr;
|
||||
this.server = server;
|
||||
|
@ -3,12 +3,13 @@ package org.dynmap.kzedmap;
|
||||
import java.awt.Color;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.util.config.ConfigurationNode;
|
||||
import org.dynmap.debug.Debugger;
|
||||
|
||||
public class CaveTileRenderer extends DefaultTileRenderer {
|
||||
|
||||
public CaveTileRenderer(String name, Debugger debugger) {
|
||||
super(name, debugger);
|
||||
public CaveTileRenderer(String name, Debugger debugger, ConfigurationNode configuration) {
|
||||
super(name, debugger, configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,6 +9,7 @@ import java.io.IOException;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.util.config.ConfigurationNode;
|
||||
import org.dynmap.debug.Debugger;
|
||||
|
||||
public class DefaultTileRenderer implements MapTileRenderer {
|
||||
@ -19,7 +20,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
return name;
|
||||
}
|
||||
|
||||
public DefaultTileRenderer(String name, Debugger debugger) {
|
||||
public DefaultTileRenderer(String name, Debugger debugger, ConfigurationNode configuration) {
|
||||
this.name = name;
|
||||
this.debugger = debugger;
|
||||
}
|
||||
|
@ -9,12 +9,13 @@ import java.util.Scanner;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.Map;
|
||||
import org.bukkit.util.config.ConfigurationNode;
|
||||
import org.dynmap.MapType;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.debug.Debugger;
|
||||
|
||||
public class KzedMap extends Map {
|
||||
public class KzedMap extends MapType {
|
||||
/* dimensions of a map tile */
|
||||
public static final int tileWidth = 128;
|
||||
public static final int tileHeight = 128;
|
||||
@ -33,16 +34,16 @@ public class KzedMap extends Map {
|
||||
MapTileRenderer[] renderers;
|
||||
ZoomedTileRenderer zoomrenderer;
|
||||
|
||||
public KzedMap(MapManager manager, World world, Debugger debugger) {
|
||||
public KzedMap(MapManager manager, World world, Debugger debugger, ConfigurationNode configuration) {
|
||||
super(manager, world, debugger);
|
||||
if (colors == null) {
|
||||
colors = loadColorSet("colors.txt");
|
||||
}
|
||||
renderers = new MapTileRenderer[] {
|
||||
new DefaultTileRenderer("t", debugger),
|
||||
new CaveTileRenderer("ct", debugger),
|
||||
new DefaultTileRenderer("t", debugger, configuration),
|
||||
new CaveTileRenderer("ct", debugger, configuration),
|
||||
};
|
||||
zoomrenderer = new ZoomedTileRenderer(debugger);
|
||||
zoomrenderer = new ZoomedTileRenderer(debugger, configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,12 +8,13 @@ import java.io.IOException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.bukkit.util.config.ConfigurationNode;
|
||||
import org.dynmap.debug.Debugger;
|
||||
|
||||
public class ZoomedTileRenderer {
|
||||
protected Debugger debugger;
|
||||
|
||||
public ZoomedTileRenderer(Debugger debugger) {
|
||||
public ZoomedTileRenderer(Debugger debugger, ConfigurationNode configuration) {
|
||||
this.debugger = debugger;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user