From 3d0ebbe74389bb32005014c527599c9a52c27baa Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 16 Dec 2023 22:22:53 +0100 Subject: [PATCH] Fix TNTPhase spawning in frozen Region --- .../bausystem/features/simulator/data/tnt/TNTPhase.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/data/tnt/TNTPhase.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/data/tnt/TNTPhase.java index 4af3dc15..2e913bdd 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/data/tnt/TNTPhase.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/data/tnt/TNTPhase.java @@ -21,9 +21,14 @@ package de.steamwar.bausystem.features.simulator.data.tnt; import de.steamwar.bausystem.features.simulator.data.SimulatorPhase; import de.steamwar.bausystem.features.simulator.execute.SimulatorAction; +import de.steamwar.bausystem.region.Region; +import de.steamwar.bausystem.region.flags.Flag; +import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode; +import de.steamwar.bausystem.region.tags.Tag; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.TNTPrimed; import org.bukkit.util.Vector; @@ -59,7 +64,9 @@ public final class TNTPhase extends SimulatorPhase { tickStart.accept(tickOffset, new SimulatorAction(order, count) { @Override public void accept(World world) { - TNTPrimed tnt = world.spawn(position.toLocation(world), TNTPrimed.class); + Location location = position.toLocation(world); + if (Region.getRegion(location).get(Flag.FREEZE) == FreezeMode.ACTIVE) return; + TNTPrimed tnt = world.spawn(location, TNTPrimed.class); if (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0)); if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0)); if (!zJump) tnt.setVelocity(tnt.getVelocity().setZ(0));