@Override public void onBlockRedstoneChange(BlockRedstoneEvent event) { if (BlockUtil.isSign(event.getBlock())) { SignActionEvent info = new SignActionEvent(event.getBlock()); SignAction.executeAll(info, SignActionType.REDSTONE_CHANGE); boolean powered = poweredBlocks.contains(event.getBlock()); if (!powered && event.getNewCurrent() > 0) { poweredBlocks.add(event.getBlock()); SignAction.executeAll(info, SignActionType.REDSTONE_ON); } else if (powered && event.getNewCurrent() == 0) { poweredBlocks.remove(event.getBlock()); SignAction.executeAll(info, SignActionType.REDSTONE_OFF); } } }
public void updateRedstonePower(final Block signblock) { final SignActionEvent info = new SignActionEvent(signblock); SignAction.executeAll(info, SignActionType.REDSTONE_CHANGE); // Do not proceed if the sign disallows on/off changes if (info.isPowerAlwaysOn() || ignoredSigns.remove(signblock)) { return; } // Update power level setRedstonePower(info, isPowered(info)); }
public void setRedstonePower(SignActionEvent info, boolean newPowerState) { // Change in redstone power? if (!LogicUtil.addOrRemove(poweredBlocks, info.getBlock(), newPowerState)) { return; } // Execute event SignAction.executeAll( info, info.isPowerInverted() != newPowerState ? SignActionType.REDSTONE_ON : SignActionType.REDSTONE_OFF); }
public void onSignChange(SignChangeEvent event) { SignAction.handleBuild(event); }