SteamWar/BauSystem2.0
Archiviert
12
0

Fix TNTPhase spawning in frozen Region
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-12-16 22:22:53 +01:00
Ursprung 006a0edef6
Commit 3d0ebbe743

Datei anzeigen

@ -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.data.SimulatorPhase;
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction; 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.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -59,7 +64,9 @@ public final class TNTPhase extends SimulatorPhase {
tickStart.accept(tickOffset, new SimulatorAction(order, count) { tickStart.accept(tickOffset, new SimulatorAction(order, count) {
@Override @Override
public void accept(World world) { 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 (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0));
if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0)); if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0));
if (!zJump) tnt.setVelocity(tnt.getVelocity().setZ(0)); if (!zJump) tnt.setVelocity(tnt.getVelocity().setZ(0));