More invalidate tightening up

This commit is contained in:
Mike Primm 2011-08-15 04:11:40 +08:00 committed by mikeprimm
parent 1aa3d07e6a
commit 6860d8952f

View File

@ -350,72 +350,81 @@ public class DynmapPlugin extends JavaPlugin {
public void onBlockPlace(BlockPlaceEvent event) { public void onBlockPlace(BlockPlaceEvent event) {
if(event.isCancelled()) if(event.isCancelled())
return; return;
mm.sscache.invalidateSnapshot(event.getBlock().getLocation()); Location loc = event.getBlock().getLocation();
mm.sscache.invalidateSnapshot(loc);
if(onplace) if(onplace)
mm.touch(event.getBlockPlaced().getLocation()); mm.touch(loc);
} }
@Override @Override
public void onBlockBreak(BlockBreakEvent event) { public void onBlockBreak(BlockBreakEvent event) {
if(event.isCancelled()) if(event.isCancelled())
return; return;
mm.sscache.invalidateSnapshot(event.getBlock().getLocation()); Location loc = event.getBlock().getLocation();
mm.sscache.invalidateSnapshot(loc);
if(onbreak) if(onbreak)
mm.touch(event.getBlock().getLocation()); mm.touch(loc);
} }
@Override @Override
public void onLeavesDecay(LeavesDecayEvent event) { public void onLeavesDecay(LeavesDecayEvent event) {
if(event.isCancelled()) if(event.isCancelled())
return; return;
mm.sscache.invalidateSnapshot(event.getBlock().getLocation()); Location loc = event.getBlock().getLocation();
mm.sscache.invalidateSnapshot(loc);
if(onleaves) if(onleaves)
mm.touch(event.getBlock().getLocation()); mm.touch(loc);
} }
@Override @Override
public void onBlockBurn(BlockBurnEvent event) { public void onBlockBurn(BlockBurnEvent event) {
if(event.isCancelled()) if(event.isCancelled())
return; return;
mm.sscache.invalidateSnapshot(event.getBlock().getLocation()); Location loc = event.getBlock().getLocation();
mm.sscache.invalidateSnapshot(loc);
if(onburn) if(onburn)
mm.touch(event.getBlock().getLocation()); mm.touch(loc);
} }
@Override @Override
public void onBlockForm(BlockFormEvent event) { public void onBlockForm(BlockFormEvent event) {
if(event.isCancelled()) if(event.isCancelled())
return; return;
mm.sscache.invalidateSnapshot(event.getBlock().getLocation()); Location loc = event.getBlock().getLocation();
mm.sscache.invalidateSnapshot(loc);
if(onblockform) if(onblockform)
mm.touch(event.getBlock().getLocation()); mm.touch(loc);
} }
@Override @Override
public void onBlockFade(BlockFadeEvent event) { public void onBlockFade(BlockFadeEvent event) {
if(event.isCancelled()) if(event.isCancelled())
return; return;
mm.sscache.invalidateSnapshot(event.getBlock().getLocation()); Location loc = event.getBlock().getLocation();
mm.sscache.invalidateSnapshot(loc);
if(onblockfade) if(onblockfade)
mm.touch(event.getBlock().getLocation()); mm.touch(loc);
} }
@Override @Override
public void onBlockSpread(BlockSpreadEvent event) { public void onBlockSpread(BlockSpreadEvent event) {
if(event.isCancelled()) if(event.isCancelled())
return; return;
mm.sscache.invalidateSnapshot(event.getBlock().getLocation()); Location loc = event.getBlock().getLocation();
mm.sscache.invalidateSnapshot(loc);
if(onblockspread) if(onblockspread)
mm.touch(event.getBlock().getLocation()); mm.touch(loc);
} }
@Override @Override
public void onBlockPistonRetract(BlockPistonRetractEvent event) { public void onBlockPistonRetract(BlockPistonRetractEvent event) {
if(event.isCancelled()) if(event.isCancelled())
return; return;
mm.sscache.invalidateSnapshot(event.getBlock().getLocation());
Block b = event.getBlock(); Block b = event.getBlock();
Location loc = b.getLocation();
mm.sscache.invalidateSnapshot(loc);
BlockFace dir = event.getDirection(); BlockFace dir = event.getDirection();
if(onpiston) if(onpiston)
mm.touchVolume(b.getLocation(), b.getRelative(dir, 2).getLocation()); mm.touchVolume(loc, b.getRelative(dir, 2).getLocation());
for(int i = 0; i < 2; i++) { for(int i = 0; i < 2; i++) {
b = b.getRelative(dir, 1);
mm.sscache.invalidateSnapshot(b.getLocation()); mm.sscache.invalidateSnapshot(b.getLocation());
} }
} }
@ -423,11 +432,12 @@ public class DynmapPlugin extends JavaPlugin {
public void onBlockPistonExtend(BlockPistonExtendEvent event) { public void onBlockPistonExtend(BlockPistonExtendEvent event) {
if(event.isCancelled()) if(event.isCancelled())
return; return;
mm.sscache.invalidateSnapshot(event.getBlock().getLocation());
Block b = event.getBlock(); Block b = event.getBlock();
Location loc = b.getLocation();
mm.sscache.invalidateSnapshot(loc);
BlockFace dir = event.getDirection(); BlockFace dir = event.getDirection();
if(onpiston) if(onpiston)
mm.touchVolume(b.getLocation(), b.getRelative(dir, 1+event.getLength()).getLocation()); mm.touchVolume(loc, b.getRelative(dir, 1+event.getLength()).getLocation());
for(int i = 0; i < 1+event.getLength(); i++) { for(int i = 0; i < 1+event.getLength(); i++) {
b = b.getRelative(dir, 1); b = b.getRelative(dir, 1);
mm.sscache.invalidateSnapshot(b.getLocation()); mm.sscache.invalidateSnapshot(b.getLocation());