diff --git a/src/main/java/de/diddiz/LogBlock/listeners/ExplosionLogging.java b/src/main/java/de/diddiz/LogBlock/listeners/ExplosionLogging.java index eb1a1fc..e53b556 100644 --- a/src/main/java/de/diddiz/LogBlock/listeners/ExplosionLogging.java +++ b/src/main/java/de/diddiz/LogBlock/listeners/ExplosionLogging.java @@ -11,6 +11,7 @@ import org.bukkit.entity.*; import org.bukkit.entity.minecart.ExplosiveMinecart; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.projectiles.ProjectileSource; @@ -109,4 +110,27 @@ public class ExplosionLogging extends LoggingListener { } } } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onBlockExplode(BlockExplodeEvent event) { + for (final Block block : event.blockList()) { + final WorldConfig wcfg = getWorldConfig(block.getLocation().getWorld()); + + if (wcfg != null) { + if (!wcfg.isLogging(Logging.MISCEXPLOSION)) { + return; + } + Actor actor = new Actor("Explosion"); + + final int type = block.getTypeId(); + if (wcfg.isLogging(Logging.SIGNTEXT) & (type == 63 || type == 68)) { + consumer.queueSignBreak(actor, (Sign) block.getState()); + } else if (wcfg.isLogging(Logging.CHESTACCESS) && (getContainerBlocks().contains(Material.getMaterial(type)))) { + consumer.queueContainerBreak(actor, block.getState()); + } else { + consumer.queueBlockBreak(actor, block.getState()); + } + } + } + } }