Skip to content
Permalink
Browse files

Potential solution for a reported issue with bridges that I can't rep…

…roduce
  • Loading branch information...
me4502 committed Jun 26, 2019
1 parent 4c8646a commit 40b89a295b79a6c13cfdaa9ebad76c4189a0d830
@@ -270,7 +270,7 @@ public boolean flipState(Block trigger, CraftBookPlayer player) throws InvalidMe
Block proximalBaseCenter = getBlockBase(trigger);

BlockData bridgeType = getBlockType(trigger);
if (proximalBaseCenter.getType() != bridgeType.getMaterial()) {
if (!BlockUtil.areBlocksIdentical(proximalBaseCenter, bridgeType)) {
throw new InvalidMechanismException("mech.bridge.material");
}

@@ -189,7 +189,7 @@ public boolean flipState(Block trigger, CraftBookPlayer player) throws InvalidMe
Block proximalBaseCenter = getBlockBase(trigger);

BlockData doorType = getBlockType(trigger);
if (proximalBaseCenter.getType() != doorType.getMaterial()) {
if (!BlockUtil.areBlocksIdentical(proximalBaseCenter, doorType)) {
throw new InvalidMechanismException("mech.bridge.material");
}

@@ -5,6 +5,7 @@
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Snow;
import org.bukkit.inventory.ItemStack;

@@ -21,6 +22,10 @@ public static boolean areBlocksIdentical(Block block, Block block2) {
return block.getType() == block2.getType() && block.getBlockData().matches(block2.getBlockData());
}

public static boolean areBlocksIdentical(Block block, BlockData block2) {
return block.getType() == block2.getMaterial() && block.getBlockData().matches(block2);
}

public static boolean isBlockSimilarTo(Block block, Material type) {
return block.getType() == type;
}

0 comments on commit 40b89a2

Please sign in to comment.
You can’t perform that action at this time.