From 2eef02ef13ecdd8219c509a85afce012330d44bb Mon Sep 17 00:00:00 2001 From: Allink Date: Mon, 20 Jun 2022 02:46:09 +0100 Subject: [PATCH] Fix beds exploding in the Nether & End dimensions with explosions off --- .../blocking/EventBlocker.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java index fb3713cd..5a004763 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java @@ -20,15 +20,7 @@ import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Tameable; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockDispenseEvent; -import org.bukkit.event.block.BlockFromToEvent; -import org.bukkit.event.block.BlockGrowEvent; -import org.bukkit.event.block.BlockIgniteEvent; -import org.bukkit.event.block.BlockPhysicsEvent; -import org.bukkit.event.block.BlockPistonExtendEvent; -import org.bukkit.event.block.BlockPistonRetractEvent; -import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.block.*; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDeathEvent; @@ -116,6 +108,16 @@ public class EventBlocker extends FreedomService event.setRadius(ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue()); } + + @EventHandler(priority = EventPriority.HIGH) + public void onBlockExplode(BlockExplodeEvent event) { + if(!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) { + event.setCancelled(true); + return; + } + + event.setYield(ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue()); + } @EventHandler(priority = EventPriority.HIGH) public void onEntityCombust(EntityCombustEvent event)