mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-29 12:07:41 +01:00
Fix initial zoomout processing (unnecessary updates), extra tile invalidates
This commit is contained in:
parent
6860d8952f
commit
4cb5b9a956
@ -352,9 +352,10 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onplace)
|
||||
if(onplace) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
@ -362,9 +363,10 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onbreak)
|
||||
if(onbreak) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeavesDecay(LeavesDecayEvent event) {
|
||||
@ -372,9 +374,10 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onleaves)
|
||||
if(onleaves) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockBurn(BlockBurnEvent event) {
|
||||
@ -382,9 +385,10 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onburn)
|
||||
if(onburn) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockForm(BlockFormEvent event) {
|
||||
@ -392,27 +396,30 @@ 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) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onblockfade)
|
||||
if(onblockfade) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockSpread(BlockSpreadEvent event) {
|
||||
if(event.isCancelled())
|
||||
return;
|
||||
Location loc = event.getBlock().getLocation();
|
||||
mm.sscache.invalidateSnapshot(loc);
|
||||
if(onblockspread)
|
||||
if(onblockspread) {
|
||||
mm.touch(loc);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||
if(event.isCancelled())
|
||||
@ -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) {
|
||||
if(tileQueue.push(tile))
|
||||
Debug.debug("Invalidating tile " + tile.getFilename());
|
||||
tileQueue.push(tile);
|
||||
}
|
||||
|
||||
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