Program: 39770
Project: 39770
Buggy source:
@EventHandler public void onInteract(PlayerInteractEntityEvent event){
  Entity entity=event.getRightClicked();
  if (!entity.hasMetadata(GlobalValues.METATAG)) {
    return;
  }
  if (entity.hasMetadata(GlobalValues.CURRENTLY_BREEDING) && entity.getMetadata(GlobalValues.CURRENTLY_BREEDING).get(0).asBoolean()) {
    return;
  }
  if (sm.getVersionId() > 1) {
    if (!(event.getHand() == EquipmentSlot.HAND)) {
      return;
    }
  }
  if (event.isCancelled()) {
    return;
  }
  if (entity instanceof Animals) {
    if (correctFood(event.getPlayer().getItemInHand(),entity) && ((Animals)entity).canBreed()) {
      int stackSize=entity.getMetadata(GlobalValues.METATAG).get(0).asInt();
      if (stackSize <= 1) {
        return;
      }
      if (sm.config.getCustomConfig().getBoolean("String_Node_Str")) {
        int breedSize=stackSize;
        sm.getLogger().info("String_Node_Str");
        if (event.getPlayer().getItemInHand().getAmount() < breedSize) {
          breedSize=event.getPlayer().getItemInHand().getAmount();
        }
        int childAmount=(int)Math.floor(breedSize / 2);
        Animals child=(Animals)sm.tools.duplicate(entity);
        child.setMetadata(GlobalValues.METATAG,new FixedMetadataValue(sm,childAmount));
        child.setMetadata(GlobalValues.NO_SPAWN_STACK,new FixedMetadataValue(sm,true));
        child.setBaby();
      }
 else       if (sm.config.getCustomConfig().getBoolean("String_Node_Str")) {
        Entity newEntity=sm.tools.duplicate(entity,true);
        newEntity.setMetadata(GlobalValues.METATAG,new FixedMetadataValue(sm,stackSize - 1));
        newEntity.setMetadata(GlobalValues.NO_SPAWN_STACK,new FixedMetadataValue(sm,true));
        entity.setMetadata(GlobalValues.METATAG,new FixedMetadataValue(sm,1));
        entity.setMetadata(GlobalValues.NO_STACK_ALL,new FixedMetadataValue(sm,true));
        entity.setMetadata(GlobalValues.CURRENTLY_BREEDING,new FixedMetadataValue(sm,true));
        entity.setCustomName(null);
        new BukkitRunnable(){
          @Override public void run(){
            if (!entity.isDead()) {
              entity.setMetadata(GlobalValues.CURRENTLY_BREEDING,new FixedMetadataValue(sm,false));
              entity.setMetadata(GlobalValues.NO_STACK_ALL,new FixedMetadataValue(sm,false));
            }
          }
        }
.runTaskLater(sm,20 * 20);
      }
      return;
    }
  }
  if (sm.config.getCustomConfig().getBoolean("String_Node_Str")) {
    if (event.getPlayer().getItemInHand().getType() == Material.NAME_TAG && event.getPlayer().getItemInHand().getItemMeta().hasDisplayName()) {
      if (entity.getMetadata(GlobalValues.METATAG).get(0).asInt() > 1) {
        Entity dupe=sm.tools.duplicate(entity);
        dupe.setMetadata(GlobalValues.METATAG,new FixedMetadataValue(sm,entity.getMetadata(GlobalValues.METATAG).get(0).asInt() - 1));
        dupe.setMetadata(GlobalValues.NO_SPAWN_STACK,new FixedMetadataValue(sm,true));
      }
      entity.removeMetadata(GlobalValues.METATAG,sm);
      entity.setMetadata(GlobalValues.NO_STACK_ALL,new FixedMetadataValue(sm,true));
    }
  }
}

Fixed version (ground truth):
@EventHandler public void onInteract(PlayerInteractEntityEvent event){
  Entity entity=event.getRightClicked();
  if (!entity.hasMetadata(GlobalValues.METATAG)) {
    return;
  }
  if (entity.hasMetadata(GlobalValues.CURRENTLY_BREEDING) && entity.getMetadata(GlobalValues.CURRENTLY_BREEDING).get(0).asBoolean()) {
    return;
  }
  if (sm.getVersionId() > 1) {
    if (event.getHand() == EquipmentSlot.OFF_HAND) {
      return;
    }
  }
  if (event.isCancelled()) {
    return;
  }
  if (entity instanceof Animals) {
    if (correctFood(event.getPlayer().getItemInHand(),entity) && ((Animals)entity).canBreed()) {
      int stackSize=entity.getMetadata(GlobalValues.METATAG).get(0).asInt();
      if (stackSize <= 1) {
        return;
      }
      if (sm.config.getCustomConfig().getBoolean("String_Node_Str")) {
        int breedSize=stackSize;
        if (event.getPlayer().getItemInHand().getAmount() < breedSize) {
          breedSize=event.getPlayer().getItemInHand().getAmount();
        }
        int childAmount=(int)Math.floor(breedSize / 2);
        Animals child=(Animals)sm.tools.duplicate(entity);
        child.setMetadata(GlobalValues.METATAG,new FixedMetadataValue(sm,childAmount));
        child.setMetadata(GlobalValues.NO_SPAWN_STACK,new FixedMetadataValue(sm,true));
        child.setBaby();
        ((Animals)entity).setBreed(false);
      }
 else       if (sm.config.getCustomConfig().getBoolean("String_Node_Str")) {
        Entity newEntity=sm.tools.duplicate(entity,true);
        newEntity.setMetadata(GlobalValues.METATAG,new FixedMetadataValue(sm,stackSize - 1));
        newEntity.setMetadata(GlobalValues.NO_SPAWN_STACK,new FixedMetadataValue(sm,true));
        entity.setMetadata(GlobalValues.METATAG,new FixedMetadataValue(sm,1));
        entity.setMetadata(GlobalValues.NO_STACK_ALL,new FixedMetadataValue(sm,true));
        entity.setMetadata(GlobalValues.CURRENTLY_BREEDING,new FixedMetadataValue(sm,true));
        entity.setCustomName(null);
        new BukkitRunnable(){
          @Override public void run(){
            if (!entity.isDead()) {
              entity.setMetadata(GlobalValues.CURRENTLY_BREEDING,new FixedMetadataValue(sm,false));
              entity.setMetadata(GlobalValues.NO_STACK_ALL,new FixedMetadataValue(sm,false));
            }
          }
        }
.runTaskLater(sm,20 * 20);
      }
      return;
    }
  }
  if (sm.config.getCustomConfig().getBoolean("String_Node_Str")) {
    if (event.getPlayer().getItemInHand().getType() == Material.NAME_TAG && event.getPlayer().getItemInHand().getItemMeta().hasDisplayName()) {
      if (entity.getMetadata(GlobalValues.METATAG).get(0).asInt() > 1) {
        Entity dupe=sm.tools.duplicate(entity);
        dupe.setMetadata(GlobalValues.METATAG,new FixedMetadataValue(sm,entity.getMetadata(GlobalValues.METATAG).get(0).asInt() - 1));
        dupe.setMetadata(GlobalValues.NO_SPAWN_STACK,new FixedMetadataValue(sm,true));
      }
      entity.removeMetadata(GlobalValues.METATAG,sm);
      entity.setMetadata(GlobalValues.NO_STACK_ALL,new FixedMetadataValue(sm,true));
    }
  }
}