SteamWar/FightSystem
Archiviert
13
1

Fix pistons destroying blocks
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-12-23 16:19:58 +01:00
Ursprung 49c2793297
Commit cd8a3d3eb5

Datei anzeigen

@ -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;
} }