Program: 1863
Project: 1863
Buggy source:
@Command(aliases="String_Node_Str",usage="String_Node_Str",desc="String_Node_Str",modifiers="String_Node_Str",min=3,max=3) @CommandPermissions("String_Node_Str") public static void setNPCArmor(CommandContext args,Player player,HumanNPC npc){
  Material mat=StringUtils.parseMaterial(args.getString(2));
  if (mat == null) {
    player.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  if (!player.getInventory().contains(mat)) {
    player.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  if ((mat.getId() < 298 || mat.getId() > 317) && (mat.getId() != 86 && mat.getId() != 91)) {
    player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    return;
  }
  int slot=player.getInventory().first(mat);
  ItemStack item=NPCDataManager.decreaseItemStack(player.getInventory().getItem(slot));
  player.getInventory().setItem(slot,item);
  ArrayList<Integer> items=npc.getNPCData().getItems();
  int oldhelmet=items.get(1);
  if (args.getString(1).contains("String_Node_Str")) {
    items.set(1,mat.getId());
  }
 else   if (args.getString(1).equalsIgnoreCase("String_Node_Str")) {
    items.set(2,mat.getId());
  }
 else   if (args.getString(1).contains("String_Node_Str")) {
    items.set(3,mat.getId());
  }
 else   if (args.getString(1).contains("String_Node_Str")) {
    items.set(4,mat.getId());
  }
  npc.getNPCData().setItems(items);
  NPCDataManager.addItems(npc,items);
  if ((oldhelmet != 0 && items.get(1) == 0)) {
    NPCManager.removeForRespawn(npc.getUID());
    NPCManager.register(npc.getUID(),npc.getOwner());
  }
  player.sendMessage(StringUtils.wrap(npc.getName()) + "String_Node_Str" + StringUtils.wrap(MessageUtils.getMaterialName(mat.getId()))+ "String_Node_Str");
}

Fixed version (ground truth):
@Command(aliases="String_Node_Str",usage="String_Node_Str",desc="String_Node_Str",modifiers="String_Node_Str",min=3,max=3) @CommandPermissions("String_Node_Str") public static void setNPCArmor(CommandContext args,Player player,HumanNPC npc){
  Material mat=StringUtils.parseMaterial(args.getString(2));
  if (mat == null) {
    player.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  if (mat != Material.AIR && !player.getInventory().contains(mat)) {
    player.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  if ((mat.getId() < 298 || mat.getId() > 317) && (mat.getId() != 86 && mat.getId() != 91)) {
    player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    return;
  }
  int slot=player.getInventory().first(mat);
  ItemStack item=NPCDataManager.decreaseItemStack(player.getInventory().getItem(slot));
  player.getInventory().setItem(slot,item);
  ArrayList<Integer> items=npc.getNPCData().getItems();
  int oldhelmet=items.get(1);
  if (args.getString(1).contains("String_Node_Str")) {
    items.set(1,mat.getId());
  }
 else   if (args.getString(1).equalsIgnoreCase("String_Node_Str")) {
    items.set(2,mat.getId());
  }
 else   if (args.getString(1).contains("String_Node_Str")) {
    items.set(3,mat.getId());
  }
 else   if (args.getString(1).contains("String_Node_Str")) {
    items.set(4,mat.getId());
  }
  npc.getNPCData().setItems(items);
  NPCDataManager.addItems(npc,items);
  if ((oldhelmet != 0 && items.get(1) == 0)) {
    NPCManager.removeForRespawn(npc.getUID());
    NPCManager.register(npc.getUID(),npc.getOwner());
  }
  player.sendMessage(StringUtils.wrap(npc.getName()) + "String_Node_Str" + StringUtils.wrap(MessageUtils.getMaterialName(mat.getId()))+ "String_Node_Str");
}