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