SteamWar/FightSystem
Archiviert
13
1

Fix 1.8 to 1.12 dispenser
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-01-22 22:19:53 +01:00
Ursprung 20e6501f68
Commit 239c0bf5f6
4 geänderte Dateien mit 15 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -25,6 +25,7 @@ import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.Dispenser;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BlockDataMeta;
@ -111,4 +112,9 @@ public class FlatteningWrapper14 implements FlatteningWrapper {
public boolean checkPistonMoving(Block block) {
return block.getType() == Material.MOVING_PISTON;
}
@Override
public boolean isFacingWater(Block dispenser) {
return dispenser.getRelative(((Dispenser) dispenser.getBlockData()).getFacing()).isLiquid();
}
}

Datei anzeigen

@ -77,4 +77,9 @@ public class FlatteningWrapper8 implements FlatteningWrapper {
public boolean checkPistonMoving(Block block) {
return block.getType() == Material.PISTON_MOVING_PIECE;
}
@Override
public boolean isFacingWater(Block dispenser) {
return false;
}
}

Datei anzeigen

@ -26,11 +26,11 @@ import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.FlatteningWrapper;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.data.type.Dispenser;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -172,7 +172,7 @@ public class Permanent implements Listener {
if(!Config.ArenaRegion.inRegion(block))
return;
if(e.getItem().getType() == Material.TNT || block.getRelative(((Dispenser) block.getBlockData()).getFacing()).isLiquid())
if(e.getItem().getType() == Material.TNT || FlatteningWrapper.impl.isFacingWater(block))
e.setCancelled(true);
}
}

Datei anzeigen

@ -46,4 +46,6 @@ public interface FlatteningWrapper {
void forceLoadChunk(World world, int cX, int cZ);
boolean checkPistonMoving(Block block);
boolean isFacingWater(Block dispenser);
}