SteamWar/FightSystem
Archiviert
13
1

Allow stationary moving pistons during preparation
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-12-22 12:40:41 +01:00
Ursprung fd0a7b4e3d
Commit 2086366deb

Datei anzeigen

@ -26,6 +26,7 @@ import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.OneShotStateDependent;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.FlatteningWrapper;
import de.steamwar.fightsystem.utils.Region;
@ -37,10 +38,25 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Set;
public class PrepareSchem implements Listener {
private final Set<Vector> stationaryMovingPistons = new HashSet<>();
public PrepareSchem() {
new OneShotStateDependent(ArenaMode.Prepare, FightState.PostSchemSetup, () -> Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
stationaryMovingPistons.clear();
World world = Bukkit.getWorlds().get(0);
Fight.getUnrotated().getSchemRegion().forEach((x, y, z) -> {
if(FlatteningWrapper.impl.checkPistonMoving(world.getBlockAt(x, y, z)))
stationaryMovingPistons.add(new Vector(x, y, z));
});
}, 1));
new StateDependentListener(ArenaMode.Prepare, FightState.Setup, this){
@Override
public void disable() {
@ -60,7 +76,7 @@ public class PrepareSchem implements Listener {
try{
region.forEach((x, y, z) -> {
if(FlatteningWrapper.impl.checkPistonMoving(world.getBlockAt(x, y, z))){
if(FlatteningWrapper.impl.checkPistonMoving(world.getBlockAt(x, y, z)) && !stationaryMovingPistons.contains(new Vector(x, y, z))){
FightSystem.getMessage().broadcast("PREPARE_ACTIVE_PISTON");
Bukkit.shutdown();
throw new IllegalStateException();