mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-14 06:16:46 +01:00
Add 'blockfromto' and 'blockphysics' triggers - needed for lava and water flow, as well as falling sand and gravel
This commit is contained in:
parent
17fd2c1efe
commit
cefcae2437
@ -34,7 +34,9 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||||||
import org.bukkit.event.block.BlockBurnEvent;
|
import org.bukkit.event.block.BlockBurnEvent;
|
||||||
import org.bukkit.event.block.BlockFadeEvent;
|
import org.bukkit.event.block.BlockFadeEvent;
|
||||||
import org.bukkit.event.block.BlockFormEvent;
|
import org.bukkit.event.block.BlockFormEvent;
|
||||||
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
import org.bukkit.event.block.BlockListener;
|
import org.bukkit.event.block.BlockListener;
|
||||||
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
@ -479,6 +481,8 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||||||
private boolean onblockform;
|
private boolean onblockform;
|
||||||
private boolean onblockfade;
|
private boolean onblockfade;
|
||||||
private boolean onblockspread;
|
private boolean onblockspread;
|
||||||
|
private boolean onblockfromto;
|
||||||
|
private boolean onblockphysics;
|
||||||
private boolean onleaves;
|
private boolean onleaves;
|
||||||
private boolean onburn;
|
private boolean onburn;
|
||||||
private boolean onpiston;
|
private boolean onpiston;
|
||||||
@ -566,7 +570,32 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||||||
mapManager.touch(loc, "blockspread");
|
mapManager.touch(loc, "blockspread");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||||
|
if(event.isCancelled())
|
||||||
|
return;
|
||||||
|
Location loc = event.getBlock().getLocation();
|
||||||
|
mapManager.sscache.invalidateSnapshot(loc);
|
||||||
|
if(onblockphysics) {
|
||||||
|
mapManager.touch(loc, "blockphysics");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||||
if(event.isCancelled())
|
if(event.isCancelled())
|
||||||
@ -635,6 +664,12 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||||||
onblockspread = isTrigger("blockspread");
|
onblockspread = isTrigger("blockspread");
|
||||||
registerEvent(Event.Type.BLOCK_SPREAD, blockTrigger);
|
registerEvent(Event.Type.BLOCK_SPREAD, blockTrigger);
|
||||||
|
|
||||||
|
onblockfromto = isTrigger("blockfromto");
|
||||||
|
registerEvent(Event.Type.BLOCK_FROMTO, blockTrigger);
|
||||||
|
|
||||||
|
onblockphysics = isTrigger("blockphysics");
|
||||||
|
registerEvent(Event.Type.BLOCK_PHYSICS, blockTrigger);
|
||||||
|
|
||||||
onpiston = isTrigger("pistonmoved");
|
onpiston = isTrigger("pistonmoved");
|
||||||
registerEvent(Event.Type.BLOCK_PISTON_EXTEND, blockTrigger);
|
registerEvent(Event.Type.BLOCK_PISTON_EXTEND, blockTrigger);
|
||||||
registerEvent(Event.Type.BLOCK_PISTON_RETRACT, blockTrigger);
|
registerEvent(Event.Type.BLOCK_PISTON_RETRACT, blockTrigger);
|
||||||
@ -1277,6 +1312,30 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public void onBlockFromTo(BlockFromToEvent event) {
|
||||||
|
if(event.isCancelled())
|
||||||
|
return;
|
||||||
|
/* Call listeners */
|
||||||
|
List<Listener> ll = event_handlers.get(event.getType());
|
||||||
|
if(ll != null) {
|
||||||
|
for(Listener l : ll) {
|
||||||
|
((BlockListener)l).onBlockFromTo(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||||
|
if(event.isCancelled())
|
||||||
|
return;
|
||||||
|
/* Call listeners */
|
||||||
|
List<Listener> ll = event_handlers.get(event.getType());
|
||||||
|
if(ll != null) {
|
||||||
|
for(Listener l : ll) {
|
||||||
|
((BlockListener)l).onBlockPhysics(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||||
if(event.isCancelled())
|
if(event.isCancelled())
|
||||||
return;
|
return;
|
||||||
@ -1451,6 +1510,8 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||||||
case BLOCK_FORM:
|
case BLOCK_FORM:
|
||||||
case BLOCK_FADE:
|
case BLOCK_FADE:
|
||||||
case BLOCK_SPREAD:
|
case BLOCK_SPREAD:
|
||||||
|
case BLOCK_FROMTO:
|
||||||
|
case BLOCK_PHYSICS:
|
||||||
case BLOCK_PISTON_EXTEND:
|
case BLOCK_PISTON_EXTEND:
|
||||||
case BLOCK_PISTON_RETRACT:
|
case BLOCK_PISTON_RETRACT:
|
||||||
pm.registerEvent(type, ourBlockEventHandler, Event.Priority.Monitor, this);
|
pm.registerEvent(type, ourBlockEventHandler, Event.Priority.Monitor, this);
|
||||||
|
@ -198,6 +198,8 @@ render-triggers:
|
|||||||
- blockspread
|
- blockspread
|
||||||
- pistonmoved
|
- pistonmoved
|
||||||
- explosion
|
- explosion
|
||||||
|
- blockfromto
|
||||||
|
- blockphysics
|
||||||
|
|
||||||
# Title for the web page - if not specified, defaults to the server's name (unless it is the default of 'Unknown Server')
|
# Title for the web page - if not specified, defaults to the server's name (unless it is the default of 'Unknown Server')
|
||||||
#webpage-title: "My Awesome Server Map"
|
#webpage-title: "My Awesome Server Map"
|
||||||
|
Loading…
Reference in New Issue
Block a user