Merge pull request 'Allow stationary moving pistons during preparation' (#316) from stationaryMovingPistons into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #316 Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
a38ee39419
@ -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();
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren