From 08ae54582038033c4723d252c171b81dc057c8b2 Mon Sep 17 00:00:00 2001 From: jojo Date: Thu, 4 Feb 2021 10:06:26 +0100 Subject: [PATCH] Fix Freeze Exceptions --- .../bausystem/commands/CommandFreeze.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java index a366121..ad268b1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java @@ -24,6 +24,7 @@ import de.steamwar.bausystem.world.Region; import de.steamwar.core.Core; import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.block.*; import org.bukkit.event.entity.EntityChangeBlockEvent; @@ -53,12 +54,14 @@ public class CommandFreeze extends RegionToggleCommand { @EventHandler public void onEntitySpawn(EntitySpawnEvent e) { - if (Region.getRegion(e.getLocation()).isFreeze()) e.setCancelled(true); - if (Core.getVersion() == 15) return; - if (e.isCancelled()) { - Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> { - e.getLocation().getBlock().setType(Material.TNT, false); - }, 1L); + if (Region.getRegion(e.getLocation()).isFreeze()) { + e.setCancelled(true); + if (Core.getVersion() == 15) return; + if (e.getEntityType() == EntityType.PRIMED_TNT) { + Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> { + e.getLocation().getBlock().setType(Material.TNT, false); + }, 1L); + } } }