Merge branch 'master' into Anti_Ice_Melt
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Commit
5c8a00a25a
@ -25,6 +25,7 @@ import de.steamwar.fightsystem.states.FightState;
|
|||||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.PistonMoveReaction;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||||
@ -44,7 +45,8 @@ public class PistonListener implements Listener {
|
|||||||
public void handlePistonExtend(BlockPistonExtendEvent e){
|
public void handlePistonExtend(BlockPistonExtendEvent e){
|
||||||
BlockFace face = e.getDirection();
|
BlockFace face = e.getDirection();
|
||||||
for(Block block : e.getBlocks()){
|
for(Block block : e.getBlocks()){
|
||||||
if(!Config.BlueExtendRegion.inRegion(block.getRelative(face)) && !Config.RedExtendRegion.inRegion(block.getRelative(face))){
|
Block target = block.getRelative(face);
|
||||||
|
if(!Config.BlueExtendRegion.inRegion(target) && !Config.RedExtendRegion.inRegion(target) && block.getPistonMoveReaction() != PistonMoveReaction.BREAK) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import de.steamwar.fightsystem.FightSystem;
|
|||||||
import de.steamwar.fightsystem.fight.Fight;
|
import de.steamwar.fightsystem.fight.Fight;
|
||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
|
import de.steamwar.fightsystem.states.OneShotStateDependent;
|
||||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||||
import de.steamwar.fightsystem.utils.FlatteningWrapper;
|
import de.steamwar.fightsystem.utils.FlatteningWrapper;
|
||||||
import de.steamwar.fightsystem.utils.Region;
|
import de.steamwar.fightsystem.utils.Region;
|
||||||
@ -37,10 +38,25 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class PrepareSchem implements Listener {
|
public class PrepareSchem implements Listener {
|
||||||
|
|
||||||
|
private final Set<Vector> stationaryMovingPistons = new HashSet<>();
|
||||||
|
|
||||||
public PrepareSchem() {
|
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){
|
new StateDependentListener(ArenaMode.Prepare, FightState.Setup, this){
|
||||||
@Override
|
@Override
|
||||||
public void disable() {
|
public void disable() {
|
||||||
@ -60,7 +76,7 @@ public class PrepareSchem implements Listener {
|
|||||||
|
|
||||||
try{
|
try{
|
||||||
region.forEach((x, y, z) -> {
|
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");
|
FightSystem.getMessage().broadcast("PREPARE_ACTIVE_PISTON");
|
||||||
Bukkit.shutdown();
|
Bukkit.shutdown();
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
@ -34,6 +34,7 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
@ -77,6 +78,16 @@ public class TeamArea implements Listener {
|
|||||||
FightSystem.getMessage().sendPrefixless("NO_BLOCK_PLACE", player, ChatMessageType.ACTION_BAR);
|
FightSystem.getMessage().sendPrefixless("NO_BLOCK_PLACE", player, ChatMessageType.ACTION_BAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void blockBreak(BlockBreakEvent event) {
|
||||||
|
Block block = event.getBlock();
|
||||||
|
if(Config.BluePasteRegion.getMinY() <= block.getY())
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
FightSystem.getMessage().sendPrefixless("NO_BLOCK_BREAK", event.getPlayer(), ChatMessageType.ACTION_BAR);
|
||||||
|
}
|
||||||
|
|
||||||
private void checkInTeamRegion(PlayerMoveEvent event, FightTeam team, Player player, FightTeam playerTeam) {
|
private void checkInTeamRegion(PlayerMoveEvent event, FightTeam team, Player player, FightTeam playerTeam) {
|
||||||
boolean spectator = player.getGameMode() == GameMode.SPECTATOR;
|
boolean spectator = player.getGameMode() == GameMode.SPECTATOR;
|
||||||
if(!spectator && playerTeam != null && playerTeam.canPlayerEntern(player))
|
if(!spectator && playerTeam != null && playerTeam.canPlayerEntern(player))
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren