Program: 184965
Project: 184965
Buggy source:
@Override public void onBlockRedstoneChange(BlockRedstoneEvent event){
  Block block=event.getBlock();
  if (event.getNewCurrent() == 0 && block.getTypeId() == 74) {
    block.setTypeId(Material.REDSTONE_ORE.getId());
  }
  int newPower=event.getNewCurrent() - (event.getNewCurrent() == 0 ? 0 : 1);
  BlockMatrixNode oreCircuit=new BlockMatrixNode(block,new HashMap<Block,BlockMatrixNode>());
  if (block.getTypeId() == 73 || block.getTypeId() == 74) {
    if (event.getNewCurrent() > event.getOldCurrent()) {
      oreCircuit.setFilter(new HashSet<Material>(EnumSet.of(Material.REDSTONE_ORE)));
      oreCircuit.floodFill();
      if (oreCircuit.getBlockMatrix().size() > 1) {
        for (        Block change : oreCircuit.getBlockMatrix()) {
          change.setTypeId(74);
        }
      }
    }
 else     if (event.getNewCurrent() != event.getOldCurrent()) {
      oreCircuit.setFilter(new HashSet<Material>(EnumSet.of(Material.GLOWING_REDSTONE_ORE)));
      oreCircuit.floodFill();
      if (oreCircuit.getBlockMatrix().size() > 1) {
        for (        Block change : oreCircuit.getBlockMatrix()) {
          change.setTypeId(73);
        }
      }
    }
    if (oreCircuit.getBlockMatrix().size() > 1) {
      oreCircuit.setFilter(EnumSet.complementOf(EnumSet.of(Material.REDSTONE_ORE,Material.GLOWING_REDSTONE_ORE)));
      for (      BlockMatrixNode next : oreCircuit.getBlockMatrixNodes()) {
        for (        Block eventTarget : next.getFilteredExternalAdjancentBlocks()) {
          int oldPower=0;
          if (eventTarget.getState() instanceof RedstoneWire) {
            oldPower=eventTarget.getBlockPower();
            eventTarget.setData((byte)newPower);
          }
          plugin.getServer().getPluginManager().callEvent(new BlockRedstoneEvent(eventTarget,oldPower,newPower));
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onBlockRedstoneChange(BlockRedstoneEvent event){
  Block block=event.getBlock();
  if (event.getNewCurrent() == 0 && block.getTypeId() == 74) {
    block.setTypeId(Material.REDSTONE_ORE.getId());
  }
  int newPower=event.getNewCurrent() - (event.getNewCurrent() == 0 ? 0 : 1);
  BlockMatrixNode oreCircuit=new BlockMatrixNode(block,new HashMap<Block,BlockMatrixNode>());
  if (block.getTypeId() == Material.REDSTONE_WIRE.getId()) {
    block.setData((byte)event.getNewCurrent());
    oreCircuit.setFilter(new HashSet<Material>(EnumSet.of(Material.REDSTONE_ORE,Material.GLOWING_REDSTONE_ORE)));
    for (    Block eventTarget : oreCircuit.getFilteredExternalAdjancentBlocks()) {
      int oldPower=0;
      if (eventTarget.getState().getData() instanceof RedstoneWire) {
        if (eventTarget.getBlockPower() > 0) {
          continue;
        }
        oldPower=eventTarget.getBlockPower();
        eventTarget.setData((byte)newPower);
      }
      plugin.getServer().getPluginManager().callEvent(new BlockRedstoneEvent(eventTarget,oldPower,newPower));
    }
  }
  if (block.getTypeId() == 73 || block.getTypeId() == 74) {
    if (event.getNewCurrent() > event.getOldCurrent()) {
      oreCircuit.setFilter(new HashSet<Material>(EnumSet.of(Material.REDSTONE_ORE)));
      oreCircuit.floodFill();
      for (      Block change : oreCircuit.getBlockMatrix()) {
        change.setTypeId(74);
      }
    }
 else     if (event.getNewCurrent() != event.getOldCurrent()) {
      oreCircuit.setFilter(new HashSet<Material>(EnumSet.of(Material.GLOWING_REDSTONE_ORE)));
      oreCircuit.floodFill();
      for (      Block change : oreCircuit.getBlockMatrix()) {
        change.setTypeId(73);
      }
    }
    oreCircuit.setFilter(EnumSet.complementOf(EnumSet.of(Material.REDSTONE_ORE,Material.GLOWING_REDSTONE_ORE)));
    for (    BlockMatrixNode next : oreCircuit.getBlockMatrixNodes()) {
      for (      Block eventTarget : next.getFilteredExternalAdjancentBlocks()) {
        int oldPower=0;
        if (eventTarget.getState().getData() instanceof RedstoneWire) {
          oldPower=eventTarget.getBlockPower();
          eventTarget.setData((byte)newPower);
        }
        plugin.getServer().getPluginManager().callEvent(new BlockRedstoneEvent(eventTarget,oldPower,newPower));
      }
    }
  }
}