mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-28 13:15:30 +01:00
Add /dynmap updaterender command - renders starting at selected location until map edge hit OR until rendered tiles match existing tiles (i.e. no changes)
This commit is contained in:
parent
cefcae2437
commit
8c9733b73f
@ -824,6 +824,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||||||
"fullrender",
|
"fullrender",
|
||||||
"cancelrender",
|
"cancelrender",
|
||||||
"radiusrender",
|
"radiusrender",
|
||||||
|
"updaterender",
|
||||||
"reload",
|
"reload",
|
||||||
"stats",
|
"stats",
|
||||||
"triggerstats",
|
"triggerstats",
|
||||||
@ -899,6 +900,32 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||||||
}
|
}
|
||||||
if(loc != null)
|
if(loc != null)
|
||||||
mapManager.renderWorldRadius(loc, sender, mapname, radius);
|
mapManager.renderWorldRadius(loc, sender, mapname, radius);
|
||||||
|
} else if(c.equals("updaterender") && checkPlayerPermission(sender,"updaterender")) {
|
||||||
|
String mapname = null;
|
||||||
|
Location 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();
|
||||||
|
else
|
||||||
|
sender.sendMessage("Command require <world> <x> <z> <radius> if issued from console.");
|
||||||
|
}
|
||||||
|
else { /* <world> <x> <z> */
|
||||||
|
DynmapWorld w = mapManager.worldsLookup.get(args[1]); /* Look up world */
|
||||||
|
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]);
|
||||||
|
if(args.length > 4)
|
||||||
|
mapname = args[4];
|
||||||
|
if(w != null)
|
||||||
|
loc = new Location(w.world, x, 64.0, z);
|
||||||
|
}
|
||||||
|
if(loc != null)
|
||||||
|
mapManager.renderFullWorld(loc, sender, mapname, true);
|
||||||
} else if (c.equals("hide")) {
|
} else if (c.equals("hide")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if(player != null && checkPlayerPermission(sender,"hide.self")) {
|
if(player != null && checkPlayerPermission(sender,"hide.self")) {
|
||||||
@ -938,7 +965,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||||||
if(w != null) {
|
if(w != null) {
|
||||||
Location spawn = w.world.getSpawnLocation();
|
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()));
|
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()));
|
||||||
mapManager.renderFullWorld(loc,sender, map);
|
mapManager.renderFullWorld(loc,sender, map, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sender.sendMessage("World '" + wname + "' not defined/loaded");
|
sender.sendMessage("World '" + wname + "' not defined/loaded");
|
||||||
@ -948,7 +975,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||||||
if(args.length > 1)
|
if(args.length > 1)
|
||||||
map = args[1];
|
map = args[1];
|
||||||
if(loc != null)
|
if(loc != null)
|
||||||
mapManager.renderFullWorld(loc, sender, map);
|
mapManager.renderFullWorld(loc, sender, map, false);
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("World name is required");
|
sender.sendMessage("World name is required");
|
||||||
}
|
}
|
||||||
|
@ -177,6 +177,10 @@ public class MapManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private static final String RENDERTYPE_FULLRENDER = "Full render";
|
||||||
|
private static final String RENDERTYPE_RADIUSRENDER = "Radius render";
|
||||||
|
private static final String RENDERTYPE_UPDATERENDER = "Update render";
|
||||||
|
|
||||||
/* This always runs on render pool threads - no bukkit calls from here */
|
/* This always runs on render pool threads - no bukkit calls from here */
|
||||||
private class FullWorldRenderState implements Runnable {
|
private class FullWorldRenderState implements Runnable {
|
||||||
DynmapWorld world; /* Which world are we rendering */
|
DynmapWorld world; /* Which world are we rendering */
|
||||||
@ -197,14 +201,20 @@ public class MapManager {
|
|||||||
int cxmin, cxmax, czmin, czmax;
|
int cxmin, cxmax, czmin, czmax;
|
||||||
String rendertype;
|
String rendertype;
|
||||||
boolean cancelled;
|
boolean cancelled;
|
||||||
|
boolean updaterender = false;
|
||||||
String mapname;
|
String mapname;
|
||||||
AtomicLong total_render_ns = new AtomicLong(0L);
|
AtomicLong total_render_ns = new AtomicLong(0L);
|
||||||
AtomicInteger rendercalls = new AtomicInteger(0);
|
AtomicInteger rendercalls = new AtomicInteger(0);
|
||||||
|
|
||||||
/* Full world, all maps render */
|
/* Full world, all maps render */
|
||||||
FullWorldRenderState(DynmapWorld dworld, Location l, CommandSender sender, String mapname) {
|
FullWorldRenderState(DynmapWorld dworld, Location l, CommandSender sender, String mapname, boolean updaterender) {
|
||||||
this(dworld, l, sender, mapname, -1);
|
this(dworld, l, sender, mapname, -1);
|
||||||
rendertype = "Full render";
|
if(updaterender) {
|
||||||
|
rendertype = RENDERTYPE_UPDATERENDER;
|
||||||
|
this.updaterender = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rendertype = RENDERTYPE_FULLRENDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Full world, all maps render, with optional render radius */
|
/* Full world, all maps render, with optional render radius */
|
||||||
@ -218,14 +228,14 @@ public class MapManager {
|
|||||||
if(radius < 0) {
|
if(radius < 0) {
|
||||||
cxmin = czmin = Integer.MIN_VALUE;
|
cxmin = czmin = Integer.MIN_VALUE;
|
||||||
cxmax = czmax = Integer.MAX_VALUE;
|
cxmax = czmax = Integer.MAX_VALUE;
|
||||||
rendertype = "Full render";
|
rendertype = RENDERTYPE_FULLRENDER;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cxmin = (l.getBlockX() - radius)>>4;
|
cxmin = (l.getBlockX() - radius)>>4;
|
||||||
czmin = (l.getBlockZ() - radius)>>4;
|
czmin = (l.getBlockZ() - radius)>>4;
|
||||||
cxmax = (l.getBlockX() + radius+15)>>4;
|
cxmax = (l.getBlockX() + radius+15)>>4;
|
||||||
czmax = (l.getBlockZ() + radius+15)>>4;
|
czmax = (l.getBlockZ() + radius+15)>>4;
|
||||||
rendertype = "Radius render";
|
rendertype = RENDERTYPE_RADIUSRENDER;
|
||||||
}
|
}
|
||||||
this.mapname = mapname;
|
this.mapname = mapname;
|
||||||
}
|
}
|
||||||
@ -291,6 +301,7 @@ public class MapManager {
|
|||||||
czmax = n.getInteger("czmax", 0);
|
czmax = n.getInteger("czmax", 0);
|
||||||
rendertype = n.getString("rendertype", "");
|
rendertype = n.getString("rendertype", "");
|
||||||
mapname = n.getString("mapname", null);
|
mapname = n.getString("mapname", null);
|
||||||
|
updaterender = rendertype.equals(RENDERTYPE_UPDATERENDER);
|
||||||
sender = null;
|
sender = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +383,7 @@ public class MapManager {
|
|||||||
sendMessage(String.format("%s of map '%s' of '%s' completed - %d tiles rendered (%.2f msec/map-tile, %.2f msec per render)",
|
sendMessage(String.format("%s of map '%s' of '%s' completed - %d tiles rendered (%.2f msec/map-tile, %.2f msec per render)",
|
||||||
rendertype, activemaps, world.world.getName(), rendercnt, msecpertile, rendtime));
|
rendertype, activemaps, world.world.getName(), rendercnt, msecpertile, rendtime));
|
||||||
/* Now, if fullrender, use the render bitmap to purge obsolete tiles */
|
/* Now, if fullrender, use the render bitmap to purge obsolete tiles */
|
||||||
if(cxmin == Integer.MIN_VALUE) {
|
if(rendertype.equals(RENDERTYPE_FULLRENDER)) {
|
||||||
if(activemapcnt == 1) {
|
if(activemapcnt == 1) {
|
||||||
map.purgeOldTiles(world, rendered);
|
map.purgeOldTiles(world, rendered);
|
||||||
}
|
}
|
||||||
@ -436,20 +447,22 @@ public class MapManager {
|
|||||||
renderQueue.add(mt);
|
renderQueue.add(mt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Add spawn location too (helps with some worlds where 0,64,0 may not be generated */
|
if(!updaterender) { /* Only add other seed points for fullrender */
|
||||||
Location sloc = world.world.getSpawnLocation();
|
/* Add spawn location too (helps with some worlds where 0,64,0 may not be generated */
|
||||||
for (MapTile mt : map.getTiles(sloc)) {
|
Location sloc = world.world.getSpawnLocation();
|
||||||
if (!found.getFlag(mt.tileOrdinalX(), mt.tileOrdinalY())) {
|
for (MapTile mt : map.getTiles(sloc)) {
|
||||||
found.setFlag(mt.tileOrdinalX(), mt.tileOrdinalY(), true);
|
if (!found.getFlag(mt.tileOrdinalX(), mt.tileOrdinalY())) {
|
||||||
renderQueue.add(mt);
|
found.setFlag(mt.tileOrdinalX(), mt.tileOrdinalY(), true);
|
||||||
|
renderQueue.add(mt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if(world.seedloc != null) {
|
||||||
if(world.seedloc != null) {
|
for(Location seed : world.seedloc) {
|
||||||
for(Location seed : world.seedloc) {
|
for (MapTile mt : map.getTiles(seed)) {
|
||||||
for (MapTile mt : map.getTiles(seed)) {
|
if (!found.getFlag(mt.tileOrdinalX(),mt.tileOrdinalY())) {
|
||||||
if (!found.getFlag(mt.tileOrdinalX(),mt.tileOrdinalY())) {
|
found.setFlag(mt.tileOrdinalX(),mt.tileOrdinalY(), true);
|
||||||
found.setFlag(mt.tileOrdinalX(),mt.tileOrdinalY(), true);
|
renderQueue.add(mt);
|
||||||
renderQueue.add(mt);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -572,15 +585,18 @@ public class MapManager {
|
|||||||
/* Switch to not checking if rendered tile is blank - breaks us on skylands, where tiles can be nominally blank - just work off chunk cache empty */
|
/* Switch to not checking if rendered tile is blank - breaks us on skylands, where tiles can be nominally blank - just work off chunk cache empty */
|
||||||
if (cache.isEmpty() == false) {
|
if (cache.isEmpty() == false) {
|
||||||
long rt0 = System.nanoTime();
|
long rt0 = System.nanoTime();
|
||||||
tile.render(cache, mapname);
|
boolean upd = tile.render(cache, mapname);
|
||||||
total_render_ns.addAndGet(System.nanoTime()-rt0);
|
total_render_ns.addAndGet(System.nanoTime()-rt0);
|
||||||
rendercalls.incrementAndGet();
|
rendercalls.incrementAndGet();
|
||||||
synchronized(lock) {
|
synchronized(lock) {
|
||||||
rendered.setFlag(tile.tileOrdinalX(), tile.tileOrdinalY(), true);
|
rendered.setFlag(tile.tileOrdinalX(), tile.tileOrdinalY(), true);
|
||||||
for (MapTile adjTile : map.getAdjecentTiles(tile)) {
|
if(upd || (!updaterender)) { /* If updated or not an update render */
|
||||||
if (!found.getFlag(adjTile.tileOrdinalX(),adjTile.tileOrdinalY())) {
|
/* Add adjacent unrendered tiles to queue */
|
||||||
found.setFlag(adjTile.tileOrdinalX(), adjTile.tileOrdinalY(), true);
|
for (MapTile adjTile : map.getAdjecentTiles(tile)) {
|
||||||
renderQueue.add(adjTile);
|
if (!found.getFlag(adjTile.tileOrdinalX(),adjTile.tileOrdinalY())) {
|
||||||
|
found.setFlag(adjTile.tileOrdinalX(), adjTile.tileOrdinalY(), true);
|
||||||
|
renderQueue.add(adjTile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -718,7 +734,7 @@ public class MapManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderFullWorld(Location l, CommandSender sender, String mapname) {
|
void renderFullWorld(Location l, CommandSender sender, String mapname, boolean update) {
|
||||||
DynmapWorld world = getWorld(l.getWorld().getName());
|
DynmapWorld world = getWorld(l.getWorld().getName());
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
sender.sendMessage("Could not render: world '" + l.getWorld().getName() + "' not defined in configuration.");
|
sender.sendMessage("Could not render: world '" + l.getWorld().getName() + "' not defined in configuration.");
|
||||||
@ -732,13 +748,16 @@ public class MapManager {
|
|||||||
sender.sendMessage(rndr.rendertype + " of world '" + wname + "' already active.");
|
sender.sendMessage(rndr.rendertype + " of world '" + wname + "' already active.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rndr = new FullWorldRenderState(world,l,sender, mapname); /* Make new activation record */
|
rndr = new FullWorldRenderState(world,l,sender, mapname, update); /* Make new activation record */
|
||||||
active_renders.put(wname, rndr); /* Add to active table */
|
active_renders.put(wname, rndr); /* Add to active table */
|
||||||
}
|
}
|
||||||
/* Schedule first tile to be worked */
|
/* Schedule first tile to be worked */
|
||||||
scheduleDelayedJob(rndr, 0);
|
scheduleDelayedJob(rndr, 0);
|
||||||
|
|
||||||
sender.sendMessage("Full render starting on world '" + wname + "'...");
|
if(update)
|
||||||
|
sender.sendMessage("Update render starting on world '" + wname + "'...");
|
||||||
|
else
|
||||||
|
sender.sendMessage("Full render starting on world '" + wname + "'...");
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderWorldRadius(Location l, CommandSender sender, String mapname, int radius) {
|
void renderWorldRadius(Location l, CommandSender sender, String mapname, int radius) {
|
||||||
|
@ -155,7 +155,7 @@ public class FlatMap extends MapType {
|
|||||||
World w = t.getWorld();
|
World w = t.getWorld();
|
||||||
boolean isnether = (w.getEnvironment() == Environment.NETHER) && (maximumHeight == 127);
|
boolean isnether = (w.getEnvironment() == Environment.NETHER) && (maximumHeight == 127);
|
||||||
|
|
||||||
boolean rendered = false;
|
boolean didwrite = false;
|
||||||
Color rslt = new Color();
|
Color rslt = new Color();
|
||||||
int[] pixel = new int[4];
|
int[] pixel = new int[4];
|
||||||
int[] pixel_day = null;
|
int[] pixel_day = null;
|
||||||
@ -294,7 +294,6 @@ public class FlatMap extends MapType {
|
|||||||
rslt.setRGBA(pixel_day[0], pixel_day[1], pixel_day[2], pixel[3]);
|
rslt.setRGBA(pixel_day[0], pixel_day[1], pixel_day[2], pixel[3]);
|
||||||
argb_buf_day[(t.size-y-1) + (x*t.size)] = rslt.getARGB();
|
argb_buf_day[(t.size-y-1) + (x*t.size)] = rslt.getARGB();
|
||||||
}
|
}
|
||||||
rendered = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Test to see if we're unchanged from older tile */
|
/* Test to see if we're unchanged from older tile */
|
||||||
@ -319,6 +318,7 @@ public class FlatMap extends MapType {
|
|||||||
hashman.updateHashCode(tile.getKey(prefix), null, t.x, t.y, crc);
|
hashman.updateHashCode(tile.getKey(prefix), null, t.x, t.y, crc);
|
||||||
tile.getDynmapWorld().enqueueZoomOutUpdate(outputFile);
|
tile.getDynmapWorld().enqueueZoomOutUpdate(outputFile);
|
||||||
tile_update = true;
|
tile_update = true;
|
||||||
|
didwrite = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Debug.debug("skipping image " + outputFile.getPath() + " - hash match");
|
Debug.debug("skipping image " + outputFile.getPath() + " - hash match");
|
||||||
@ -327,7 +327,7 @@ public class FlatMap extends MapType {
|
|||||||
FileLockManager.releaseWriteLock(outputFile);
|
FileLockManager.releaseWriteLock(outputFile);
|
||||||
DynmapBufferedImage.freeBufferedImage(im);
|
DynmapBufferedImage.freeBufferedImage(im);
|
||||||
}
|
}
|
||||||
MapManager.mapman.updateStatistics(tile, prefix, true, tile_update, !rendered);
|
MapManager.mapman.updateStatistics(tile, prefix, true, tile_update, true);
|
||||||
|
|
||||||
/* If day too, handle it */
|
/* If day too, handle it */
|
||||||
if(night_and_day) {
|
if(night_and_day) {
|
||||||
@ -350,6 +350,7 @@ public class FlatMap extends MapType {
|
|||||||
hashman.updateHashCode(tile.getKey(prefix), "day", t.x, t.y, crc);
|
hashman.updateHashCode(tile.getKey(prefix), "day", t.x, t.y, crc);
|
||||||
tile.getDynmapWorld().enqueueZoomOutUpdate(dayfile);
|
tile.getDynmapWorld().enqueueZoomOutUpdate(dayfile);
|
||||||
tile_update = true;
|
tile_update = true;
|
||||||
|
didwrite = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Debug.debug("skipping image " + dayfile.getPath() + " - hash match");
|
Debug.debug("skipping image " + dayfile.getPath() + " - hash match");
|
||||||
@ -359,10 +360,10 @@ public class FlatMap extends MapType {
|
|||||||
FileLockManager.releaseWriteLock(dayfile);
|
FileLockManager.releaseWriteLock(dayfile);
|
||||||
DynmapBufferedImage.freeBufferedImage(im_day);
|
DynmapBufferedImage.freeBufferedImage(im_day);
|
||||||
}
|
}
|
||||||
MapManager.mapman.updateStatistics(tile, prefix+"_day", true, tile_update, !rendered);
|
MapManager.mapman.updateStatistics(tile, prefix+"_day", true, tile_update, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rendered;
|
return didwrite;
|
||||||
}
|
}
|
||||||
private void process_transparent(int[] pixel, int[] pixel_day, MapIterator mapiter) {
|
private void process_transparent(int[] pixel, int[] pixel_day, MapIterator mapiter) {
|
||||||
int r = pixel[0], g = pixel[1], b = pixel[2], a = pixel[3];
|
int r = pixel[0], g = pixel[1], b = pixel[2], a = pixel[3];
|
||||||
|
@ -1184,8 +1184,6 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
File f = new File(tile.getDynmapWorld().worldtilepath, fname);
|
File f = new File(tile.getDynmapWorld().worldtilepath, fname);
|
||||||
FileLockManager.getWriteLock(f);
|
FileLockManager.getWriteLock(f);
|
||||||
try {
|
try {
|
||||||
if(rendered[i])
|
|
||||||
renderone = true;
|
|
||||||
if((!f.exists()) || (crc != hashman.getImageHashCode(tile.getKey(prefix), null, tile.tx, tile.ty))) {
|
if((!f.exists()) || (crc != hashman.getImageHashCode(tile.getKey(prefix), null, tile.tx, tile.ty))) {
|
||||||
/* Wrap buffer as buffered image */
|
/* Wrap buffer as buffered image */
|
||||||
Debug.debug("saving image " + f.getPath());
|
Debug.debug("saving image " + f.getPath());
|
||||||
@ -1202,6 +1200,7 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
hashman.updateHashCode(tile.getKey(prefix), null, tile.tx, tile.ty, crc);
|
hashman.updateHashCode(tile.getKey(prefix), null, tile.tx, tile.ty, crc);
|
||||||
tile.getDynmapWorld().enqueueZoomOutUpdate(f);
|
tile.getDynmapWorld().enqueueZoomOutUpdate(f);
|
||||||
tile_update = true;
|
tile_update = true;
|
||||||
|
renderone = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Debug.debug("skipping image " + f.getPath() + " - hash match");
|
Debug.debug("skipping image " + f.getPath() + " - hash match");
|
||||||
@ -1234,6 +1233,7 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
hashman.updateHashCode(tile.getKey(prefix), "day", tile.tx, tile.ty, crc);
|
hashman.updateHashCode(tile.getKey(prefix), "day", tile.tx, tile.ty, crc);
|
||||||
tile.getDynmapWorld().enqueueZoomOutUpdate(f);
|
tile.getDynmapWorld().enqueueZoomOutUpdate(f);
|
||||||
tile_update = true;
|
tile_update = true;
|
||||||
|
renderone = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Debug.debug("skipping image " + f.getPath() + " - hash match");
|
Debug.debug("skipping image " + f.getPath() + " - hash match");
|
||||||
|
@ -123,7 +123,6 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
boolean isnether = (world.getEnvironment() == Environment.NETHER);
|
boolean isnether = (world.getEnvironment() == Environment.NETHER);
|
||||||
DynmapBufferedImage im = DynmapBufferedImage.allocateBufferedImage(KzedMap.tileWidth, KzedMap.tileHeight);
|
DynmapBufferedImage im = DynmapBufferedImage.allocateBufferedImage(KzedMap.tileWidth, KzedMap.tileHeight);
|
||||||
DynmapBufferedImage zim = DynmapBufferedImage.allocateBufferedImage(KzedMap.tileWidth/2, KzedMap.tileHeight/2);
|
DynmapBufferedImage zim = DynmapBufferedImage.allocateBufferedImage(KzedMap.tileWidth/2, KzedMap.tileHeight/2);
|
||||||
boolean isempty = true;
|
|
||||||
|
|
||||||
DynmapBufferedImage im_day = null;
|
DynmapBufferedImage im_day = null;
|
||||||
DynmapBufferedImage zim_day = null;
|
DynmapBufferedImage zim_day = null;
|
||||||
@ -179,9 +178,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
argb_day[rowoff+x] = c1_day.getARGB();
|
argb_day[rowoff+x] = c1_day.getARGB();
|
||||||
argb_day[rowoff+x-1] = c2_day.getARGB();
|
argb_day[rowoff+x-1] = c2_day.getARGB();
|
||||||
}
|
}
|
||||||
|
|
||||||
isempty = isempty && c1.isTransparent() && c2.isTransparent();
|
|
||||||
|
|
||||||
jx++;
|
jx++;
|
||||||
jz++;
|
jz++;
|
||||||
|
|
||||||
@ -208,8 +205,6 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
argb_day[rowoff+x] = c1_day.getARGB();
|
argb_day[rowoff+x] = c1_day.getARGB();
|
||||||
argb_day[rowoff+x-1] = c2_day.getARGB();
|
argb_day[rowoff+x-1] = c2_day.getARGB();
|
||||||
}
|
}
|
||||||
|
|
||||||
isempty = isempty && c1.isTransparent() && c2.isTransparent();
|
|
||||||
}
|
}
|
||||||
y++;
|
y++;
|
||||||
rowoff += KzedMap.tileWidth;
|
rowoff += KzedMap.tileWidth;
|
||||||
@ -227,9 +222,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
KzedZoomedMapTile zmtile = new KzedZoomedMapTile(tile.getDynmapWorld(), tile);
|
KzedZoomedMapTile zmtile = new KzedZoomedMapTile(tile.getDynmapWorld(), tile);
|
||||||
File zoomFile = MapManager.mapman.getTileFile(zmtile);
|
File zoomFile = MapManager.mapman.getTileFile(zmtile);
|
||||||
|
|
||||||
doFileWrites(outputFile, tile, im, im_day, zmtile, zoomFile, zim, zim_day, !isempty);
|
return doFileWrites(outputFile, tile, im, im_day, zmtile, zoomFile, zim, zim_day);
|
||||||
|
|
||||||
return !isempty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doScaleWithBilinear(int[] argb, int[] zargb, int width, int height) {
|
private void doScaleWithBilinear(int[] argb, int[] zargb, int width, int height) {
|
||||||
@ -256,11 +249,12 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doFileWrites(final File fname, final KzedMapTile mtile,
|
private boolean doFileWrites(final File fname, final KzedMapTile mtile,
|
||||||
final DynmapBufferedImage img, final DynmapBufferedImage img_day,
|
final DynmapBufferedImage img, final DynmapBufferedImage img_day,
|
||||||
final KzedZoomedMapTile zmtile, final File zoomFile,
|
final KzedZoomedMapTile zmtile, final File zoomFile,
|
||||||
final DynmapBufferedImage zimg, final DynmapBufferedImage zimg_day, boolean rendered) {
|
final DynmapBufferedImage zimg, final DynmapBufferedImage zimg_day) {
|
||||||
|
boolean didwrite = false;
|
||||||
|
|
||||||
/* Get coordinates of zoomed tile */
|
/* Get coordinates of zoomed tile */
|
||||||
int ox = (mtile.px == zmtile.getTileX())?0:KzedMap.tileWidth/2;
|
int ox = (mtile.px == zmtile.getTileX())?0:KzedMap.tileWidth/2;
|
||||||
int oy = (mtile.py == zmtile.getTileY())?0:KzedMap.tileHeight/2;
|
int oy = (mtile.py == zmtile.getTileY())?0:KzedMap.tileHeight/2;
|
||||||
@ -287,12 +281,13 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
MapManager.mapman.pushUpdate(mtile.getWorld(), new Client.Tile(mtile.getFilename()));
|
MapManager.mapman.pushUpdate(mtile.getWorld(), new Client.Tile(mtile.getFilename()));
|
||||||
hashman.updateHashCode(mtile.getKey(prefix), null, tx, ty, crc);
|
hashman.updateHashCode(mtile.getKey(prefix), null, tx, ty, crc);
|
||||||
updated_fname = true;
|
updated_fname = true;
|
||||||
|
didwrite = true;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
FileLockManager.releaseWriteLock(fname);
|
FileLockManager.releaseWriteLock(fname);
|
||||||
DynmapBufferedImage.freeBufferedImage(img);
|
DynmapBufferedImage.freeBufferedImage(img);
|
||||||
}
|
}
|
||||||
MapManager.mapman.updateStatistics(mtile, prefix, true, updated_fname, !rendered);
|
MapManager.mapman.updateStatistics(mtile, prefix, true, updated_fname, true);
|
||||||
|
|
||||||
mtile.file = fname;
|
mtile.file = fname;
|
||||||
|
|
||||||
@ -317,12 +312,13 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
MapManager.mapman.pushUpdate(mtile.getWorld(), new Client.Tile(mtile.getDayFilename()));
|
MapManager.mapman.pushUpdate(mtile.getWorld(), new Client.Tile(mtile.getDayFilename()));
|
||||||
hashman.updateHashCode(mtile.getKey(prefix), "day", tx, ty, crc);
|
hashman.updateHashCode(mtile.getKey(prefix), "day", tx, ty, crc);
|
||||||
updated_dfname = true;
|
updated_dfname = true;
|
||||||
|
didwrite = true;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
FileLockManager.releaseWriteLock(dfname);
|
FileLockManager.releaseWriteLock(dfname);
|
||||||
DynmapBufferedImage.freeBufferedImage(img_day);
|
DynmapBufferedImage.freeBufferedImage(img_day);
|
||||||
}
|
}
|
||||||
MapManager.mapman.updateStatistics(mtile, prefix+"_day", true, updated_dfname, !rendered);
|
MapManager.mapman.updateStatistics(mtile, prefix+"_day", true, updated_dfname, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since we've already got the new tile, and we're on an async thread, just
|
// Since we've already got the new tile, and we're on an async thread, just
|
||||||
@ -341,7 +337,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
FileLockManager.releaseWriteLock(zoomFile);
|
FileLockManager.releaseWriteLock(zoomFile);
|
||||||
DynmapBufferedImage.freeBufferedImage(zimg);
|
DynmapBufferedImage.freeBufferedImage(zimg);
|
||||||
}
|
}
|
||||||
MapManager.mapman.updateStatistics(zmtile, null, true, ztile_updated, !rendered);
|
MapManager.mapman.updateStatistics(zmtile, null, true, ztile_updated, true);
|
||||||
|
|
||||||
if(zimg_day != null) {
|
if(zimg_day != null) {
|
||||||
File zoomFile_day = new File(zmtile.getDynmapWorld().worldtilepath, zmtile.getDayFilename());
|
File zoomFile_day = new File(zmtile.getDynmapWorld().worldtilepath, zmtile.getDayFilename());
|
||||||
@ -359,8 +355,9 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
FileLockManager.releaseWriteLock(zoomFile_day);
|
FileLockManager.releaseWriteLock(zoomFile_day);
|
||||||
DynmapBufferedImage.freeBufferedImage(zimg_day);
|
DynmapBufferedImage.freeBufferedImage(zimg_day);
|
||||||
}
|
}
|
||||||
MapManager.mapman.updateStatistics(zmtile, "day", true, ztile_updated, !rendered);
|
MapManager.mapman.updateStatistics(zmtile, "day", true, ztile_updated, true);
|
||||||
}
|
}
|
||||||
|
return didwrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveZoomedTile(final KzedZoomedMapTile zmtile, final File zoomFile,
|
private void saveZoomedTile(final KzedZoomedMapTile zmtile, final File zoomFile,
|
||||||
|
@ -19,6 +19,10 @@ commands:
|
|||||||
/<command> radiusrender ## mapname - Render at least ## block radius from your location on map 'mapname'
|
/<command> radiusrender ## mapname - Render at least ## block radius from your location on map 'mapname'
|
||||||
/<command> radiusrender worldname x z ## - Render at least ## block radius from location x,z on world 'worldname'
|
/<command> radiusrender worldname x z ## - Render at least ## block radius from location x,z on world 'worldname'
|
||||||
/<command> radiusrender worldname x z ## mapname - Render at least ## block radius from location x,z on world 'worldname' on map 'mapname'
|
/<command> radiusrender worldname x z ## mapname - Render at least ## block radius from location x,z on world 'worldname' on map 'mapname'
|
||||||
|
/<command> updaterender - Render updates starting at your location on all maps.
|
||||||
|
/<command> updaterender mapname - Render updates starting at your location on give map
|
||||||
|
/<command> updaterender worldname x z - Render updates starting at location x,z on world 'worldname' for all maps
|
||||||
|
/<command> updaterender worldname x z mapname - Render updates starting at location x,z on world 'worldname' for given map
|
||||||
/<command> cancelrender - Cancels any active renders on current world
|
/<command> cancelrender - Cancels any active renders on current world
|
||||||
/<command> cancelrender world - Cancels any active renders of world 'world'
|
/<command> cancelrender world - Cancels any active renders of world 'world'
|
||||||
/<command> stats - Show render statistics.
|
/<command> stats - Show render statistics.
|
||||||
@ -78,6 +82,7 @@ permissions:
|
|||||||
dynmap.hide.others: true
|
dynmap.hide.others: true
|
||||||
dynmap.fullrender: true
|
dynmap.fullrender: true
|
||||||
dynmap.radiusrender: true
|
dynmap.radiusrender: true
|
||||||
|
dynmap.updaterender: true
|
||||||
dynmap.cancelrender: true
|
dynmap.cancelrender: true
|
||||||
dynmap.reload: true
|
dynmap.reload: true
|
||||||
dynmap.stats: true
|
dynmap.stats: true
|
||||||
@ -126,6 +131,9 @@ permissions:
|
|||||||
dynmap.radiusrender:
|
dynmap.radiusrender:
|
||||||
description: Allows /dynmap radiusrender
|
description: Allows /dynmap radiusrender
|
||||||
default: op
|
default: op
|
||||||
|
dynmap.updaterender:
|
||||||
|
description: Allows /dynmap updaterender
|
||||||
|
default: op
|
||||||
dynmap.cancelrender:
|
dynmap.cancelrender:
|
||||||
description: Allows /dynmap cancelrender <world>
|
description: Allows /dynmap cancelrender <world>
|
||||||
default: op
|
default: op
|
||||||
|
Loading…
Reference in New Issue
Block a user