mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-28 13:15:30 +01:00
Merge remote branch 'upstream/master'
This commit is contained in:
commit
0b7bd72231
@ -78,6 +78,9 @@ render-triggers:
|
||||
# - playerjoin
|
||||
- blockplaced
|
||||
- blockbreak
|
||||
- snowform
|
||||
- leavesdecay
|
||||
- blockburn
|
||||
|
||||
# The path where the tile-files are placed.
|
||||
tilespath: web/tiles
|
||||
@ -121,6 +124,8 @@ templates:
|
||||
# Template for normal world
|
||||
normal:
|
||||
enabled: true
|
||||
# If bigworld set to true, use alternate directory layout better suited to large worlds
|
||||
# bigworld: true
|
||||
center:
|
||||
x: 0
|
||||
y: 64
|
||||
@ -184,6 +189,8 @@ templates:
|
||||
# Nether world template
|
||||
nether:
|
||||
enabled: true
|
||||
# If bigworld set to true, use alternate directory layout better suited to large worlds
|
||||
# bigworld: true
|
||||
center:
|
||||
x: 0
|
||||
y: 64
|
||||
@ -209,6 +216,8 @@ templates:
|
||||
# Skylands world template
|
||||
skylands:
|
||||
enabled: true
|
||||
# If bigworld set to true, use alternate directory layout better suited to large worlds
|
||||
# bigworld: true
|
||||
center:
|
||||
x: 0
|
||||
y: 64
|
||||
@ -267,6 +276,8 @@ worlds:
|
||||
# x: 0
|
||||
# y: 64
|
||||
# z: 0
|
||||
# # If bigworld set to true, use alternate directory layout better suited to large worlds
|
||||
# # bigworld: true
|
||||
# maps:
|
||||
# - class: org.dynmap.flat.FlatMap
|
||||
# name: flat
|
||||
|
@ -39,6 +39,7 @@ public class ClientComponent extends Component {
|
||||
return o;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected static final JSONArray convertList(List<?> l) {
|
||||
JSONArray o = new JSONArray();
|
||||
for(Object entry : l) {
|
||||
@ -47,6 +48,7 @@ public class ClientComponent extends Component {
|
||||
return o;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected static final Object convert(Object o) {
|
||||
if (o instanceof Map<?, ?>) {
|
||||
return convertMap((Map<String, ?>)o);
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.dynmap;
|
||||
|
||||
import static org.dynmap.JSONUtils.a;
|
||||
import static org.dynmap.JSONUtils.l;
|
||||
import static org.dynmap.JSONUtils.s;
|
||||
|
||||
import org.dynmap.Event.Listener;
|
||||
@ -33,6 +32,7 @@ public class ClientConfigurationComponent extends Component {
|
||||
s(wo, "center/x", wn.getFloat("center/x", 0.0f));
|
||||
s(wo, "center/y", wn.getFloat("center/y", 64.0f));
|
||||
s(wo, "center/z", wn.getFloat("center/z", 0.0f));
|
||||
s(wo, "bigworld", world.bigworld);
|
||||
a(t, "worlds", wo);
|
||||
|
||||
for(MapType mt : world.maps) {
|
||||
|
@ -29,6 +29,7 @@ public class ConfigurationNode implements Map<String, Object> {
|
||||
entries = map;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object getObject(String path) {
|
||||
if (path.isEmpty())
|
||||
return entries;
|
||||
@ -60,6 +61,7 @@ public class ConfigurationNode implements Map<String, Object> {
|
||||
return o;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getGeneric(String path, T def) {
|
||||
Object o = getObject(path, def);
|
||||
try {
|
||||
@ -112,6 +114,7 @@ public class ConfigurationNode implements Map<String, Object> {
|
||||
return o.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> List<T> getList(String path) {
|
||||
try {
|
||||
List<T> list = (List<T>)getObject(path, null);
|
||||
@ -139,6 +142,7 @@ public class ConfigurationNode implements Map<String, Object> {
|
||||
return new ConfigurationNode(v);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ConfigurationNode> getNodes(String path) {
|
||||
List<Object> o = getList(path);
|
||||
|
||||
@ -165,6 +169,7 @@ public class ConfigurationNode implements Map<String, Object> {
|
||||
extendMap(this, other);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private final static void extendMap(Map<String, Object> left, Map<String, Object> right) {
|
||||
ConfigurationNode original = new ConfigurationNode(left);
|
||||
for(Map.Entry<String, Object> entry : right.entrySet()) {
|
||||
|
@ -18,8 +18,11 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.block.SnowFormEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
@ -180,11 +183,35 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
BlockListener renderTrigger = new BlockListener() {
|
||||
@Override
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
mm.touch(event.getBlockPlaced().getLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
mm.touch(event.getBlock().getLocation());
|
||||
}
|
||||
@Override
|
||||
public void onSnowForm(SnowFormEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
mm.touch(event.getBlock().getLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeavesDecay(LeavesDecayEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
mm.touch(event.getBlock().getLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockBurn(BlockBurnEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
mm.touch(event.getBlock().getLocation());
|
||||
}
|
||||
};
|
||||
@ -192,6 +219,12 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
pm.registerEvent(org.bukkit.event.Event.Type.BLOCK_PLACE, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this);
|
||||
if (isTrigger("blockbreak"))
|
||||
pm.registerEvent(org.bukkit.event.Event.Type.BLOCK_BREAK, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this);
|
||||
if (isTrigger("snowform"))
|
||||
pm.registerEvent(org.bukkit.event.Event.Type.SNOW_FORM, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this);
|
||||
if (isTrigger("leavesdecay"))
|
||||
pm.registerEvent(org.bukkit.event.Event.Type.LEAVES_DECAY, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this);
|
||||
if (isTrigger("blockburn"))
|
||||
pm.registerEvent(org.bukkit.event.Event.Type.BLOCK_BURN, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this);
|
||||
}
|
||||
{
|
||||
PlayerListener renderTrigger = new PlayerListener() {
|
||||
|
@ -15,4 +15,5 @@ public class DynmapWorld {
|
||||
public int servertime;
|
||||
public boolean sendposition;
|
||||
public boolean sendhealth;
|
||||
public boolean bigworld; /* If true, deeper directory hierarchy */
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.util.Map;
|
||||
|
||||
public class Events {
|
||||
public Map<String, Event<?>> events = new HashMap<String, Event<?>>();
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> void addListener(String eventName, Event.Listener<T> listener) {
|
||||
Event<?> genericEvent = events.get(eventName);
|
||||
Event<T> event = null;
|
||||
@ -16,6 +17,7 @@ public class Events {
|
||||
event.addListener(listener);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> void removeListener(String eventName, Event.Listener<T> listener) {
|
||||
Event<?> genericEvent = events.get(eventName);
|
||||
Event<T> event = null;
|
||||
@ -25,6 +27,7 @@ public class Events {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> void trigger(String eventName, T argument) {
|
||||
Event<?> genericEvent = events.get(eventName);
|
||||
if (genericEvent == null)
|
||||
|
@ -3,7 +3,6 @@ package org.dynmap;
|
||||
import org.dynmap.Event.Listener;
|
||||
import org.dynmap.web.handlers.ClientUpdateHandler;
|
||||
import org.dynmap.web.handlers.SendMessageHandler;
|
||||
import org.dynmap.web.handlers.SendMessageHandler.Message;
|
||||
import org.json.simple.JSONObject;
|
||||
import static org.dynmap.JSONUtils.*;
|
||||
|
||||
|
@ -25,6 +25,7 @@ public class JSONUtils {
|
||||
}
|
||||
|
||||
// Sets a value on the specified path. If JSONObjects inside the path are missing, they'll be created.
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void s(JSONObject o, String path, Object value) {
|
||||
int index = path.indexOf('/');
|
||||
if (index == -1) {
|
||||
@ -45,6 +46,7 @@ public class JSONUtils {
|
||||
}
|
||||
|
||||
// Adds a value to the list at the specified path. If the list does not exist, it will be created.
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void a(JSONObject o, String path, Object value) {
|
||||
Object oo = g(o, path);
|
||||
JSONArray array;
|
||||
@ -58,6 +60,7 @@ public class JSONUtils {
|
||||
}
|
||||
|
||||
// Simply creates a JSONArray.
|
||||
@SuppressWarnings("unchecked")
|
||||
public static JSONArray l(Object... items) {
|
||||
JSONArray arr = new JSONArray();
|
||||
for(Object item : items) {
|
||||
|
@ -3,7 +3,6 @@ package org.dynmap;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.Reader;
|
||||
@ -13,9 +12,7 @@ import java.util.Iterator;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.dynmap.web.Json;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
@ -105,6 +102,7 @@ public class JsonFileClientUpdateComponent extends ClientUpdateComponent {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void writeUpdates() {
|
||||
File outputFile;
|
||||
File outputTempFile;
|
||||
|
@ -300,6 +300,7 @@ public class MapManager {
|
||||
dynmapWorld.servertime = (int)(w.getTime() % 24000);
|
||||
dynmapWorld.sendposition = worldConfiguration.getBoolean("sendposition", true);
|
||||
dynmapWorld.sendhealth = worldConfiguration.getBoolean("sendhealth", true);
|
||||
dynmapWorld.bigworld = worldConfiguration.getBoolean("bigworld", false);
|
||||
if(loclist != null) {
|
||||
for(ConfigurationNode loc : loclist) {
|
||||
Location lx = new Location(w, loc.getDouble("x", 0), loc.getDouble("y", 64), loc.getDouble("z", 0));
|
||||
|
@ -3,10 +3,14 @@ package org.dynmap;
|
||||
import org.bukkit.World;
|
||||
|
||||
public abstract class MapTile {
|
||||
private World world;
|
||||
protected DynmapWorld world;
|
||||
private MapType map;
|
||||
|
||||
public World getWorld() {
|
||||
return world.world;
|
||||
}
|
||||
|
||||
public DynmapWorld getDynmapWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
@ -18,7 +22,7 @@ public abstract class MapTile {
|
||||
|
||||
public abstract String getDayFilename();
|
||||
|
||||
public MapTile(World world, MapType map) {
|
||||
public MapTile(DynmapWorld world, MapType map) {
|
||||
this.world = world;
|
||||
this.map = map;
|
||||
}
|
||||
@ -38,6 +42,6 @@ public abstract class MapTile {
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return world.getName() + "." + map.getName();
|
||||
return world.world.getName() + "." + map.getName();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dynmap.flat;
|
||||
|
||||
import org.dynmap.DynmapWorld;
|
||||
import static org.dynmap.JSONUtils.a;
|
||||
import static org.dynmap.JSONUtils.s;
|
||||
import java.io.File;
|
||||
@ -72,13 +73,14 @@ public class FlatMap extends MapType {
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location l) {
|
||||
return new MapTile[] { new FlatMapTile(l.getWorld(), this, (int) Math.floor(l.getBlockX() / 128.0), (int) Math.floor(l.getBlockZ() / 128.0), 128) };
|
||||
DynmapWorld w = MapManager.mapman.getWorld(l.getWorld().getName());
|
||||
return new MapTile[] { new FlatMapTile(w, this, (int) Math.floor(l.getBlockX() / 128.0), (int) Math.floor(l.getBlockZ() / 128.0), 128) };
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapTile[] getAdjecentTiles(MapTile tile) {
|
||||
FlatMapTile t = (FlatMapTile) tile;
|
||||
World w = t.getWorld();
|
||||
DynmapWorld w = t.getDynmapWorld();
|
||||
int x = t.x;
|
||||
int y = t.y;
|
||||
int s = t.size;
|
||||
@ -254,6 +256,8 @@ public class FlatMap extends MapType {
|
||||
if((!outputFile.exists()) || (crc != hashman.getImageHashCode(tile.getKey(), null, t.x, t.y))) {
|
||||
/* Wrap buffer as buffered image */
|
||||
Debug.debug("saving image " + outputFile.getPath());
|
||||
if(!outputFile.getParentFile().exists())
|
||||
outputFile.getParentFile().mkdirs();
|
||||
try {
|
||||
ImageIO.write(im.buf_img, "png", outputFile);
|
||||
} catch (IOException e) {
|
||||
@ -279,6 +283,8 @@ public class FlatMap extends MapType {
|
||||
crc = hashman.calculateTileHash(argb_buf_day);
|
||||
if((!dayfile.exists()) || (crc != hashman.getImageHashCode(tile.getKey(), "day", t.x, t.y))) {
|
||||
Debug.debug("saving image " + dayfile.getPath());
|
||||
if(!dayfile.getParentFile().exists())
|
||||
dayfile.getParentFile().mkdirs();
|
||||
try {
|
||||
ImageIO.write(im_day.buf_img, "png", dayfile);
|
||||
} catch (IOException e) {
|
||||
@ -384,8 +390,10 @@ public class FlatMap extends MapType {
|
||||
public int x;
|
||||
public int y;
|
||||
public int size;
|
||||
private String fname;
|
||||
private String fname_day;
|
||||
|
||||
public FlatMapTile(World world, FlatMap map, int x, int y, int size) {
|
||||
public FlatMapTile(DynmapWorld world, FlatMap map, int x, int y, int size) {
|
||||
super(world, map);
|
||||
this.map = map;
|
||||
this.x = x;
|
||||
@ -395,11 +403,23 @@ public class FlatMap extends MapType {
|
||||
|
||||
@Override
|
||||
public String getFilename() {
|
||||
return map.prefix + "_" + size + "_" + -(y+1) + "_" + x + ".png";
|
||||
if(fname == null) {
|
||||
if(world.bigworld)
|
||||
fname = map.prefix + "/" + ((-(y+1))>>5) + "_" + (x>>5) + "/" + size + "_" + -(y+1) + "_" + x + ".png";
|
||||
else
|
||||
fname = map.prefix + "_" + size + "_" + -(y+1) + "_" + x + ".png";
|
||||
}
|
||||
return fname;
|
||||
}
|
||||
@Override
|
||||
public String getDayFilename() {
|
||||
return map.prefix + "_day_" + size + "_" + -(y+1) + "_" + x + ".png";
|
||||
if(fname_day == null) {
|
||||
if(world.bigworld)
|
||||
fname_day = map.prefix + "_day/" + ((-(y+1))>>5) + "_" + (x>>5) + "/" + size + "_" + -(y+1) + "_" + x + ".png";
|
||||
else
|
||||
fname_day = map.prefix + "_day_" + size + "_" + -(y+1) + "_" + x + ".png";
|
||||
}
|
||||
return fname_day;
|
||||
}
|
||||
public String toString() {
|
||||
return getWorld().getName() + ":" + getFilename();
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.event.server.ServerListener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import java.lang.reflect.Field;
|
||||
import org.dynmap.Client;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapPlugin;
|
||||
@ -40,6 +39,7 @@ public class HeroChatHandler {
|
||||
|
||||
/* Reflection-based access wrapper for ChannelChatEvent from HeroChat */
|
||||
private static class HeroChatChannelChatEvent {
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static Class channelchatevent;
|
||||
private static Method getsource;
|
||||
private static Method getmessage;
|
||||
@ -97,6 +97,7 @@ public class HeroChatHandler {
|
||||
|
||||
/* Reflection-based access wrapper for ChannelEvent from HeroChat */
|
||||
private static class HeroChatChannelEvent {
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static Class channelevent;
|
||||
private static Method getchannel;
|
||||
private static Method iscancelled;
|
||||
@ -148,6 +149,7 @@ public class HeroChatHandler {
|
||||
|
||||
/* Reflection-based access wrapper for Channel from HeroChat */
|
||||
private static class HeroChatChannel {
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static Class channel;
|
||||
private static Method getname;
|
||||
private static Method getnick;
|
||||
|
@ -189,7 +189,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
}
|
||||
|
||||
/* Hand encoding and writing file off to MapManager */
|
||||
KzedZoomedMapTile zmtile = new KzedZoomedMapTile(tile.getWorld(),
|
||||
KzedZoomedMapTile zmtile = new KzedZoomedMapTile(tile.getDynmapWorld(),
|
||||
(KzedMap) tile.getMap(), tile);
|
||||
File zoomFile = MapManager.mapman.getTileFile(zmtile);
|
||||
|
||||
@ -240,6 +240,8 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
int ty = mtile.py/KzedMap.tileHeight;
|
||||
if((!fname.exists()) || (crc != hashman.getImageHashCode(mtile.getKey(), null, tx, ty))) {
|
||||
Debug.debug("saving image " + fname.getPath());
|
||||
if(!fname.getParentFile().exists())
|
||||
fname.getParentFile().mkdirs();
|
||||
try {
|
||||
ImageIO.write(img.buf_img, "png", fname);
|
||||
} catch (IOException e) {
|
||||
@ -264,6 +266,8 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
crc = hashman.calculateTileHash(img.argb_buf);
|
||||
if((!dfname.exists()) || (crc != hashman.getImageHashCode(mtile.getKey(), "day", tx, ty))) {
|
||||
Debug.debug("saving image " + dfname.getPath());
|
||||
if(!dfname.getParentFile().exists())
|
||||
dfname.getParentFile().mkdirs();
|
||||
try {
|
||||
ImageIO.write(img_day.buf_img, "png", dfname);
|
||||
} catch (IOException e) {
|
||||
@ -335,6 +339,8 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
zIm.setRGB(ox, oy, KzedMap.tileWidth/2, KzedMap.tileHeight/2, zimg.argb_buf, 0, KzedMap.tileWidth/2);
|
||||
|
||||
/* save zoom-out tile */
|
||||
if(!zoomFile.getParentFile().exists())
|
||||
zoomFile.getParentFile().mkdirs();
|
||||
|
||||
try {
|
||||
ImageIO.write(zIm, "png", zoomFile);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dynmap.kzedmap;
|
||||
|
||||
import org.dynmap.DynmapWorld;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@ -10,10 +11,10 @@ import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.MapType;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
@ -70,7 +71,7 @@ public class KzedMap extends MapType {
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location l) {
|
||||
World world = l.getWorld();
|
||||
DynmapWorld world = MapManager.mapman.getWorld(l.getWorld().getName());
|
||||
|
||||
int x = l.getBlockX();
|
||||
int y = l.getBlockY();
|
||||
@ -121,7 +122,7 @@ public class KzedMap extends MapType {
|
||||
public MapTile[] getAdjecentTiles(MapTile tile) {
|
||||
if (tile instanceof KzedMapTile) {
|
||||
KzedMapTile t = (KzedMapTile) tile;
|
||||
World world = tile.getWorld();
|
||||
DynmapWorld world = tile.getDynmapWorld();
|
||||
MapTileRenderer renderer = t.renderer;
|
||||
return new MapTile[] {
|
||||
new KzedMapTile(world, this, renderer, t.px - tileWidth, t.py),
|
||||
@ -132,7 +133,7 @@ public class KzedMap extends MapType {
|
||||
return new MapTile[0];
|
||||
}
|
||||
|
||||
public void addTile(ArrayList<MapTile> tiles, World world, int px, int py) {
|
||||
public void addTile(ArrayList<MapTile> tiles, DynmapWorld world, int px, int py) {
|
||||
for (int i = 0; i < renderers.length; i++) {
|
||||
tiles.add(new KzedMapTile(world, this, renderers[i], px, py));
|
||||
}
|
||||
|
@ -1,19 +1,20 @@
|
||||
package org.dynmap.kzedmap;
|
||||
|
||||
import org.dynmap.DynmapWorld;
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.MapTile;
|
||||
|
||||
public class KzedMapTile extends MapTile {
|
||||
public KzedMap map;
|
||||
public MapTileRenderer renderer;
|
||||
public int px, py;
|
||||
private String fname;
|
||||
private String fname_day;
|
||||
|
||||
// Hack.
|
||||
public File file = null;
|
||||
|
||||
public KzedMapTile(World world, KzedMap map, MapTileRenderer renderer, int px, int py) {
|
||||
public KzedMapTile(DynmapWorld world, KzedMap map, MapTileRenderer renderer, int px, int py) {
|
||||
super(world, map);
|
||||
this.map = map;
|
||||
this.renderer = renderer;
|
||||
@ -23,12 +24,24 @@ public class KzedMapTile extends MapTile {
|
||||
|
||||
@Override
|
||||
public String getFilename() {
|
||||
return renderer.getName() + "_" + px + "_" + py + ".png";
|
||||
if(fname == null) {
|
||||
if(world.bigworld)
|
||||
fname = renderer.getName() + "/" + (px >> 12) + '_' + (py >> 12) + '/' + px + "_" + py + ".png";
|
||||
else
|
||||
fname = renderer.getName() + "_" + px + "_" + py + ".png";
|
||||
}
|
||||
return fname;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDayFilename() {
|
||||
return renderer.getName() + "_day_" + px + "_" + py + ".png";
|
||||
if(fname_day == null) {
|
||||
if(world.bigworld)
|
||||
fname_day = renderer.getName() + "_day/" + (px >> 12) + '_' + (py >> 12) + '/' + px + "_" + py + ".png";
|
||||
else
|
||||
fname_day = renderer.getName() + "_day_" + px + "_" + py + ".png";
|
||||
}
|
||||
return fname_day;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,22 +1,39 @@
|
||||
package org.dynmap.kzedmap;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.MapTile;
|
||||
|
||||
public class KzedZoomedMapTile extends MapTile {
|
||||
private String fname;
|
||||
private String fname_day;
|
||||
|
||||
@Override
|
||||
public String getFilename() {
|
||||
return "z" + originalTile.renderer.getName() + "_" + getTileX() + "_" + getTileY() + ".png";
|
||||
if(fname == null) {
|
||||
if(world.bigworld)
|
||||
fname = "z" + originalTile.renderer.getName() + "/" + (getTileX()>>12) + '_' +
|
||||
(getTileY() >> 12) + '/' + getTileX() + "_" + getTileY() + ".png";
|
||||
else
|
||||
fname = "z" + originalTile.renderer.getName() + "_" + getTileX() + "_" + getTileY() + ".png";
|
||||
}
|
||||
return fname;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDayFilename() {
|
||||
return "z" + originalTile.renderer.getName() + "_day_" + getTileX() + "_" + getTileY() + ".png";
|
||||
if(fname_day == null) {
|
||||
if(world.bigworld)
|
||||
fname_day = "z" + originalTile.renderer.getName() + "_day/" + (getTileX()>>12) + '_' +
|
||||
(getTileY() >> 12) + '/' + getTileX() + "_" + getTileY() + ".png";
|
||||
else
|
||||
fname_day = "z" + originalTile.renderer.getName() + "_day_" + getTileX() + "_" + getTileY() + ".png";
|
||||
}
|
||||
return fname_day;
|
||||
}
|
||||
|
||||
public KzedMapTile originalTile;
|
||||
|
||||
public KzedZoomedMapTile(World world, KzedMap map, KzedMapTile original) {
|
||||
public KzedZoomedMapTile(DynmapWorld world, KzedMap map, KzedMapTile original) {
|
||||
super(world, map);
|
||||
this.originalTile = original;
|
||||
}
|
||||
|
@ -2,8 +2,6 @@ package org.dynmap.web.handlers;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import org.dynmap.DynmapPlugin;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.Event;
|
||||
|
@ -5,24 +5,14 @@ import java.util.Date;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
import org.dynmap.Client;
|
||||
import org.dynmap.ClientUpdateEvent;
|
||||
import org.dynmap.DynmapPlugin;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.PlayerList;
|
||||
import org.dynmap.web.HttpField;
|
||||
import org.dynmap.web.HttpHandler;
|
||||
import org.dynmap.web.HttpRequest;
|
||||
import org.dynmap.web.HttpResponse;
|
||||
import org.dynmap.web.HttpStatus;
|
||||
import org.dynmap.web.Json;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import static org.dynmap.JSONUtils.*;
|
||||
|
||||
|
@ -13,7 +13,6 @@ import org.dynmap.web.HttpHandler;
|
||||
import org.dynmap.web.HttpRequest;
|
||||
import org.dynmap.web.HttpResponse;
|
||||
import org.dynmap.web.HttpStatus;
|
||||
import org.dynmap.utils.FileLockManager;
|
||||
|
||||
public abstract class FileHandler implements HttpHandler {
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
@ -9,14 +9,14 @@ var config = {
|
||||
// For proxying webserver through php.
|
||||
// url: {
|
||||
// configuration: 'up.php?path=configuration',
|
||||
// update: 'up.php?path=world/{world}/?{timestamp}',
|
||||
// update: 'up.php?path=world/{world}/{timestamp}',
|
||||
// sendmessage: 'up.php?path=sendmessage'
|
||||
// },
|
||||
|
||||
// For proxying webserver through aspx.
|
||||
// url: {
|
||||
// configuration: 'up.aspx?path=configuration',
|
||||
// update: 'up.aspx?path=world/{world}/?{timestamp}',
|
||||
// update: 'up.aspx?path=world/{world}/{timestamp}',
|
||||
// sendmessage: 'up.aspx?path=sendmessage'
|
||||
// },
|
||||
|
||||
|
@ -29,7 +29,11 @@ FlatMapType.prototype = $.extend(new DynMapType(), {
|
||||
if(this.dynmap.map.mapTypes[this.dynmap.map.mapTypeId].nightandday && this.dynmap.serverday)
|
||||
dnprefix = '_day';
|
||||
|
||||
tileName = this.prefix + dnprefix + '_128_' + coord.x + '_' + coord.y + '.png';
|
||||
if(this.dynmap.world.bigworld)
|
||||
tileName = this.prefix + dnprefix + '/' + (coord.x >> 5) + '_' + (coord.y >> 5) +
|
||||
'/128_' + coord.x + '_' + coord.y + '.png';
|
||||
else
|
||||
tileName = this.prefix + dnprefix + '_128_' + coord.x + '_' + coord.y + '.png';
|
||||
imgSize = Math.pow(2, 7+zoom);
|
||||
var tile = $('<div/>')
|
||||
.addClass('tile')
|
||||
|
@ -51,13 +51,27 @@ KzedMapType.prototype = $.extend(new DynMapType(), {
|
||||
// Most zoomed out tiles.
|
||||
tileSize = 128;
|
||||
imgSize = tileSize;
|
||||
tileName = 'z' + this.prefix + dnprefix + '_' + (-coord.x * tileSize*2) + '_' + (coord.y * tileSize*2) + '.png';
|
||||
if (this.dynmap.world.bigworld) {
|
||||
tileName = 'z' + this.prefix + dnprefix + '/' + ((-coord.x * tileSize*2)>>12) +
|
||||
'_' + ((coord.y * tileSize*2) >> 12) + '/' +
|
||||
(-coord.x * tileSize*2) + '_' + (coord.y * tileSize*2) + '.png';
|
||||
}
|
||||
else {
|
||||
tileName = 'z' + this.prefix + dnprefix + '_' + (-coord.x * tileSize*2) + '_' + (coord.y * tileSize*2) + '.png';
|
||||
}
|
||||
} else {
|
||||
// Other zoom levels.
|
||||
tileSize = 128;
|
||||
|
||||
imgSize = Math.pow(2, 6+zoom);
|
||||
tileName = this.prefix + dnprefix + '_' + (-coord.x*tileSize) + '_' + (coord.y*tileSize) + '.png';
|
||||
if(this.dynmap.world.bigworld) {
|
||||
tileName = this.prefix + dnprefix + '/' + ((-coord.x*tileSize) >> 12) + '_' +
|
||||
((coord.y*tileSize)>>12) + '/' +
|
||||
(-coord.x*tileSize) + '_' + (coord.y*tileSize) + '.png';
|
||||
}
|
||||
else {
|
||||
tileName = this.prefix + dnprefix + '_' + (-coord.x*tileSize) + '_' + (coord.y*tileSize) + '.png';
|
||||
}
|
||||
}
|
||||
var img;
|
||||
var tile = $('<div/>')
|
||||
|
Loading…
Reference in New Issue
Block a user