Program: 2023
Project: 2023
Buggy source:
/** 
 * Adds an item to be stocked by the selected trader.
 * @param player
 * @param npc
 * @param item
 * @param price
 * @param selling
 */
private void changeTraderStock(Player player,HumanNPC npc,String item,String price,boolean selling){
  if (item.contains("String_Node_Str")) {
    Material mat=StringUtils.parseMaterial(price);
    if (mat == null) {
      player.sendMessage(ChatColor.RED + "String_Node_Str");
      return;
    }
    if (selling) {
      if (npc.getTraderNPC().getStockable(mat.getId(),true) == null) {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
        return;
      }
 else {
        npc.traderNPC.removeStockable(mat.getId(),true);
        player.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(mat.name())+ "String_Node_Str");
      }
    }
 else {
      if (npc.getTraderNPC().getStockable(mat.getId(),false) == null) {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
        return;
      }
 else {
        npc.traderNPC.removeStockable(mat.getId(),false);
        player.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(mat.name())+ "String_Node_Str");
      }
    }
    return;
  }
  String[] split=item.split("String_Node_Str");
  ItemStack stack=createItemStack(split);
  if (stack == null) {
    player.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  split=price.split("String_Node_Str");
  ItemStack cost=null;
  if (split.length != 1) {
    cost=createItemStack(split);
    if (cost == null) {
      player.sendMessage(ChatColor.RED + "String_Node_Str");
      return;
    }
  }
  int data=Citizens.MAGIC_DATA_VALUE;
  if (stack.getData() != null)   data=stack.getData().getData();
  ItemPrice itemPrice=new ItemPrice(stack.getAmount(),stack.getTypeId(),data);
  itemPrice.setiConomy(cost == null);
  Stockable s=new Stockable(stack,itemPrice,false);
  String keyword="String_Node_Str";
  if (selling) {
    s.setSelling(true);
    keyword="String_Node_Str";
  }
  if (npc.getTraderNPC().isStocked(s)) {
    player.sendMessage(ChatColor.RED + "String_Node_Str" + keyword+ "String_Node_Str"+ MessageUtils.getStockableMessage(s,ChatColor.RED)+ "String_Node_Str");
    return;
  }
  npc.getTraderNPC().addStockable(s);
  player.sendMessage(ChatColor.GREEN + "String_Node_Str" + keyword+ MessageUtils.getStockableMessage(s,ChatColor.GREEN)+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Adds an item to be stocked by the selected trader.
 * @param player
 * @param npc
 * @param item
 * @param price
 * @param selling
 */
private void changeTraderStock(Player player,HumanNPC npc,String item,String price,boolean selling){
  if (item.contains("String_Node_Str")) {
    Material mat=StringUtils.parseMaterial(price);
    if (mat == null) {
      player.sendMessage(ChatColor.RED + "String_Node_Str");
      return;
    }
    if (selling) {
      if (npc.getTraderNPC().getStockable(mat.getId(),true) == null) {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
        return;
      }
 else {
        npc.traderNPC.removeStockable(mat.getId(),true);
        player.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(mat.name())+ "String_Node_Str");
      }
    }
 else {
      if (npc.getTraderNPC().getStockable(mat.getId(),false) == null) {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
        return;
      }
 else {
        npc.traderNPC.removeStockable(mat.getId(),false);
        player.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(mat.name())+ "String_Node_Str");
      }
    }
    return;
  }
  String[] split=item.split("String_Node_Str");
  ItemStack stack=createItemStack(split);
  if (stack == null) {
    player.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  split=price.split("String_Node_Str");
  ItemStack cost=null;
  if (split.length != 1) {
    cost=createItemStack(split);
    if (cost == null) {
      player.sendMessage(ChatColor.RED + "String_Node_Str");
      return;
    }
  }
  int data=Citizens.MAGIC_DATA_VALUE;
  if (cost.getData() != null)   data=cost.getData().getData();
  ItemPrice itemPrice=new ItemPrice(cost.getAmount(),cost.getTypeId(),data);
  itemPrice.setiConomy(cost == null);
  Stockable s=new Stockable(stack,itemPrice,false);
  String keyword="String_Node_Str";
  if (selling) {
    s.setSelling(true);
    keyword="String_Node_Str";
  }
  if (npc.getTraderNPC().isStocked(s)) {
    player.sendMessage(ChatColor.RED + "String_Node_Str" + keyword+ "String_Node_Str"+ MessageUtils.getStockableMessage(s,ChatColor.RED)+ "String_Node_Str");
    return;
  }
  npc.getTraderNPC().addStockable(s);
  player.sendMessage(ChatColor.GREEN + "String_Node_Str" + keyword+ MessageUtils.getStockableMessage(s,ChatColor.GREEN)+ "String_Node_Str");
}