From 709e6f11dc78a2838a34cda46d6325400df7b614 Mon Sep 17 00:00:00 2001 From: jojo Date: Wed, 3 Feb 2021 11:13:33 +0100 Subject: [PATCH] Fix tnt spawning on redstone sources --- .../bausystem/commands/CommandFreeze.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java index 53d6395..4c1103e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java @@ -20,7 +20,10 @@ package de.steamwar.bausystem.commands; +import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.world.Region; +import org.bukkit.Bukkit; +import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.block.*; @@ -65,15 +68,21 @@ public class CommandFreeze extends RegionToggleCommand { if (!region.isFreeze()) { return; } - if (e.getEntityType() == EntityType.FALLING_BLOCK) { - e.setCancelled(true); + e.setCancelled(true); + if (e.getEntityType() == EntityType.PRIMED_TNT) { + Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> { + e.getLocation().getBlock().setType(Material.TNT, false); + }, 1); } }, () -> { if (!Region.NoRegion.freeze) { return; } - if (e.getEntityType() == EntityType.FALLING_BLOCK) { - e.setCancelled(true); + e.setCancelled(true); + if (e.getEntityType() == EntityType.PRIMED_TNT) { + Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> { + e.getLocation().getBlock().setType(Material.TNT, false); + }, 1); } }); }