Works
This commit is contained in:
parent
716bc7c9a6
commit
506bb66b13
@ -12,6 +12,7 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.material.PistonBaseMaterial;
|
import org.bukkit.material.PistonBaseMaterial;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -35,14 +36,24 @@ public class WorldListener implements Listener {
|
|||||||
Block b = block.getRelative(piston.getFacing(), i);
|
Block b = block.getRelative(piston.getFacing(), i);
|
||||||
if (b.isLiquid() || b.isEmpty()) break;
|
if (b.isLiquid() || b.isEmpty()) break;
|
||||||
if (b.getPistonMoveReaction().equals(PistonMoveReaction.IGNORE) || b.getPistonMoveReaction().equals(PistonMoveReaction.BLOCK)) {
|
if (b.getPistonMoveReaction().equals(PistonMoveReaction.IGNORE) || b.getPistonMoveReaction().equals(PistonMoveReaction.BLOCK)) {
|
||||||
if (!(b.getType() == Material.CHEST || b.getType() == Material.FURNACE || b.getType() == Material.BURNING_FURNACE)) {
|
break;
|
||||||
if (ExtendedPistons.INSTANCE.isAllowedTime())
|
|
||||||
isMovable = false;
|
|
||||||
} else {
|
|
||||||
blocks.add(b);
|
|
||||||
}
|
|
||||||
} else if (b.getPistonMoveReaction().equals(PistonMoveReaction.BREAK)) {
|
} else if (b.getPistonMoveReaction().equals(PistonMoveReaction.BREAK)) {
|
||||||
break;
|
break;
|
||||||
|
} else if(b.getPistonMoveReaction().equals(PistonMoveReaction.MOVE)) {
|
||||||
|
if (b.getType() == Material.CHEST || b.getType() == Material.FURNACE || b.getType() == Material.BURNING_FURNACE) {
|
||||||
|
if (ExtendedPistons.INSTANCE.isAllowedTime()) {
|
||||||
|
if(b.getType() == Material.CHEST) {
|
||||||
|
Block b2 = block.getRelative(piston.getFacing(), i+2);
|
||||||
|
if(b2.getType() == Material.CHEST) {
|
||||||
|
Chest chest = (Chest) b2.getState();
|
||||||
|
InventoryHolder ih = chest.getInventory().getHolder();
|
||||||
|
if (ih instanceof DoubleChest) {
|
||||||
|
isMovable = false;
|
||||||
|
} else blocks.add(b);
|
||||||
|
} else blocks.add(b);
|
||||||
|
} else blocks.add(b);
|
||||||
|
} else isMovable = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
blocks.add(b);
|
blocks.add(b);
|
||||||
}
|
}
|
||||||
@ -146,15 +157,25 @@ public class WorldListener implements Listener {
|
|||||||
Block b = block.getRelative(piston.getFacing(), i);
|
Block b = block.getRelative(piston.getFacing(), i);
|
||||||
if (b.isLiquid() || b.isEmpty()) break;
|
if (b.isLiquid() || b.isEmpty()) break;
|
||||||
if (b.getPistonMoveReaction().equals(PistonMoveReaction.IGNORE) || b.getPistonMoveReaction().equals(PistonMoveReaction.BLOCK)) {
|
if (b.getPistonMoveReaction().equals(PistonMoveReaction.IGNORE) || b.getPistonMoveReaction().equals(PistonMoveReaction.BLOCK)) {
|
||||||
if (!(b.getType() == Material.CHEST || b.getType() == Material.FURNACE || b.getType() == Material.BURNING_FURNACE)) {
|
break;
|
||||||
if (ExtendedPistons.INSTANCE.isAllowedTime())
|
|
||||||
isMovable = false;
|
|
||||||
} else {
|
|
||||||
blocks.add(b);
|
|
||||||
}
|
|
||||||
} else if (b.getPistonMoveReaction().equals(PistonMoveReaction.BREAK)) {
|
} else if (b.getPistonMoveReaction().equals(PistonMoveReaction.BREAK)) {
|
||||||
toBreak = b;
|
toBreak = b;
|
||||||
break;
|
break;
|
||||||
|
} else if(b.getPistonMoveReaction().equals(PistonMoveReaction.MOVE)) {
|
||||||
|
if (b.getType() == Material.CHEST || b.getType() == Material.FURNACE || b.getType() == Material.BURNING_FURNACE) {
|
||||||
|
if (ExtendedPistons.INSTANCE.isAllowedTime()) {
|
||||||
|
if(b.getType() == Material.CHEST) {
|
||||||
|
Block b2 = block.getRelative(piston.getFacing(), i+2);
|
||||||
|
if(b2.getType() == Material.CHEST) {
|
||||||
|
Chest chest = (Chest) b2.getState();
|
||||||
|
InventoryHolder ih = chest.getInventory().getHolder();
|
||||||
|
if (ih instanceof DoubleChest) {
|
||||||
|
isMovable = false;
|
||||||
|
} else blocks.add(b);
|
||||||
|
} else blocks.add(b);
|
||||||
|
} else blocks.add(b);
|
||||||
|
} else isMovable = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
blocks.add(b);
|
blocks.add(b);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user