Skip to content

Commit

Permalink
Add skipping conditions for redstone current change.
Browse files Browse the repository at this point in the history
  • Loading branch information
asofold committed Dec 7, 2016
1 parent ef9492b commit 06c2cad
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -114,11 +114,9 @@ public void onPistonRetract(final BlockPistonRetractEvent event) {
}
final List<Block> blocks;
if (retractHasBlocks) {
// TODO: Legacy: Set flag in constructor (getRetractLocation).
blocks = event.getBlocks();
}
else {
// TODO: Use getRetractLocation.
@SuppressWarnings("deprecation")
final Location retLoc = event.getRetractLocation();
if (retLoc == null) {
Expand Down Expand Up @@ -163,6 +161,11 @@ public void onBlockRedstone(final BlockRedstoneEvent event) {
if (!enabled) {
return;
}
final int oldCurrent = event.getOldCurrent();
final int newCurrent = event.getNewCurrent();
if (oldCurrent == newCurrent || oldCurrent > 0 && newCurrent > 0) {
return;
}
// TODO: Fine grained enabling state (pistons, doors, other).
final Block block = event.getBlock();
// TODO: Abstract method for a block and a set of materials (redstone, interact, ...).
Expand Down

0 comments on commit 06c2cad

Please sign in to comment.