diff --git a/src/main/java/org/dynmap/DynmapBlockListener.java b/src/main/java/org/dynmap/DynmapBlockListener.java index 1168ab6f..23e62d50 100644 --- a/src/main/java/org/dynmap/DynmapBlockListener.java +++ b/src/main/java/org/dynmap/DynmapBlockListener.java @@ -20,4 +20,12 @@ public class DynmapBlockListener extends BlockListener { Block blockPlaced = event.getBlock(); mgr.touch(blockPlaced.getX(), blockPlaced.getY(), blockPlaced.getZ()); } + + @Override + public void onBlockDamaged(BlockDamagedEvent event) { + if (event.getDamageLevel() == BlockDamageLevel.BROKEN) { + Block blockBroken = event.getBlock(); + mgr.touch(blockBroken.getX(), blockBroken.getY(), blockBroken.getZ()); + } + } } diff --git a/src/main/java/org/dynmap/DynmapPlugin.java b/src/main/java/org/dynmap/DynmapPlugin.java index 16b2b917..d25438b1 100644 --- a/src/main/java/org/dynmap/DynmapPlugin.java +++ b/src/main/java/org/dynmap/DynmapPlugin.java @@ -7,6 +7,7 @@ import java.io.File; import org.bukkit.*; import org.bukkit.event.*; import org.bukkit.event.Event.Priority; +import org.bukkit.event.block.BlockListener; import org.bukkit.plugin.*; import org.bukkit.plugin.java.*; import org.dynmap.debug.BukkitPlayerDebugger; @@ -29,7 +30,6 @@ public class DynmapPlugin extends JavaPlugin { return getServer().getWorlds()[0]; } - @Override public void onEnable() { debugger.enable(); mgr = new MapManager(getWorld(), debugger); @@ -44,7 +44,6 @@ public class DynmapPlugin extends JavaPlugin { registerEvents(); } - @Override public void onDisable() { mgr.stopManager(); @@ -56,7 +55,10 @@ public class DynmapPlugin extends JavaPlugin { } public void registerEvents() { - getServer().getPluginManager().registerEvent(Event.Type.BLOCK_PLACED, new DynmapBlockListener(mgr), Priority.Normal, this); + BlockListener blockListener = new DynmapBlockListener(mgr); + getServer().getPluginManager().registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this); + getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this); + getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, new DynmapPlayerListener(mgr), Priority.Normal, this); //getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DESTROYED, listener, Priority.Normal, this); /* etc.getLoader().addListener(PluginLoader.Hook.COMMAND, listener, this, PluginListener.Priority.MEDIUM); diff --git a/src/main/java/org/dynmap/debug/NullDebugger.java b/src/main/java/org/dynmap/debug/NullDebugger.java index 7d23b8d1..0fea7e7d 100644 --- a/src/main/java/org/dynmap/debug/NullDebugger.java +++ b/src/main/java/org/dynmap/debug/NullDebugger.java @@ -1,15 +1,12 @@ package org.dynmap.debug; public class NullDebugger implements Debugger { - @Override public void debug(String message) { } - @Override public void error(String message) { } - @Override public void error(String message, Throwable thrown) { }