From 9286cfff66c1aa11b90e9530a08ad1fe2b6f4c77 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Mon, 13 Jun 2011 23:19:02 -0500 Subject: [PATCH] Add blockburn, snowform, leavesdecay render events --- configuration.txt | 3 ++ src/main/java/org/dynmap/DynmapPlugin.java | 33 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/configuration.txt b/configuration.txt index 1cb80333..13ff9835 100644 --- a/configuration.txt +++ b/configuration.txt @@ -78,6 +78,9 @@ render-triggers: # - playerjoin - blockplaced - blockbreak + - snowform + - leavesdecay + - blockburn # The path where the tile-files are placed. tilespath: web/tiles diff --git a/src/main/java/org/dynmap/DynmapPlugin.java b/src/main/java/org/dynmap/DynmapPlugin.java index ff45f8da..d703c812 100644 --- a/src/main/java/org/dynmap/DynmapPlugin.java +++ b/src/main/java/org/dynmap/DynmapPlugin.java @@ -18,8 +18,11 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockListener; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.block.SnowFormEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerListener; import org.bukkit.event.player.PlayerMoveEvent; @@ -180,11 +183,35 @@ public class DynmapPlugin extends JavaPlugin { BlockListener renderTrigger = new BlockListener() { @Override public void onBlockPlace(BlockPlaceEvent event) { + if(event.isCancelled()) + return; mm.touch(event.getBlockPlaced().getLocation()); } @Override public void onBlockBreak(BlockBreakEvent event) { + if(event.isCancelled()) + return; + mm.touch(event.getBlock().getLocation()); + } + @Override + public void onSnowForm(SnowFormEvent event) { + if(event.isCancelled()) + return; + mm.touch(event.getBlock().getLocation()); + } + + @Override + public void onLeavesDecay(LeavesDecayEvent event) { + if(event.isCancelled()) + return; + mm.touch(event.getBlock().getLocation()); + } + + @Override + public void onBlockBurn(BlockBurnEvent event) { + if(event.isCancelled()) + return; mm.touch(event.getBlock().getLocation()); } }; @@ -192,6 +219,12 @@ public class DynmapPlugin extends JavaPlugin { pm.registerEvent(org.bukkit.event.Event.Type.BLOCK_PLACE, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this); if (isTrigger("blockbreak")) pm.registerEvent(org.bukkit.event.Event.Type.BLOCK_BREAK, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this); + if (isTrigger("snowform")) + pm.registerEvent(org.bukkit.event.Event.Type.SNOW_FORM, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this); + if (isTrigger("leavesdecay")) + pm.registerEvent(org.bukkit.event.Event.Type.LEAVES_DECAY, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this); + if (isTrigger("blockburn")) + pm.registerEvent(org.bukkit.event.Event.Type.BLOCK_BURN, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this); } { PlayerListener renderTrigger = new PlayerListener() {