mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-08-20 03:12:46 +02:00
Fix initial zoomout processing (unnecessary updates), extra tile invalidates
This commit is contained in:
parent
6860d8952f
commit
4cb5b9a956
|
@ -352,8 +352,9 @@ public class DynmapPlugin extends JavaPlugin {
|
|||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onplace)
|
||||
if(onplace) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -362,8 +363,9 @@ public class DynmapPlugin extends JavaPlugin {
|
|||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onbreak)
|
||||
if(onbreak) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -372,8 +374,9 @@ public class DynmapPlugin extends JavaPlugin {
|
|||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onleaves)
|
||||
if(onleaves) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -382,8 +385,9 @@ public class DynmapPlugin extends JavaPlugin {
|
|||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onburn)
|
||||
if(onburn) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -392,8 +396,9 @@ public class DynmapPlugin extends JavaPlugin {
|
|||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onblockform)
|
||||
if(onblockform) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockFade(BlockFadeEvent event) {
|
||||
|
@ -401,8 +406,9 @@ public class DynmapPlugin extends JavaPlugin {
|
|||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onblockfade)
|
||||
if(onblockfade) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockSpread(BlockSpreadEvent event) {
|
||||
|
@ -410,8 +416,9 @@ public class DynmapPlugin extends JavaPlugin {
|
|||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onblockspread)
|
||||
if(onblockspread) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||
|
@ -421,8 +428,9 @@ public class DynmapPlugin extends JavaPlugin {
|
|||
Location loc = b.getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
BlockFace dir = event.getDirection();
|
||||
if(onpiston)
|
||||
if(onpiston) {
|
||||
mm.touchVolume(loc, b.getRelative(dir, 2).getLocation());
|
||||
}
|
||||
for(int i = 0; i < 2; i++) {
|
||||
b = b.getRelative(dir, 1);
|
||||
mm.sscache.invalidateSnapshot(b.getLocation());
|
||||
|
@ -436,8 +444,9 @@ public class DynmapPlugin extends JavaPlugin {
|
|||
Location loc = b.getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
BlockFace dir = event.getDirection();
|
||||
if(onpiston)
|
||||
if(onpiston) {
|
||||
mm.touchVolume(loc, b.getRelative(dir, 1+event.getLength()).getLocation());
|
||||
}
|
||||
for(int i = 0; i < 1+event.getLength(); i++) {
|
||||
b = b.getRelative(dir, 1);
|
||||
mm.sscache.invalidateSnapshot(b.getLocation());
|
||||
|
|
|
@ -105,12 +105,21 @@ public class DynmapWorld {
|
|||
}
|
||||
}
|
||||
|
||||
private static final String COORDSTART = "-0123456789";
|
||||
private static class PNGFileFilter implements FilenameFilter {
|
||||
String prefix;
|
||||
String suffix;
|
||||
public PNGFileFilter(String pre, MapType.ImageFormat fmt) { prefix = pre; suffix = "." + fmt.getFileExt(); }
|
||||
public PNGFileFilter(String pre, MapType.ImageFormat fmt) {
|
||||
if((pre != null) && (pre.length() > 0))
|
||||
prefix = pre;
|
||||
suffix = "." + fmt.getFileExt();
|
||||
}
|
||||
public boolean accept(File f, String n) {
|
||||
if(n.endsWith(suffix) && n.startsWith(prefix)) {
|
||||
if(n.endsWith(suffix)) {
|
||||
if((prefix != null) && (!n.startsWith(prefix)))
|
||||
return false;
|
||||
if((prefix == null) && (COORDSTART.indexOf(n.charAt(0)) < 0))
|
||||
return false;
|
||||
File fn = new File(f, n);
|
||||
return fn.isFile();
|
||||
}
|
||||
|
|
|
@ -658,8 +658,8 @@ public class MapManager {
|
|||
}
|
||||
|
||||
public void invalidateTile(MapTile tile) {
|
||||
Debug.debug("Invalidating tile " + tile.getFilename());
|
||||
tileQueue.push(tile);
|
||||
if(tileQueue.push(tile))
|
||||
Debug.debug("Invalidating tile " + tile.getFilename());
|
||||
}
|
||||
|
||||
public static void scheduleDelayedJob(Runnable job, long delay_in_msec) {
|
||||
|
|
|
@ -538,6 +538,22 @@ public class FlatMap extends MapType {
|
|||
return map.getAdjecentTiles(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return x ^ y ^ size ^ map.getName().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object x) {
|
||||
if(x instanceof FlatMapTile) {
|
||||
return equals((FlatMapTile)x);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean equals(FlatMapTile o) {
|
||||
return (o.x == x) && (o.y == y) && (o.map == map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return world.world.getName() + "." + map.getPrefix();
|
||||
|
|
|
@ -40,7 +40,7 @@ public class HDMapTile extends MapTile {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return perspective.getName().hashCode() ^ getWorld().hashCode();
|
||||
return tx ^ ty ^ perspective.getName().hashCode() ^ getWorld().getName().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,11 +48,11 @@ public class HDMapTile extends MapTile {
|
|||
if (obj instanceof HDMapTile) {
|
||||
return equals((HDMapTile) obj);
|
||||
}
|
||||
return super.equals(obj);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(HDMapTile o) {
|
||||
return o.tx == tx && o.ty == ty && o.getWorld().equals(getWorld()) && (perspective.equals(o.perspective));
|
||||
return o.tx == tx && o.ty == ty && (perspective == o.perspective) && (o.getWorld() == getWorld());
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class KzedMapTile extends MapTile {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getFilename().hashCode() ^ getWorld().hashCode();
|
||||
return px ^ py ^ map.getName().hashCode() ^ getWorld().getName().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,11 +60,11 @@ public class KzedMapTile extends MapTile {
|
|||
if (obj instanceof KzedMapTile) {
|
||||
return equals((KzedMapTile) obj);
|
||||
}
|
||||
return super.equals(obj);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(KzedMapTile o) {
|
||||
return o.px == px && o.py == py && o.getWorld().equals(getWorld());
|
||||
return o.px == px && o.py == py && (o.map == map) && (o.getWorld() == getWorld());
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user