mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-13 05:54:40 +01:00
Start isolating Bukkit dependencies, prep code for ports
This commit is contained in:
parent
6cfeee152c
commit
42418edf1f
@ -3,7 +3,6 @@ package org.dynmap;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class Armor {
|
||||
/**
|
||||
|
@ -4,8 +4,6 @@ import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.dynmap.markers.Marker;
|
||||
import org.dynmap.markers.MarkerSet;
|
||||
import org.json.simple.JSONAware;
|
||||
import org.json.simple.JSONStreamAware;
|
||||
|
||||
|
@ -5,11 +5,8 @@ import static org.dynmap.JSONUtils.s;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.dynmap.utils.BlockLightLevel;
|
||||
import org.json.simple.JSONArray;
|
||||
|
@ -16,6 +16,8 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
@ -74,6 +76,7 @@ import org.dynmap.web.handlers.ClientConfigurationHandler;
|
||||
import org.dynmap.web.handlers.FilesystemHandler;
|
||||
|
||||
public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
private String version;
|
||||
public HttpServer webServer = null;
|
||||
public MapManager mapManager = null;
|
||||
public PlayerList playerList;
|
||||
@ -225,6 +228,9 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
version = pdfFile.getVersion();
|
||||
|
||||
/* Start with clean events */
|
||||
events = new Events();
|
||||
|
||||
@ -381,8 +387,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
}
|
||||
|
||||
/* Print version info */
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
Log.info("version " + pdfFile.getVersion() + " is enabled" );
|
||||
Log.info("version " + version + " is enabled" );
|
||||
|
||||
events.<Object>trigger("initialized", null);
|
||||
}
|
||||
@ -503,10 +508,12 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
BlockListener blockTrigger = new BlockListener() {
|
||||
@Override
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mapManager.sscache.invalidateSnapshot(loc);
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
DynmapLocation dloc = toLoc(event.getBlock().getLocation());
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onplace) {
|
||||
mapManager.touch(loc, "blockplace");
|
||||
mapManager.touch(dloc, "blockplace");
|
||||
}
|
||||
}
|
||||
|
||||
@ -514,10 +521,10 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mapManager.sscache.invalidateSnapshot(loc);
|
||||
DynmapLocation dloc = toLoc(event.getBlock().getLocation());
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onbreak) {
|
||||
mapManager.touch(loc, "blockbreak");
|
||||
mapManager.touch(dloc, "blockbreak");
|
||||
}
|
||||
}
|
||||
|
||||
@ -525,10 +532,10 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
public void onLeavesDecay(LeavesDecayEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mapManager.sscache.invalidateSnapshot(loc);
|
||||
DynmapLocation dloc = toLoc(event.getBlock().getLocation());
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onleaves) {
|
||||
mapManager.touch(loc, "leavesdecay");
|
||||
mapManager.touch(dloc, "leavesdecay");
|
||||
}
|
||||
}
|
||||
|
||||
@ -536,10 +543,10 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
public void onBlockBurn(BlockBurnEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mapManager.sscache.invalidateSnapshot(loc);
|
||||
DynmapLocation dloc = toLoc(event.getBlock().getLocation());
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onburn) {
|
||||
mapManager.touch(loc, "blockburn");
|
||||
mapManager.touch(dloc, "blockburn");
|
||||
}
|
||||
}
|
||||
|
||||
@ -547,10 +554,10 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
public void onBlockForm(BlockFormEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mapManager.sscache.invalidateSnapshot(loc);
|
||||
DynmapLocation dloc = toLoc(event.getBlock().getLocation());
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onblockform) {
|
||||
mapManager.touch(loc, "blockform");
|
||||
mapManager.touch(dloc, "blockform");
|
||||
}
|
||||
}
|
||||
|
||||
@ -558,10 +565,10 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
public void onBlockFade(BlockFadeEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mapManager.sscache.invalidateSnapshot(loc);
|
||||
DynmapLocation dloc = toLoc(event.getBlock().getLocation());
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onblockfade) {
|
||||
mapManager.touch(loc, "blockfade");
|
||||
mapManager.touch(dloc, "blockfade");
|
||||
}
|
||||
}
|
||||
|
||||
@ -569,10 +576,10 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
public void onBlockSpread(BlockSpreadEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mapManager.sscache.invalidateSnapshot(loc);
|
||||
DynmapLocation dloc = toLoc(event.getBlock().getLocation());
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onblockspread) {
|
||||
mapManager.touch(loc, "blockspread");
|
||||
mapManager.touch(dloc, "blockspread");
|
||||
}
|
||||
}
|
||||
|
||||
@ -580,24 +587,24 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
public void onBlockFromTo(BlockFromToEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
Location loct = event.getToBlock().getLocation();
|
||||
Location locf = event.getBlock().getLocation();
|
||||
mapManager.sscache.invalidateSnapshot(loct);
|
||||
mapManager.sscache.invalidateSnapshot(locf);
|
||||
if(onblockfromto) {
|
||||
mapManager.touch(locf, "blockfromto");
|
||||
mapManager.touch(loct, "blockfromto");
|
||||
}
|
||||
DynmapLocation dloc = toLoc(event.getToBlock().getLocation());
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onblockfromto)
|
||||
mapManager.touch(dloc, "blockfromto");
|
||||
dloc = toLoc(event.getBlock().getLocation());
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onblockfromto)
|
||||
mapManager.touch(dloc, "blockfromto");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mapManager.sscache.invalidateSnapshot(loc);
|
||||
DynmapLocation dloc = toLoc(event.getBlock().getLocation());
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onblockphysics) {
|
||||
mapManager.touch(loc, "blockphysics");
|
||||
mapManager.touch(dloc, "blockphysics");
|
||||
}
|
||||
}
|
||||
|
||||
@ -607,19 +614,23 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
return;
|
||||
Block b = event.getBlock();
|
||||
Location loc = b.getLocation();
|
||||
mapManager.sscache.invalidateSnapshot(loc);
|
||||
BlockFace dir;
|
||||
try { /* Workaround Bukkit bug = http://leaky.bukkit.org/issues/1227 */
|
||||
dir = event.getDirection();
|
||||
} catch (ClassCastException ccx) {
|
||||
dir = BlockFace.NORTH;
|
||||
}
|
||||
if(onpiston) {
|
||||
mapManager.touchVolume(loc, b.getRelative(dir, 2).getLocation(), "pistonretract");
|
||||
}
|
||||
DynmapLocation dloc = toLoc(loc);
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onpiston)
|
||||
mapManager.touch(dloc, "pistonretract");
|
||||
for(int i = 0; i < 2; i++) {
|
||||
b = b.getRelative(dir, 1);
|
||||
mapManager.sscache.invalidateSnapshot(b.getLocation());
|
||||
dloc.x += dir.getModX();
|
||||
dloc.y += dir.getModY();
|
||||
dloc.z += dir.getModZ();
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onpiston)
|
||||
mapManager.touch(dloc, "pistonretract");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@ -628,19 +639,24 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
return;
|
||||
Block b = event.getBlock();
|
||||
Location loc = b.getLocation();
|
||||
mapManager.sscache.invalidateSnapshot(loc);
|
||||
DynmapLocation dloc = toLoc(loc);
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
BlockFace dir;
|
||||
try { /* Workaround Bukkit bug = http://leaky.bukkit.org/issues/1227 */
|
||||
dir = event.getDirection();
|
||||
} catch (ClassCastException ccx) {
|
||||
dir = BlockFace.NORTH;
|
||||
}
|
||||
if(onpiston) {
|
||||
mapManager.touchVolume(loc, b.getRelative(dir, 1+event.getLength()).getLocation(), "pistonextend");
|
||||
}
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onpiston)
|
||||
mapManager.touch(dloc, "pistonretract");
|
||||
for(int i = 0; i < 1+event.getLength(); i++) {
|
||||
b = b.getRelative(dir, 1);
|
||||
mapManager.sscache.invalidateSnapshot(b.getLocation());
|
||||
dloc.x += dir.getModX();
|
||||
dloc.y += dir.getModY();
|
||||
dloc.z += dir.getModZ();
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onpiston)
|
||||
mapManager.touch(dloc, "pistonretract");
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -680,14 +696,22 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
registerEvent(Event.Type.BLOCK_PISTON_RETRACT, blockTrigger);
|
||||
/* Register player event trigger handlers */
|
||||
PlayerListener playerTrigger = new PlayerListener() {
|
||||
private DynmapLocation dloc = new DynmapLocation();
|
||||
private DynmapLocation toLoc(Location loc) {
|
||||
dloc.x = loc.getBlockX(); dloc.y = loc.getBlockY();
|
||||
dloc.z = loc.getBlockZ(); dloc.world = loc.getWorld().getName();
|
||||
return dloc;
|
||||
}
|
||||
@Override
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
mapManager.touch(event.getPlayer().getLocation(), "playerjoin");
|
||||
toLoc(event.getPlayer().getLocation());
|
||||
mapManager.touch(dloc, "playerjoin");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
mapManager.touch(event.getPlayer().getLocation(), "playermove");
|
||||
toLoc(event.getPlayer().getLocation());
|
||||
mapManager.touch(dloc, "playermove");
|
||||
}
|
||||
};
|
||||
|
||||
@ -700,14 +724,20 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
|
||||
/* Register entity event triggers */
|
||||
EntityListener entityTrigger = new EntityListener() {
|
||||
private DynmapLocation dloc = new DynmapLocation();
|
||||
private DynmapLocation toLoc(Location loc) {
|
||||
dloc.x = loc.getBlockX(); dloc.y = loc.getBlockY();
|
||||
dloc.z = loc.getBlockZ(); dloc.world = loc.getWorld().getName();
|
||||
return dloc;
|
||||
}
|
||||
@Override
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
List<Block> blocks = event.blockList();
|
||||
for(Block b: blocks) {
|
||||
Location loc = b.getLocation();
|
||||
mapManager.sscache.invalidateSnapshot(loc);
|
||||
toLoc(b.getLocation());
|
||||
mapManager.sscache.invalidateSnapshot(dloc);
|
||||
if(onexplosion) {
|
||||
mapManager.touch(loc, "entityexplode");
|
||||
mapManager.touch(dloc, "entityexplode");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -718,20 +748,28 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
|
||||
/* Register world event triggers */
|
||||
WorldListener worldTrigger = new WorldListener() {
|
||||
private DynmapLocation dloc = new DynmapLocation();
|
||||
@Override
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
if(ignore_chunk_loads)
|
||||
return;
|
||||
Chunk c = event.getChunk();
|
||||
/* Touch extreme corners */
|
||||
int x = event.getChunk().getX() << 4;
|
||||
int z = event.getChunk().getZ() << 4;
|
||||
mapManager.touchVolume(new Location(event.getWorld(), x, 0, z), new Location(event.getWorld(), x+16, 128, z+16), "chunkload");
|
||||
dloc.world = event.getWorld().getName();
|
||||
dloc.x = c.getX() << 4;
|
||||
dloc.y = 0;
|
||||
dloc.z = c.getZ() << 4;
|
||||
mapManager.touchVolume(dloc, 16, 128, 16, "chunkload");
|
||||
}
|
||||
@Override
|
||||
public void onChunkPopulate(ChunkPopulateEvent event) {
|
||||
int x = event.getChunk().getX() << 4;
|
||||
int z = event.getChunk().getZ() << 4;
|
||||
mapManager.touchVolume(new Location(event.getWorld(), x, 0, z), new Location(event.getWorld(), x+16, 128, z+16), "chunkgenerate");
|
||||
Chunk c = event.getChunk();
|
||||
/* Touch extreme corners */
|
||||
dloc.world = event.getWorld().getName();
|
||||
dloc.x = c.getX() << 4;
|
||||
dloc.y = 0;
|
||||
dloc.z = c.getZ() << 4;
|
||||
mapManager.touchVolume(dloc, 16, 128, 16, "chunkpopulate");
|
||||
}
|
||||
@Override
|
||||
public void onWorldLoad(WorldLoadEvent event) {
|
||||
@ -866,7 +904,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
|
||||
if (c.equals("render") && checkPlayerPermission(sender,"render")) {
|
||||
if (player != null) {
|
||||
int invalidates = mapManager.touch(player.getLocation(), "render");
|
||||
int invalidates = mapManager.touch(toLoc(player.getLocation()), "render");
|
||||
sender.sendMessage("Queued " + invalidates + " tiles" + (invalidates == 0
|
||||
? " (world is not loaded?)"
|
||||
: "..."));
|
||||
@ -878,7 +916,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
else if(c.equals("radiusrender") && checkPlayerPermission(sender,"radiusrender")) {
|
||||
int radius = 0;
|
||||
String mapname = null;
|
||||
Location loc = null;
|
||||
DynmapLocation loc = null;
|
||||
if(args.length == 2) { /* Just radius */
|
||||
radius = Integer.parseInt(args[1]); /* Parse radius */
|
||||
if(radius < 0)
|
||||
@ -886,7 +924,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
if(args.length > 2)
|
||||
mapname = args[2];
|
||||
if (player != null)
|
||||
loc = player.getLocation();
|
||||
loc = toLoc(player.getLocation());
|
||||
else
|
||||
sender.sendMessage("Command require <world> <x> <z> <radius> if issued from console.");
|
||||
}
|
||||
@ -895,26 +933,26 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
if(w == null) {
|
||||
sender.sendMessage("World '" + args[1] + "' not defined/loaded");
|
||||
}
|
||||
double x = 0, z = 0;
|
||||
x = Double.parseDouble(args[2]);
|
||||
z = Double.parseDouble(args[3]);
|
||||
int x = 0, z = 0;
|
||||
x = Integer.parseInt(args[2]);
|
||||
z = Integer.parseInt(args[3]);
|
||||
if(args.length > 4)
|
||||
radius = Integer.parseInt(args[4]);
|
||||
if(args.length > 5)
|
||||
mapname = args[5];
|
||||
if(w != null)
|
||||
loc = new Location(w.world, x, 64.0, z);
|
||||
loc = new DynmapLocation(w.getName(), x, 64, z);
|
||||
}
|
||||
if(loc != null)
|
||||
mapManager.renderWorldRadius(loc, sender, mapname, radius);
|
||||
} else if(c.equals("updaterender") && checkPlayerPermission(sender,"updaterender")) {
|
||||
String mapname = null;
|
||||
Location loc = null;
|
||||
DynmapLocation loc = null;
|
||||
if(args.length <= 3) { /* Just command, or command plus map */
|
||||
if(args.length > 2)
|
||||
mapname = args[2];
|
||||
if (player != null)
|
||||
loc = player.getLocation();
|
||||
loc = toLoc(player.getLocation());
|
||||
else
|
||||
sender.sendMessage("Command require <world> <x> <z> <radius> if issued from console.");
|
||||
}
|
||||
@ -923,13 +961,13 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
if(w == null) {
|
||||
sender.sendMessage("World '" + args[1] + "' not defined/loaded");
|
||||
}
|
||||
double x = 0, z = 0;
|
||||
x = Double.parseDouble(args[2]);
|
||||
z = Double.parseDouble(args[3]);
|
||||
int x = 0, z = 0;
|
||||
x = Integer.parseInt(args[2]);
|
||||
z = Integer.parseInt(args[3]);
|
||||
if(args.length > 4)
|
||||
mapname = args[4];
|
||||
if(w != null)
|
||||
loc = new Location(w.world, x, 64.0, z);
|
||||
loc = new DynmapLocation(w.getName(), x, 64, z);
|
||||
}
|
||||
if(loc != null)
|
||||
mapManager.renderFullWorld(loc, sender, mapname, true);
|
||||
@ -970,15 +1008,15 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
}
|
||||
w = mapManager.getWorld(wname);
|
||||
if(w != null) {
|
||||
Location spawn = w.world.getSpawnLocation();
|
||||
Location loc = new Location(w.world, w.configuration.getDouble("center/x", spawn.getX()), w.configuration.getDouble("center/y", spawn.getY()), w.configuration.getDouble("center/z", spawn.getZ()));
|
||||
DynmapLocation spawn = w.getSpawnLocation();
|
||||
DynmapLocation loc = new DynmapLocation(wname, w.configuration.getInteger("center/x", spawn.x), w.configuration.getInteger("center/y", spawn.y), w.configuration.getInteger("center/z", spawn.z));
|
||||
mapManager.renderFullWorld(loc,sender, map, false);
|
||||
}
|
||||
else
|
||||
sender.sendMessage("World '" + wname + "' not defined/loaded");
|
||||
}
|
||||
} else if (player != null) {
|
||||
Location loc = player.getLocation();
|
||||
DynmapLocation loc = toLoc(player.getLocation());
|
||||
if(args.length > 1)
|
||||
map = args[1];
|
||||
if(loc != null)
|
||||
@ -1651,9 +1689,17 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
public int triggerRenderOfVolume(Location l0, Location l1) {
|
||||
if(mapManager != null) {
|
||||
if(l1 == null)
|
||||
return mapManager.touch(l0, "api");
|
||||
else
|
||||
return mapManager.touchVolume(l0, l1, "api");
|
||||
return mapManager.touch(toLoc(l0), "api");
|
||||
else {
|
||||
DynmapLocation dloc = toLoc(l0);
|
||||
int sx = l1.getBlockX() - dloc.x + 1;
|
||||
int sy = l1.getBlockY() - dloc.y + 1;
|
||||
int sz = l1.getBlockZ() - dloc.z + 1;
|
||||
if(sx < 1) { sx = -sx + 2; dloc.x = l1.getBlockX(); }
|
||||
if(sy < 1) { sy = -sy + 2; dloc.y = l1.getBlockY(); }
|
||||
if(sz < 1) { sz = -sz + 2; dloc.z = l1.getBlockZ(); }
|
||||
return mapManager.touchVolume(dloc, sx, sy, sz, "api");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1779,4 +1825,59 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
Log.severe("Error saving " + f.getPath() + " - " + x.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerVisiblity(String player, boolean is_visible) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerVisbility(String player) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postPlayerMessageToWeb(String playerid, String playerdisplay, String message) {
|
||||
if(playerdisplay == null) playerdisplay = playerid;
|
||||
if(mapManager != null)
|
||||
mapManager.pushUpdate(new Client.ChatMessage("player", "", playerid, message, playerdisplay));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postPlayerJoinQuitToWeb(String playerid, String playerdisplay, boolean isjoin) {
|
||||
if(playerdisplay == null) playerdisplay = playerid;
|
||||
if((mapManager != null) && (playerList != null) && (playerList.isVisiblePlayer(playerid))) {
|
||||
if(isjoin)
|
||||
mapManager.pushUpdate(new Client.PlayerJoinMessage(playerid, playerdisplay));
|
||||
else
|
||||
mapManager.pushUpdate(new Client.PlayerQuitMessage(playerid, playerdisplay));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDynmapCoreVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDynmapVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int triggerRenderOfVolume(DynmapLocation loc, int sx, int sy, int sz) {
|
||||
if(mapManager != null) {
|
||||
if((sx == 1) && (sy == 1) && (sz == 1))
|
||||
return mapManager.touch(loc, "api");
|
||||
else
|
||||
return mapManager.touchVolume(loc, sx, sy, sz, "api");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private DynmapLocation toLoc(Location l) {
|
||||
return new DynmapLocation(l.getWorld().getName(), l.getBlockX(), l.getBlockY(), l.getBlockZ());
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.dynmap;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.FileInputStream;
|
||||
@ -10,12 +9,9 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.web.HttpStatus;
|
||||
import org.dynmap.web.Json;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.dynmap;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -22,7 +21,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -185,7 +183,7 @@ public class MapManager {
|
||||
/* This always runs on render pool threads - no bukkit calls from here */
|
||||
private class FullWorldRenderState implements Runnable {
|
||||
DynmapWorld world; /* Which world are we rendering */
|
||||
Location loc;
|
||||
DynmapLocation loc;
|
||||
int map_index = -1; /* Which map are we on */
|
||||
MapType map;
|
||||
TileFlags found = null;
|
||||
@ -209,7 +207,7 @@ public class MapManager {
|
||||
AtomicInteger rendercalls = new AtomicInteger(0);
|
||||
|
||||
/* Full world, all maps render */
|
||||
FullWorldRenderState(DynmapWorld dworld, Location l, CommandSender sender, String mapname, boolean updaterender) {
|
||||
FullWorldRenderState(DynmapWorld dworld, DynmapLocation l, CommandSender sender, String mapname, boolean updaterender) {
|
||||
this(dworld, l, sender, mapname, -1);
|
||||
if(updaterender) {
|
||||
rendertype = RENDERTYPE_UPDATERENDER;
|
||||
@ -220,7 +218,7 @@ public class MapManager {
|
||||
}
|
||||
|
||||
/* Full world, all maps render, with optional render radius */
|
||||
FullWorldRenderState(DynmapWorld dworld, Location l, CommandSender sender, String mapname, int radius) {
|
||||
FullWorldRenderState(DynmapWorld dworld, DynmapLocation l, CommandSender sender, String mapname, int radius) {
|
||||
world = dworld;
|
||||
loc = l;
|
||||
found = new TileFlags();
|
||||
@ -237,10 +235,10 @@ public class MapManager {
|
||||
rendertype = RENDERTYPE_FULLRENDER;
|
||||
}
|
||||
else {
|
||||
cxmin = (l.getBlockX() - radius)>>4;
|
||||
czmin = (l.getBlockZ() - radius)>>4;
|
||||
cxmax = (l.getBlockX() + radius+15)>>4;
|
||||
czmax = (l.getBlockZ() + radius+15)>>4;
|
||||
cxmin = (l.x - radius)>>4;
|
||||
czmin = (l.z - radius)>>4;
|
||||
cxmax = (l.x + radius+15)>>4;
|
||||
czmax = (l.z + radius+15)>>4;
|
||||
rendertype = RENDERTYPE_RADIUSRENDER;
|
||||
}
|
||||
this.mapname = mapname;
|
||||
@ -248,7 +246,7 @@ public class MapManager {
|
||||
|
||||
/* Single tile render - used for incremental renders */
|
||||
FullWorldRenderState(MapTile t) {
|
||||
world = getWorld(t.getWorld().getName());
|
||||
world = getWorld(t.getDynmapWorld().getName());
|
||||
tile0 = t;
|
||||
cxmin = czmin = Integer.MIN_VALUE;
|
||||
cxmax = czmax = Integer.MAX_VALUE;
|
||||
@ -258,7 +256,11 @@ public class MapManager {
|
||||
String w = n.getString("world", "");
|
||||
world = getWorld(w);
|
||||
if(world == null) throw new Exception();
|
||||
loc = new Location(world.world, n.getDouble("locX", 0.0), n.getDouble("locY", 0.0), n.getDouble("locZ", 0.0));
|
||||
loc = new DynmapLocation();
|
||||
loc.world = world.getName();
|
||||
loc.x = (int)n.getDouble("locX", 0.0);
|
||||
loc.y = (int)n.getDouble("locY", 0.0);
|
||||
loc.z = (int)n.getDouble("locZ", 0.0);
|
||||
String m = n.getString("map","");
|
||||
map_index = n.getInteger("mapindex", -1);
|
||||
map = world.maps.get(map_index);
|
||||
@ -319,9 +321,9 @@ public class MapManager {
|
||||
HashMap<String,Object> v = new HashMap<String,Object>();
|
||||
|
||||
v.put("world", world.world.getName());
|
||||
v.put("locX", loc.getBlockX());
|
||||
v.put("locY", loc.getBlockY());
|
||||
v.put("locZ", loc.getBlockZ());
|
||||
v.put("locX", loc.x);
|
||||
v.put("locY", loc.y);
|
||||
v.put("locZ", loc.z);
|
||||
v.put("mapindex", map_index);
|
||||
v.put("map", map.getName());
|
||||
v.put("found", found.save());
|
||||
@ -354,13 +356,13 @@ public class MapManager {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "world=" + world.world.getName() + ", map=" + map;
|
||||
return "world=" + world.getName() + ", map=" + map;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
if(tile0 == null) {
|
||||
synchronized(lock) {
|
||||
active_renders.remove(world.world.getName());
|
||||
active_renders.remove(world.getName());
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -459,7 +461,7 @@ public class MapManager {
|
||||
}
|
||||
if(!updaterender) { /* Only add other seed points for fullrender */
|
||||
/* Add spawn location too (helps with some worlds where 0,64,0 may not be generated */
|
||||
Location sloc = world.world.getSpawnLocation();
|
||||
DynmapLocation sloc = world.getSpawnLocation();
|
||||
for (MapTile mt : map.getTiles(sloc)) {
|
||||
if (!found.getFlag(mt.tileOrdinalX(), mt.tileOrdinalY())) {
|
||||
found.setFlag(mt.tileOrdinalX(), mt.tileOrdinalY(), true);
|
||||
@ -467,7 +469,7 @@ public class MapManager {
|
||||
}
|
||||
}
|
||||
if(world.seedloc != null) {
|
||||
for(Location seed : world.seedloc) {
|
||||
for(DynmapLocation seed : world.seedloc) {
|
||||
for (MapTile mt : map.getTiles(seed)) {
|
||||
if (!found.getFlag(mt.tileOrdinalX(),mt.tileOrdinalY())) {
|
||||
found.setFlag(mt.tileOrdinalX(),mt.tileOrdinalY(), true);
|
||||
@ -659,7 +661,7 @@ public class MapManager {
|
||||
boolean isday = new_servertime >= 0 && new_servertime < 13700;
|
||||
w.servertime = new_servertime;
|
||||
if(wasday != isday) {
|
||||
pushUpdate(w.world, new Client.DayNight(isday));
|
||||
pushUpdate(w, new Client.DayNight(isday));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -744,13 +746,13 @@ public class MapManager {
|
||||
}
|
||||
}
|
||||
|
||||
void renderFullWorld(Location l, CommandSender sender, String mapname, boolean update) {
|
||||
DynmapWorld world = getWorld(l.getWorld().getName());
|
||||
void renderFullWorld(DynmapLocation l, CommandSender sender, String mapname, boolean update) {
|
||||
DynmapWorld world = getWorld(l.world);
|
||||
if (world == null) {
|
||||
sender.sendMessage("Could not render: world '" + l.getWorld().getName() + "' not defined in configuration.");
|
||||
sender.sendMessage("Could not render: world '" + l.world + "' not defined in configuration.");
|
||||
return;
|
||||
}
|
||||
String wname = l.getWorld().getName();
|
||||
String wname = l.world;
|
||||
FullWorldRenderState rndr;
|
||||
synchronized(lock) {
|
||||
rndr = active_renders.get(wname);
|
||||
@ -770,13 +772,13 @@ public class MapManager {
|
||||
sender.sendMessage("Full render starting on world '" + wname + "'...");
|
||||
}
|
||||
|
||||
void renderWorldRadius(Location l, CommandSender sender, String mapname, int radius) {
|
||||
DynmapWorld world = getWorld(l.getWorld().getName());
|
||||
void renderWorldRadius(DynmapLocation l, CommandSender sender, String mapname, int radius) {
|
||||
DynmapWorld world = getWorld(l.world);
|
||||
if (world == null) {
|
||||
sender.sendMessage("Could not render: world '" + l.getWorld().getName() + "' not defined in configuration.");
|
||||
sender.sendMessage("Could not render: world '" + l.world + "' not defined in configuration.");
|
||||
return;
|
||||
}
|
||||
String wname = l.getWorld().getName();
|
||||
String wname = l.world;
|
||||
FullWorldRenderState rndr;
|
||||
synchronized(lock) {
|
||||
rndr = active_renders.get(wname);
|
||||
@ -847,7 +849,7 @@ public class MapManager {
|
||||
Log.info("Loaded " + dynmapWorld.maps.size() + " maps of world '" + worldName + "'.");
|
||||
|
||||
List<ConfigurationNode> loclist = worldConfiguration.getNodes("fullrenderlocations");
|
||||
dynmapWorld.seedloc = new ArrayList<Location>();
|
||||
dynmapWorld.seedloc = new ArrayList<DynmapLocation>();
|
||||
dynmapWorld.servertime = (int)(w.getTime() % 24000);
|
||||
dynmapWorld.sendposition = worldConfiguration.getBoolean("sendposition", true);
|
||||
dynmapWorld.sendhealth = worldConfiguration.getBoolean("sendhealth", true);
|
||||
@ -856,7 +858,7 @@ public class MapManager {
|
||||
dynmapWorld.worldtilepath = new File(DynmapPlugin.tilesDirectory, w.getName());
|
||||
if(loclist != null) {
|
||||
for(ConfigurationNode loc : loclist) {
|
||||
Location lx = new Location(w, loc.getDouble("x", 0), loc.getDouble("y", 64), loc.getDouble("z", 0));
|
||||
DynmapLocation lx = new DynmapLocation(w.getName(), loc.getInteger("x", 0), loc.getInteger("y", 64), loc.getInteger("z", 0));
|
||||
dynmapWorld.seedloc.add(lx);
|
||||
}
|
||||
}
|
||||
@ -872,7 +874,7 @@ public class MapManager {
|
||||
lim.z1 = vis.getInteger("z1", 0);
|
||||
dynmapWorld.visibility_limits.add(lim);
|
||||
/* Also, add a seed location for the middle of each visible area */
|
||||
dynmapWorld.seedloc.add(new Location(w, (lim.x0+lim.x1)/2, 64, (lim.z0+lim.z1)/2));
|
||||
dynmapWorld.seedloc.add(new DynmapLocation(w.getName(), (lim.x0+lim.x1)/2, 64, (lim.z0+lim.z1)/2));
|
||||
}
|
||||
}
|
||||
/* Load hidden limits, if any are defined */
|
||||
@ -1008,8 +1010,8 @@ public class MapManager {
|
||||
}
|
||||
}
|
||||
|
||||
public int touch(Location l, String reason) {
|
||||
DynmapWorld world = getWorld(l.getWorld().getName());
|
||||
public int touch(DynmapLocation l, String reason) {
|
||||
DynmapWorld world = getWorld(l.world);
|
||||
if (world == null)
|
||||
return 0;
|
||||
int invalidates = 0;
|
||||
@ -1035,13 +1037,13 @@ public class MapManager {
|
||||
return invalidates;
|
||||
}
|
||||
|
||||
public int touchVolume(Location l0, Location l1, String reason) {
|
||||
DynmapWorld world = getWorld(l0.getWorld().getName());
|
||||
public int touchVolume(DynmapLocation l, int sx, int sy, int sz, String reason) {
|
||||
DynmapWorld world = getWorld(l.world);
|
||||
if (world == null)
|
||||
return 0;
|
||||
int invalidates = 0;
|
||||
for (int i = 0; i < world.maps.size(); i++) {
|
||||
MapTile[] tiles = world.maps.get(i).getTiles(l0, l1);
|
||||
MapTile[] tiles = world.maps.get(i).getTiles(l, sx, sy, sz);
|
||||
for (int j = 0; j < tiles.length; j++) {
|
||||
if(invalidateTile(tiles[j]))
|
||||
invalidates++;
|
||||
@ -1111,14 +1113,8 @@ public class MapManager {
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap<World, File> worldTileDirectories = new HashMap<World, File>();
|
||||
public File getTileFile(MapTile tile) {
|
||||
World world = tile.getWorld();
|
||||
File worldTileDirectory = worldTileDirectories.get(world);
|
||||
if (worldTileDirectory == null) {
|
||||
worldTileDirectory = new File(DynmapPlugin.tilesDirectory, tile.getWorld().getName());
|
||||
worldTileDirectories.put(world, worldTileDirectory);
|
||||
}
|
||||
File worldTileDirectory = tile.getDynmapWorld().worldtilepath;
|
||||
if (!worldTileDirectory.isDirectory() && !worldTileDirectory.mkdirs()) {
|
||||
Log.warning("Could not create directory for tiles ('" + worldTileDirectory + "').");
|
||||
}
|
||||
@ -1132,7 +1128,7 @@ public class MapManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void pushUpdate(World world, Client.Update update) {
|
||||
public void pushUpdate(DynmapWorld world, Client.Update update) {
|
||||
pushUpdate(world.getName(), update);
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,9 @@
|
||||
package org.dynmap;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.kzedmap.MapTileRenderer;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
|
||||
public abstract class MapTile {
|
||||
@ -16,10 +13,6 @@ public abstract class MapTile {
|
||||
public abstract List<DynmapChunk> getRequiredChunks();
|
||||
public abstract MapTile[] getAdjecentTiles();
|
||||
|
||||
public World getWorld() {
|
||||
return world.world;
|
||||
}
|
||||
|
||||
public DynmapWorld getDynmapWorld() {
|
||||
return world;
|
||||
}
|
||||
@ -34,7 +27,7 @@ public abstract class MapTile {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getFilename().hashCode() ^ getWorld().hashCode();
|
||||
return getFilename().hashCode() ^ world.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,7 +4,6 @@ import java.io.File;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.dynmap.utils.TileFlags;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
@ -38,9 +37,9 @@ public abstract class MapType {
|
||||
public ZoomInfo(String pre, int bg) { prefix = pre; background_argb = bg; }
|
||||
}
|
||||
|
||||
public abstract MapTile[] getTiles(Location l);
|
||||
public abstract MapTile[] getTiles(DynmapLocation l);
|
||||
|
||||
public abstract MapTile[] getTiles(Location l0, Location l1);
|
||||
public abstract MapTile[] getTiles(DynmapLocation l0, int sx, int sy, int sz);
|
||||
|
||||
public abstract MapTile[] getAdjecentTiles(MapTile tile);
|
||||
|
||||
|
@ -8,7 +8,6 @@ import java.net.URL;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
@ -21,7 +20,6 @@ import org.dynmap.utils.FileLockManager;
|
||||
* Listen for player logins, and process player faces by fetching skins *
|
||||
*/
|
||||
public class PlayerFaces {
|
||||
private DynmapPlugin plugin;
|
||||
private File facesdir;
|
||||
private File faces8x8dir;
|
||||
private File faces16x16dir;
|
||||
@ -146,7 +144,6 @@ public class PlayerFaces {
|
||||
}
|
||||
}
|
||||
public PlayerFaces(DynmapPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
fetchskins = plugin.configuration.getBoolean("fetchskins", true); /* Control whether to fetch skins */
|
||||
refreshskins = plugin.configuration.getBoolean("refreshskins", true); /* Control whether to update existing fetched skins or faces */
|
||||
|
||||
|
@ -122,10 +122,14 @@ public class PlayerList {
|
||||
}
|
||||
|
||||
public boolean isVisiblePlayer(Player p) {
|
||||
boolean useWhitelist = configuration.getBoolean("display-whitelist", false);
|
||||
return (!(useWhitelist ^ hiddenPlayerNames.contains(p.getName().toLowerCase())));
|
||||
return isVisiblePlayer(p.getName());
|
||||
}
|
||||
|
||||
|
||||
public boolean isVisiblePlayer(String p) {
|
||||
boolean useWhitelist = configuration.getBoolean("display-whitelist", false);
|
||||
return (!(useWhitelist ^ hiddenPlayerNames.contains(p.toLowerCase())));
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this from server thread to update player list safely
|
||||
*/
|
||||
|
@ -6,7 +6,6 @@ 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.bukkit.plugin.PluginManager;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class SimpleWebChatComponent extends Component {
|
||||
|
@ -2,11 +2,6 @@ package org.dynmap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class UpdateQueue {
|
||||
public Object lock = new Object();
|
||||
|
@ -9,14 +9,12 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.dynmap.Client;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ColorScheme;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.DynmapPlugin.CompassMode;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.TileHashManager;
|
||||
@ -87,31 +85,21 @@ public class FlatMap extends MapType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location l) {
|
||||
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) };
|
||||
public MapTile[] getTiles(DynmapLocation l) {
|
||||
DynmapWorld w = MapManager.mapman.getWorld(l.world);
|
||||
return new MapTile[] { new FlatMapTile(w, this, (int) Math.floor(l.x / 128.0), (int) Math.floor(l.z / 128.0), 128) };
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location l0, Location l1) {
|
||||
DynmapWorld w = MapManager.mapman.getWorld(l0.getWorld().getName());
|
||||
public MapTile[] getTiles(DynmapLocation l, int sx, int sy, int sz) {
|
||||
DynmapWorld w = MapManager.mapman.getWorld(l.world);
|
||||
int xmin, xmax, zmin, zmax;
|
||||
if(l0.getBlockX() < l1.getBlockX()) {
|
||||
xmin = l0.getBlockX() >> 7;
|
||||
xmax = l1.getBlockX() >> 7;
|
||||
}
|
||||
else {
|
||||
xmin = l1.getBlockX() >> 7;
|
||||
xmax = l0.getBlockX() >> 7;
|
||||
}
|
||||
if(l0.getBlockZ() < l1.getBlockZ()) {
|
||||
zmin = l0.getBlockZ() >> 7;
|
||||
zmax = l1.getBlockZ() >> 7;
|
||||
}
|
||||
else {
|
||||
zmin = l1.getBlockZ() >> 7;
|
||||
zmax = l0.getBlockZ() >> 7;
|
||||
}
|
||||
|
||||
xmin = l.x >> 7;
|
||||
zmin = l.z >> 7;
|
||||
xmax = (l.x + sx) >> 7;
|
||||
zmax = (l.z + sz) >> 7;
|
||||
|
||||
ArrayList<MapTile> rslt = new ArrayList<MapTile>();
|
||||
for(int i = xmin; i <= xmax; i++) {
|
||||
for(int j = zmin; j < zmax; j++) {
|
||||
@ -152,8 +140,7 @@ public class FlatMap extends MapType {
|
||||
|
||||
public boolean render(MapChunkCache cache, MapTile tile, File outputFile) {
|
||||
FlatMapTile t = (FlatMapTile) tile;
|
||||
World w = t.getWorld();
|
||||
boolean isnether = (w.getEnvironment() == Environment.NETHER) && (maximumHeight == 127);
|
||||
boolean isnether = t.getDynmapWorld().isNether() && (maximumHeight == 127);
|
||||
|
||||
boolean didwrite = false;
|
||||
Color rslt = new Color();
|
||||
@ -314,7 +301,7 @@ public class FlatMap extends MapType {
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + outputFile.getPath(), e);
|
||||
}
|
||||
MapManager.mapman.pushUpdate(tile.getWorld(), new Client.Tile(tile.getFilename()));
|
||||
MapManager.mapman.pushUpdate(tile.getDynmapWorld(), new Client.Tile(tile.getFilename()));
|
||||
hashman.updateHashCode(tile.getKey(prefix), null, t.x, t.y, crc);
|
||||
tile.getDynmapWorld().enqueueZoomOutUpdate(outputFile);
|
||||
tile_update = true;
|
||||
@ -346,7 +333,7 @@ public class FlatMap extends MapType {
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + dayfile.getPath(), e);
|
||||
}
|
||||
MapManager.mapman.pushUpdate(tile.getWorld(), new Client.Tile(tile.getDayFilename()));
|
||||
MapManager.mapman.pushUpdate(tile.getDynmapWorld(), new Client.Tile(tile.getDayFilename()));
|
||||
hashman.updateHashCode(tile.getKey(prefix), "day", t.x, t.y, crc);
|
||||
tile.getDynmapWorld().enqueueZoomOutUpdate(dayfile);
|
||||
tile_update = true;
|
||||
@ -540,7 +527,7 @@ public class FlatMap extends MapType {
|
||||
return fname_day;
|
||||
}
|
||||
public String toString() {
|
||||
return getWorld().getName() + ":" + getFilename();
|
||||
return world.getName() + ":" + getFilename();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,9 +1,7 @@
|
||||
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.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
|
@ -1,11 +1,7 @@
|
||||
package org.dynmap.hdmap;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ColorScheme;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.hdmap.DefaultHDShader.BiomeColorOption;
|
||||
import org.json.simple.JSONObject;
|
||||
import static org.dynmap.JSONUtils.s;
|
||||
|
||||
|
@ -2,9 +2,6 @@ package org.dynmap.hdmap;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -1,8 +1,6 @@
|
||||
package org.dynmap.hdmap;
|
||||
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public interface HDLighting {
|
||||
|
@ -6,24 +6,19 @@ import static org.dynmap.JSONUtils.s;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Location;
|
||||
import org.dynmap.Client;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapPlugin;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.MapType;
|
||||
import org.dynmap.debug.Debug;
|
||||
import org.dynmap.kzedmap.MapTileRenderer;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.TileFlags;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.avaje.ebean.text.StringParser;
|
||||
|
||||
public class HDMap extends MapType {
|
||||
|
||||
private String name;
|
||||
@ -133,13 +128,13 @@ public class HDMap extends MapType {
|
||||
public HDLighting getLighting() { return lighting; }
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location loc) {
|
||||
public MapTile[] getTiles(DynmapLocation loc) {
|
||||
return perspective.getTiles(loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location loc0, Location loc1) {
|
||||
return perspective.getTiles(loc0, loc1);
|
||||
public MapTile[] getTiles(DynmapLocation loc, int sx, int sy, int sz) {
|
||||
return perspective.getTiles(loc, sx, sy, sz);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -324,7 +319,7 @@ public class HDMap extends MapType {
|
||||
/* Otherwise, delete tile */
|
||||
f.delete();
|
||||
/* Push updates, clear hash code, and signal zoom tile update */
|
||||
MapManager.mapman.pushUpdate(world.world,
|
||||
MapManager.mapman.pushUpdate(world,
|
||||
new Client.Tile(day?tile.getDayFilename(prefix, getImageFormat()):tile.getFilename(prefix, getImageFormat())));
|
||||
MapManager.mapman.hashman.updateHashCode(tile.getKey(prefix), day?"day":null, tile.tx, tile.ty, -1);
|
||||
world.enqueueZoomOutUpdate(f);
|
||||
|
@ -1,23 +1,15 @@
|
||||
package org.dynmap.hdmap;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapPlugin;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.MapType;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
@ -122,7 +114,7 @@ public class HDMapManager {
|
||||
* Initialize shader states for all shaders for given tile
|
||||
*/
|
||||
public HDShaderState[] getShaderStateForTile(HDMapTile tile, MapChunkCache cache, MapIterator mapiter, String mapname) {
|
||||
DynmapWorld w = MapManager.mapman.worldsLookup.get(tile.getWorld().getName());
|
||||
DynmapWorld w = MapManager.mapman.worldsLookup.get(tile.getDynmapWorld().getName());
|
||||
if(w == null) return new HDShaderState[0];
|
||||
ArrayList<HDShaderState> shaders = new ArrayList<HDShaderState>();
|
||||
for(MapType map : w.maps) {
|
||||
@ -163,7 +155,7 @@ public class HDMapManager {
|
||||
private HashMap<String, boolean[]> cached_data_flags_by_world_perspective = new HashMap<String, boolean[]>();
|
||||
|
||||
private boolean[] getCachedFlags(HDMapTile t) {
|
||||
String w = t.getWorld().getName();
|
||||
String w = t.getDynmapWorld().getName();
|
||||
String k = w + "/" + t.perspective.getName();
|
||||
boolean[] flags = cached_data_flags_by_world_perspective.get(k);
|
||||
if(flags != null)
|
||||
|
@ -7,8 +7,6 @@ import org.dynmap.MapType;
|
||||
|
||||
import java.util.List;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.kzedmap.KzedMap;
|
||||
import org.dynmap.kzedmap.MapTileRenderer;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
|
||||
public class HDMapTile extends MapTile {
|
||||
@ -58,7 +56,7 @@ public class HDMapTile extends MapTile {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return tx ^ ty ^ perspective.getName().hashCode() ^ getWorld().getName().hashCode();
|
||||
return tx ^ ty ^ perspective.getName().hashCode() ^ world.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,16 +68,16 @@ public class HDMapTile extends MapTile {
|
||||
}
|
||||
|
||||
public boolean equals(HDMapTile o) {
|
||||
return o.tx == tx && o.ty == ty && (perspective == o.perspective) && (o.getWorld() == getWorld());
|
||||
return o.tx == tx && o.ty == ty && (perspective == o.perspective) && (o.world == world);
|
||||
}
|
||||
|
||||
public String getKey(String prefix) {
|
||||
return getWorld().getName() + "." + prefix;
|
||||
return world.getName() + "." + prefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getWorld().getName() + ":" + getFilename();
|
||||
return world.getName() + ":" + getFilename();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,8 +2,8 @@ package org.dynmap.hdmap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.json.simple.JSONObject;
|
||||
@ -12,9 +12,9 @@ public interface HDPerspective {
|
||||
/* Get name of perspective */
|
||||
String getName();
|
||||
/* Get tiles invalidated by change at given location */
|
||||
MapTile[] getTiles(Location loc);
|
||||
MapTile[] getTiles(DynmapLocation loc);
|
||||
/* Get tiles invalidated by change at given volume, defined by 2 opposite corner locations */
|
||||
MapTile[] getTiles(Location loc0, Location loc1);
|
||||
MapTile[] getTiles(DynmapLocation loc0, int sx, int sy, int sz);
|
||||
/* Get tiles adjacent to given tile */
|
||||
MapTile[] getAdjecentTiles(MapTile tile);
|
||||
/* Get chunks needed for given tile */
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.dynmap.hdmap;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.dynmap.hdmap;
|
||||
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.utils.Vector3D;
|
||||
|
||||
/**
|
||||
* This interface is used to define the operational state of a renderer during raytracing
|
||||
|
@ -10,14 +10,11 @@ import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.dynmap.Client;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.DynmapPlugin.CompassMode;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
@ -29,7 +26,6 @@ import org.dynmap.debug.Debug;
|
||||
import org.dynmap.utils.MapIterator.BlockStep;
|
||||
import org.dynmap.hdmap.TexturePack.BlockTransparency;
|
||||
import org.dynmap.hdmap.TexturePack.HDTextureMap;
|
||||
import org.dynmap.kzedmap.KzedMap;
|
||||
import org.dynmap.utils.DynmapBufferedImage;
|
||||
import org.dynmap.utils.FileLockManager;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
@ -74,18 +70,12 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
public static final double MAX_SCALE = 64;
|
||||
public static final double MIN_SCALE = 1;
|
||||
|
||||
private boolean need_skylightlevel = false;
|
||||
private boolean need_emittedlightlevel = false;
|
||||
private boolean need_biomedata = false;
|
||||
private boolean need_rawbiomedata = false;
|
||||
|
||||
private static final int CHEST_BLKTYPEID = 54;
|
||||
private static final int FENCE_BLKTYPEID = 85;
|
||||
private static final int REDSTONE_BLKTYPEID = 55;
|
||||
private static final int IRONFENCE_BLKTYPEID = 101;
|
||||
private static final int GLASSPANE_BLKTYPEID = 102;
|
||||
private static final int FENCEGATE_BLKTYPEID = 107;
|
||||
private static final int NETHERFENCE_BLKTYPEID = 113;
|
||||
|
||||
private enum ChestData {
|
||||
SINGLE_WEST, SINGLE_SOUTH, SINGLE_EAST, SINGLE_NORTH, LEFT_WEST, LEFT_SOUTH, LEFT_EAST, LEFT_NORTH, RIGHT_WEST, RIGHT_SOUTH, RIGHT_EAST, RIGHT_NORTH
|
||||
@ -826,8 +816,8 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location loc) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(loc.getWorld().getName());
|
||||
public MapTile[] getTiles(DynmapLocation loc) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(loc.world);
|
||||
HashSet<MapTile> tiles = new HashSet<MapTile>();
|
||||
Vector3D block = new Vector3D();
|
||||
block.setFromLocation(loc); /* Get coordinate for block */
|
||||
@ -853,35 +843,17 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location loc0, Location loc1) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(loc0.getWorld().getName());
|
||||
public MapTile[] getTiles(DynmapLocation loc, int sx, int sy, int sz) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(loc.world);
|
||||
HashSet<MapTile> tiles = new HashSet<MapTile>();
|
||||
Vector3D blocks[] = new Vector3D[] { new Vector3D(), new Vector3D() };
|
||||
/* Get ordered point - 0=minX,Y,Z, 1=maxX,Y,Z */
|
||||
if(loc0.getBlockX() < loc1.getBlockX()) {
|
||||
blocks[0].x = loc0.getBlockX() - 1;
|
||||
blocks[1].x = loc1.getBlockX() + 1;
|
||||
}
|
||||
else {
|
||||
blocks[0].x = loc1.getBlockX() - 1;
|
||||
blocks[1].x = loc0.getBlockX() + 1;
|
||||
}
|
||||
if(loc0.getBlockY() < loc1.getBlockY()) {
|
||||
blocks[0].y = loc0.getBlockY() - 1;
|
||||
blocks[1].y = loc1.getBlockY() + 1;
|
||||
}
|
||||
else {
|
||||
blocks[0].y = loc1.getBlockY() - 1;
|
||||
blocks[1].y = loc0.getBlockY() + 1;
|
||||
}
|
||||
if(loc0.getBlockZ() < loc1.getBlockZ()) {
|
||||
blocks[0].z = loc0.getBlockZ() - 1;
|
||||
blocks[1].z = loc1.getBlockZ() + 1;
|
||||
}
|
||||
else {
|
||||
blocks[0].z = loc1.getBlockZ() - 1;
|
||||
blocks[1].z = loc0.getBlockZ() + 1;
|
||||
}
|
||||
blocks[0].x = loc.x - 1;
|
||||
blocks[0].y = loc.y - 1;
|
||||
blocks[0].z = loc.z - 1;
|
||||
blocks[1].x = loc.x + sx;
|
||||
blocks[1].y = loc.y + sy;
|
||||
blocks[1].z = loc.z + sz;
|
||||
|
||||
Vector3D corner = new Vector3D();
|
||||
Vector3D tcorner = new Vector3D();
|
||||
int mintilex = Integer.MAX_VALUE;
|
||||
@ -1089,7 +1061,7 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
if(numshaders == 0)
|
||||
return false;
|
||||
/* Check if nether world */
|
||||
boolean isnether = tile.getWorld().getEnvironment() == Environment.NETHER;
|
||||
boolean isnether = tile.getDynmapWorld().isNether();
|
||||
/* Create buffered image for each */
|
||||
DynmapBufferedImage im[] = new DynmapBufferedImage[numshaders];
|
||||
DynmapBufferedImage dayim[] = new DynmapBufferedImage[numshaders];
|
||||
@ -1100,12 +1072,7 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
int bgnight[] = new int[numshaders];
|
||||
|
||||
for(int i = 0; i < numshaders; i++) {
|
||||
HDShader shader = shaderstate[i].getShader();
|
||||
HDLighting lighting = shaderstate[i].getLighting();
|
||||
if(shader.isEmittedLightLevelNeeded() || lighting.isEmittedLightLevelNeeded())
|
||||
need_emittedlightlevel = true;
|
||||
if(shader.isSkyLightLevelNeeded() || lighting.isSkyLightLevelNeeded())
|
||||
need_skylightlevel = true;
|
||||
im[i] = DynmapBufferedImage.allocateBufferedImage(tileWidth, tileHeight);
|
||||
argb_buf[i] = im[i].argb_buf;
|
||||
if(lighting.isNightAndDayEnabled()) {
|
||||
@ -1196,7 +1163,7 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + f.getPath(), e);
|
||||
}
|
||||
MapManager.mapman.pushUpdate(tile.getWorld(), new Client.Tile(fname));
|
||||
MapManager.mapman.pushUpdate(tile.getDynmapWorld(), new Client.Tile(fname));
|
||||
hashman.updateHashCode(tile.getKey(prefix), null, tile.tx, tile.ty, crc);
|
||||
tile.getDynmapWorld().enqueueZoomOutUpdate(f);
|
||||
tile_update = true;
|
||||
@ -1229,7 +1196,7 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + f.getPath(), e);
|
||||
}
|
||||
MapManager.mapman.pushUpdate(tile.getWorld(), new Client.Tile(fname));
|
||||
MapManager.mapman.pushUpdate(tile.getDynmapWorld(), new Client.Tile(fname));
|
||||
hashman.updateHashCode(tile.getKey(prefix), "day", tile.tx, tile.ty, crc);
|
||||
tile.getDynmapWorld().enqueueZoomOutUpdate(f);
|
||||
tile_update = true;
|
||||
|
@ -1,11 +1,8 @@
|
||||
package org.dynmap.hdmap;
|
||||
|
||||
import static org.dynmap.JSONUtils.s;
|
||||
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.Log;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class ShadowHDLighting extends DefaultHDLighting {
|
||||
|
||||
|
@ -4,8 +4,6 @@ import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@ -21,7 +19,6 @@ import java.util.zip.ZipFile;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
@ -30,7 +27,6 @@ import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.utils.DynmapBufferedImage;
|
||||
import org.dynmap.utils.MapIterator.BlockStep;
|
||||
import org.dynmap.kzedmap.KzedMap;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
|
||||
/**
|
||||
|
@ -2,7 +2,6 @@ package org.dynmap.hdmap;
|
||||
|
||||
import static org.dynmap.JSONUtils.s;
|
||||
|
||||
import org.bukkit.World.Environment;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.Log;
|
||||
|
@ -2,11 +2,9 @@ package org.dynmap.hdmap;
|
||||
|
||||
import static org.dynmap.JSONUtils.s;
|
||||
|
||||
import org.bukkit.World.Environment;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
import org.dynmap.utils.MapIterator.BlockStep;
|
||||
|
@ -5,7 +5,6 @@ import static org.dynmap.JSONUtils.s;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.dynmap.ChatEvent;
|
||||
import org.dynmap.Client;
|
||||
import org.dynmap.Component;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package org.dynmap.kzedmap;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
import org.dynmap.utils.MapIterator.BlockStep;
|
||||
|
||||
@ -16,7 +16,7 @@ public class CaveTileRenderer extends DefaultTileRenderer {
|
||||
public boolean isNightAndDayEnabled() { return false; }
|
||||
|
||||
@Override
|
||||
protected void scan(World world, int seq, boolean isnether, final Color result, final Color result_day,
|
||||
protected void scan(DynmapWorld world, int seq, boolean isnether, final Color result, final Color result_day,
|
||||
MapIterator mapiter) {
|
||||
boolean air = true;
|
||||
int emitted = 0;
|
||||
|
@ -9,8 +9,6 @@ import java.util.HashSet;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.dynmap.Client;
|
||||
import org.dynmap.Color;
|
||||
@ -119,8 +117,8 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
}
|
||||
|
||||
public boolean render(MapChunkCache cache, KzedMapTile tile, File outputFile) {
|
||||
World world = tile.getWorld();
|
||||
boolean isnether = (world.getEnvironment() == Environment.NETHER);
|
||||
DynmapWorld world = tile.getDynmapWorld();
|
||||
boolean isnether = world.isNether();
|
||||
DynmapBufferedImage im = DynmapBufferedImage.allocateBufferedImage(KzedMap.tileWidth, KzedMap.tileHeight);
|
||||
DynmapBufferedImage zim = DynmapBufferedImage.allocateBufferedImage(KzedMap.tileWidth/2, KzedMap.tileHeight/2);
|
||||
|
||||
@ -278,7 +276,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + fname.getPath(), e);
|
||||
}
|
||||
MapManager.mapman.pushUpdate(mtile.getWorld(), new Client.Tile(mtile.getFilename()));
|
||||
MapManager.mapman.pushUpdate(mtile.getDynmapWorld(), new Client.Tile(mtile.getFilename()));
|
||||
hashman.updateHashCode(mtile.getKey(prefix), null, tx, ty, crc);
|
||||
updated_fname = true;
|
||||
didwrite = true;
|
||||
@ -309,7 +307,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + dfname.getPath(), e);
|
||||
}
|
||||
MapManager.mapman.pushUpdate(mtile.getWorld(), new Client.Tile(mtile.getDayFilename()));
|
||||
MapManager.mapman.pushUpdate(mtile.getDynmapWorld(), new Client.Tile(mtile.getDayFilename()));
|
||||
hashman.updateHashCode(mtile.getKey(prefix), "day", tx, ty, crc);
|
||||
updated_dfname = true;
|
||||
didwrite = true;
|
||||
@ -328,7 +326,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
try {
|
||||
if(updated_fname || (!zoomFile.exists())) {
|
||||
saveZoomedTile(zmtile, zoomFile, zimg, ox, oy, null);
|
||||
MapManager.mapman.pushUpdate(zmtile.getWorld(),
|
||||
MapManager.mapman.pushUpdate(zmtile.getDynmapWorld(),
|
||||
new Client.Tile(zmtile.getFilename()));
|
||||
zmtile.getDynmapWorld().enqueueZoomOutUpdate(zoomFile);
|
||||
ztile_updated = true;
|
||||
@ -346,7 +344,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
try {
|
||||
if(updated_dfname || (!zoomFile_day.exists())) {
|
||||
saveZoomedTile(zmtile, zoomFile_day, zimg_day, ox, oy, "day");
|
||||
MapManager.mapman.pushUpdate(zmtile.getWorld(),
|
||||
MapManager.mapman.pushUpdate(zmtile.getDynmapWorld(),
|
||||
new Client.Tile(zmtile.getDayFilename()));
|
||||
zmtile.getDynmapWorld().enqueueZoomOutUpdate(zoomFile_day);
|
||||
ztile_updated = true;
|
||||
@ -403,7 +401,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
zIm.flush();
|
||||
|
||||
}
|
||||
protected void scan(World world, int seq, boolean isnether, final Color result, final Color result_day,
|
||||
protected void scan(DynmapWorld world, int seq, boolean isnether, final Color result, final Color result_day,
|
||||
MapIterator mapiter) {
|
||||
int lightlevel = 15;
|
||||
int lightlevel_day = 15;
|
||||
|
@ -3,9 +3,9 @@ package org.dynmap.kzedmap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
import org.dynmap.utils.MapIterator.BlockStep;
|
||||
|
||||
@ -21,7 +21,7 @@ public class HighlightTileRenderer extends DefaultTileRenderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void scan(World world,int seq, boolean isnether, final Color result, final Color result_day,
|
||||
protected void scan(DynmapWorld world,int seq, boolean isnether, final Color result, final Color result_day,
|
||||
MapIterator mapiter) {
|
||||
result.setTransparent();
|
||||
for (;;) {
|
||||
|
@ -7,9 +7,9 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.MapTile;
|
||||
@ -50,12 +50,12 @@ public class KzedMap extends MapType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location l) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(l.getWorld().getName());
|
||||
public MapTile[] getTiles(DynmapLocation l) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(l.world);
|
||||
|
||||
int x = l.getBlockX();
|
||||
int y = l.getBlockY();
|
||||
int z = l.getBlockZ();
|
||||
int x = l.x;
|
||||
int y = l.y;
|
||||
int z = l.z;
|
||||
|
||||
int dx = x - anchorx;
|
||||
int dy = y - anchory;
|
||||
@ -99,18 +99,18 @@ public class KzedMap extends MapType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location loc0, Location loc1) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(loc0.getWorld().getName());
|
||||
public MapTile[] getTiles(DynmapLocation loc, int sx, int sy, int sz) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(loc.world);
|
||||
ArrayList<MapTile> tiles = new ArrayList<MapTile>();
|
||||
/* Transform both to tile coordinates */
|
||||
int dx = loc0.getBlockX() - anchorx;
|
||||
int dy = loc0.getBlockY() - anchory;
|
||||
int dz = loc0.getBlockZ() - anchorz;
|
||||
int dx = loc.x - anchorx;
|
||||
int dy = loc.y - anchory;
|
||||
int dz = loc.z - anchorz;
|
||||
int px0 = dx + dz;
|
||||
int py0 = dx - dz - dy;
|
||||
dx = loc0.getBlockX() - anchorx;
|
||||
dy = loc0.getBlockY() - anchory;
|
||||
dz = loc0.getBlockZ() - anchorz;
|
||||
dx = loc.x + sx - anchorx;
|
||||
dy = loc.y + sy - anchory;
|
||||
dz = loc.z + sz - anchorz;
|
||||
int px1 = dx + dz;
|
||||
int py1 = dx - dz - dy;
|
||||
/* Compute ranges */
|
||||
|
@ -9,7 +9,6 @@ import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.flat.FlatMap;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
|
||||
public class KzedMapTile extends MapTile {
|
||||
@ -83,7 +82,7 @@ public class KzedMapTile extends MapTile {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return px ^ py ^ map.getName().hashCode() ^ getWorld().getName().hashCode();
|
||||
return px ^ py ^ map.getName().hashCode() ^ world.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -95,15 +94,15 @@ public class KzedMapTile extends MapTile {
|
||||
}
|
||||
|
||||
public boolean equals(KzedMapTile o) {
|
||||
return o.px == px && o.py == py && (o.map == map) && (o.getWorld() == getWorld());
|
||||
return o.px == px && o.py == py && (o.map == map) && (o.world == world);
|
||||
}
|
||||
|
||||
public String getKey(String prefix) {
|
||||
return getWorld().getName() + "." + prefix;
|
||||
return world.getName() + "." + prefix;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return getWorld().getName() + ":" + getFilename();
|
||||
return world.getName() + ":" + getFilename();
|
||||
}
|
||||
|
||||
public boolean render(MapChunkCache cache, String mapname) {
|
||||
|
@ -73,7 +73,7 @@ public class KzedZoomedMapTile extends MapTile {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getFilename().hashCode() ^ getWorld().hashCode();
|
||||
return getFilename().hashCode() ^ world.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -86,7 +86,7 @@ public class KzedZoomedMapTile extends MapTile {
|
||||
|
||||
|
||||
public String getKey(String prefix) {
|
||||
return getWorld().getName() + ".z" + prefix;
|
||||
return world.getName() + ".z" + prefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,7 +10,6 @@ import java.util.TreeSet;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
|
@ -8,8 +8,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Location;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.DynmapLocation;
|
||||
|
||||
public class SnapshotCache {
|
||||
private CacheHashMap snapcache;
|
||||
@ -50,8 +49,8 @@ public class SnapshotCache {
|
||||
snapcache = new CacheHashMap(max_size);
|
||||
refqueue = new ReferenceQueue<ChunkSnapshot>();
|
||||
}
|
||||
private String getKey(Location loc) {
|
||||
return loc.getWorld().getName() + ":" + (loc.getBlockX()>>4) + ":" + (loc.getBlockZ()>>4);
|
||||
private String getKey(DynmapLocation loc) {
|
||||
return loc.world + ":" + (loc.x>>4) + ":" + (loc.z>>4);
|
||||
}
|
||||
private String getKey(String w, int cx, int cz) {
|
||||
return w + ":" + cx + ":" + cz;
|
||||
@ -59,7 +58,7 @@ public class SnapshotCache {
|
||||
/**
|
||||
* Invalidate cached snapshot, if in cache
|
||||
*/
|
||||
public void invalidateSnapshot(Location loc) {
|
||||
public void invalidateSnapshot(DynmapLocation loc) {
|
||||
String key = getKey(loc);
|
||||
CacheRec rec = snapcache.remove(key);
|
||||
if(rec != null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
package org.dynmap.utils;
|
||||
import org.bukkit.Location;
|
||||
import org.dynmap.DynmapLocation;
|
||||
/**
|
||||
* Simple vector class
|
||||
*/
|
||||
@ -8,7 +8,7 @@ public class Vector3D {
|
||||
|
||||
public Vector3D() { x = y = z = 0.0; }
|
||||
|
||||
public void setFromLocation(Location l) { x = l.getX(); y = l.getY(); z = l.getZ(); }
|
||||
public void setFromLocation(DynmapLocation l) { x = l.x; y = l.y; z = l.z; }
|
||||
|
||||
public String toString() {
|
||||
return "{ " + x + ", " + y + ", " + z + " }";
|
||||
|
@ -1,18 +1,13 @@
|
||||
package org.dynmap.web;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
@ -6,8 +6,6 @@ import java.lang.reflect.Modifier;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class Json {
|
||||
public static String stringifyJson(Object o) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -5,7 +5,6 @@ import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.utils.FileLockManager;
|
||||
|
Loading…
Reference in New Issue
Block a user