SteamWar/FightSystem
Archiviert
13
1

Merge pull request 'Fix piston boundary' (#309) from fixPistonBoundary into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #309
Reviewed-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Lixfel 2021-12-22 07:34:04 +01:00
Commit 887d3b50db

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState; 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.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;
@ -41,8 +42,9 @@ public class PistonListener implements Listener {
@EventHandler @EventHandler
public void handlePistonExtend(BlockPistonExtendEvent e){ public void handlePistonExtend(BlockPistonExtendEvent e){
BlockFace face = e.getDirection();
for(Block block : e.getBlocks()){ for(Block block : e.getBlocks()){
if(!Config.BlueExtendRegion.inRegion(block) && !Config.RedExtendRegion.inRegion(block)){ if(!Config.BlueExtendRegion.inRegion(block.getRelative(face)) && !Config.RedExtendRegion.inRegion(block.getRelative(face))){
e.setCancelled(true); e.setCancelled(true);
return; return;
} }