diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java index ae54b213..a6ea8a47 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java @@ -101,11 +101,22 @@ public class FreezeListener implements Listener { } @EventHandler - public void onBlockBreak(BlockBreakEvent event) { + public void onBlockBreak(BlockBreakEvent e) { if (Core.getVersion() < 19) return; - if (Region.getRegion(event.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { - event.setCancelled(true); - event.getBlock().setType(Material.AIR, false); + if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + e.setCancelled(true); + e.getBlock().setType(Material.AIR, false); + } + } + + @EventHandler + public void onBlockPlace(BlockPlaceEvent e) { + if (Core.getVersion() < 19) return; + if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + e.setCancelled(true); + Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { + e.getBlock().setType(e.getItemInHand().getType(), false); + }, 1L); } } @@ -124,16 +135,23 @@ public class FreezeListener implements Listener { } @EventHandler - public void onBlockFromTo(BlockFromToEvent event) { - if (Region.getRegion(event.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { - event.setCancelled(true); + public void onBlockFromTo(BlockFromToEvent e) { + if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + e.setCancelled(true); } } @EventHandler - public void onSpongeAbsorb(SpongeAbsorbEvent event) { - if (Region.getRegion(event.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { - event.setCancelled(true); + public void onSpongeAbsorb(SpongeAbsorbEvent e) { + if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + e.setCancelled(true); + } + } + + @EventHandler + public void onBlockForm(BlockFormEvent e) { + if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + e.setCancelled(true); } } }