nus-yam/ex-repair huggingface dataset:
Program: 1866
Project: 1866
Buggy source:
@Command(aliases="String_Node_Str",usage="String_Node_Str",desc="String_Node_Str",modifiers="String_Node_Str",min=1,max=2) @CommandPermissions("String_Node_Str") public static void levelUp(CommandContext args,Player player,HumanNPC npc){
  if (EconomyHandler.useEconomy()) {
    HealerNPC healer=npc.getToggleable("String_Node_Str");
    int level=healer.getLevel();
    int levelsUp=1;
    if (args.argsLength() == 2) {
      if (StringUtils.isNumber(args.getString(1))) {
        levelsUp=args.getInteger(1);
      }
    }
    double paid=EconomyHandler.pay(Operation.HEALER_LEVELUP,player,levelsUp);
    if (paid > 0) {
      if (level < 10) {
        int newLevel=level + levelsUp;
        healer.setLevel(newLevel);
        player.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.wrap(npc.getStrippedName())+ "String_Node_Str"+ StringUtils.wrap("String_Node_Str" + newLevel)+ "String_Node_Str"+ StringUtils.wrap(EconomyHandler.getPaymentType(Operation.HEALER_LEVELUP,"String_Node_Str" + paid * levelsUp) + "String_Node_Str"));
      }
 else {
        player.sendMessage(StringUtils.wrap(npc.getStrippedName()) + "String_Node_Str");
      }
    }
  }
 else {
    player.sendMessage(ChatColor.GRAY + "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=1,max=2) @CommandPermissions("String_Node_Str") public static void levelUp(CommandContext args,Player player,HumanNPC npc){
  if (EconomyHandler.useEconomy()) {
    HealerNPC healer=npc.getToggleable("String_Node_Str");
    int level=healer.getLevel();
    int levelsUp=1;
    if (args.argsLength() == 2 && StringUtils.isNumber(args.getString(1))) {
      levelsUp=args.getInteger(1);
    }
    if ((level + levelsUp) > 10) {
      levelsUp=(10 - level);
      player.sendMessage(ChatColor.GRAY + "String_Node_Str" + StringUtils.wrap(levelsUp)+ "String_Node_Str");
    }
    double paid=EconomyHandler.pay(Operation.HEALER_LEVELUP,player,levelsUp);
    if (paid > 0) {
      if (level < 10) {
        int newLevel=level + levelsUp;
        healer.setLevel(newLevel);
        player.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.wrap(npc.getStrippedName())+ "String_Node_Str"+ StringUtils.wrap("String_Node_Str" + newLevel)+ "String_Node_Str"+ StringUtils.wrap(EconomyHandler.getPaymentType(Operation.HEALER_LEVELUP,"String_Node_Str" + paid * levelsUp) + "String_Node_Str"));
      }
 else {
        player.sendMessage(StringUtils.wrap(npc.getStrippedName()) + "String_Node_Str");
      }
    }
  }
 else {
    player.sendMessage(ChatColor.GRAY + "String_Node_Str");
  }
}
Program: 1867
Project: 1867
Buggy source:
@Command(aliases="String_Node_Str",usage="String_Node_Str",desc="String_Node_Str",modifiers="String_Node_Str",min=1,max=1) @CommandPermissions("String_Node_Str") public static void displayStatus(CommandContext args,Player player,HumanNPC npc){
  player.sendMessage(ChatColor.AQUA + StringUtils.listify(ChatColor.GOLD + npc.getStrippedName() + "String_Node_Str"+ ChatColor.AQUA));
  WizardNPC wizard=npc.getToggleable("String_Node_Str");
  player.sendMessage(ChatColor.AQUA + "String_Node_Str" + ChatColor.GOLD+ wizard.getMode());
  player.sendMessage(ChatColor.AQUA + "String_Node_Str" + ChatColor.GOLD+ wizard.getMana());
}

Fixed version (ground truth):
@Command(aliases="String_Node_Str",usage="String_Node_Str",desc="String_Node_Str",modifiers="String_Node_Str",min=1,max=1) @CommandPermissions("String_Node_Str") public static void displayStatus(CommandContext args,Player player,HumanNPC npc){
  player.sendMessage(ChatColor.AQUA + StringUtils.listify(ChatColor.GREEN + npc.getStrippedName() + "String_Node_Str"+ ChatColor.AQUA));
  WizardNPC wizard=npc.getToggleable("String_Node_Str");
  player.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.wrap(wizard.getMode()));
  player.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.wrap(wizard.getMana()));
}
Program: 1869
Project: 1869
Buggy source:
/** 
 * Sets the in-hand item of an npc.
 * @param player
 * @param npc
 * @param material
 */
public static void setItemInHand(Player player,HumanNPC npc,String material){
  Material mat=StringUtils.parseMaterial(material);
  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 (npc.isType("String_Node_Str")) {
    player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    return;
  }
  int slot=player.getInventory().first(mat);
  ItemStack item=decreaseItemStack(player.getInventory().getItem(slot));
  player.getInventory().setItem(slot,item);
  ArrayList<Integer> items=npc.getNPCData().getItems();
  int olditem=items.get(0);
  items.set(0,mat.getId());
  npc.getNPCData().setItems(items);
  if (mat != null && mat != Material.AIR) {
    npc.getInventory().setItem(0,new ItemStack(mat,1));
  }
 else {
    npc.getInventory().setItem(0,null);
  }
  NPCDataManager.addItems(npc,items);
  if ((olditem != 0 && items.get(0) == 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):
/** 
 * Sets the in-hand item of an npc.
 * @param player
 * @param npc
 * @param material
 */
public static void setItemInHand(Player player,HumanNPC npc,String material){
  Material mat=StringUtils.parseMaterial(material);
  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 (npc.isType("String_Node_Str")) {
    player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    return;
  }
  int slot=player.getInventory().first(mat);
  ItemStack item=decreaseItemStack(player.getInventory().getItem(slot));
  player.getInventory().setItem(slot,item);
  ArrayList<Integer> items=npc.getNPCData().getItems();
  int olditem=items.get(0);
  items.set(0,mat.getId());
  npc.getNPCData().setItems(items);
  if (mat != null && mat != Material.AIR) {
    npc.getInventory().setItem(0,new ItemStack(mat,1));
  }
 else {
    npc.getInventory().setItem(0,null);
  }
  NPCDataManager.addItems(npc,items);
  if ((olditem != 0 && items.get(0) == 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");
}
Program: 1870
Project: 1870
Buggy source:
public static boolean validType(String type){
  return getTypes().get(type) != null;
}

Fixed version (ground truth):
public static boolean validType(String type){
  return types.get(type) != null;
}
Program: 1871
Project: 1871
Buggy source:
public static NPCType getType(String type){
  return getTypes().get(type);
}

Fixed version (ground truth):
public static NPCType getType(String type){
  return types.get(type);
}
Program: 1872
Project: 1872
Buggy source:
public static NPCFactory getFactory(String string){
  return getTypes().get(string).factory();
}

Fixed version (ground truth):
public static NPCFactory getFactory(String string){
  return types.get(string).factory();
}
Program: 1873
Project: 1873
Buggy source:
@Override public void saveState(HumanNPC npc){
  if (exists(npc)) {
    boolean is=npc.isType("String_Node_Str");
    setEnabled(npc,is);
    if (is) {
      WizardNPC wizard=npc.getToggleable("String_Node_Str");
      saveLocations(npc.getUID(),wizard.getLocations());
      saveMana(npc.getUID(),wizard.getMana());
      saveMode(npc.getUID(),wizard.getMode());
      saveTime(npc.getUID(),wizard.getTime());
      saveMob(npc.getUID(),wizard.getMob());
    }
  }
}

Fixed version (ground truth):
@Override public void saveState(HumanNPC npc){
  Messaging.log("String_Node_Str");
  if (exists(npc)) {
    Messaging.log("String_Node_Str");
    boolean is=npc.isType("String_Node_Str");
    setEnabled(npc,is);
    if (is) {
      Messaging.log("String_Node_Str");
      WizardNPC wizard=npc.getToggleable("String_Node_Str");
      saveLocations(npc.getUID(),wizard.getLocations());
      saveMana(npc.getUID(),wizard.getMana());
      saveMode(npc.getUID(),wizard.getMode());
      saveTime(npc.getUID(),wizard.getTime());
      saveMob(npc.getUID(),wizard.getMob());
    }
  }
}
Program: 1874
Project: 1874
Buggy source:
@Override public void setEnabled(HumanNPC npc,boolean value){
  profiles.setBoolean(npc.getUID(),value);
}

Fixed version (ground truth):
@Override public void setEnabled(HumanNPC npc,boolean value){
  profiles.setBoolean(npc.getUID() + isWizard,value);
}
Program: 1875
Project: 1875
Buggy source:
private boolean chunkLoaded(){
  return this.bukkitEntity.getWorld().isChunkLoaded(this.bukkitEntity.getLocation().getBlock().getChunk());
}

Fixed version (ground truth):
private boolean chunkLoaded(){
  return this.bukkitEntity.getWorld().isChunkLoaded(this.npc.getChunkX(),this.npc.getChunkZ());
}
Program: 1876
Project: 1876
Buggy source:
public int getChunkZ(){
  return this.getLocation().getBlockZ() << 4;
}

Fixed version (ground truth):
public int getChunkZ(){
  return this.getLocation().getBlockZ() >> 4;
}
Program: 1877
Project: 1877
Buggy source:
public int getChunkX(){
  return this.getLocation().getBlockX() << 4;
}

Fixed version (ground truth):
public int getChunkX(){
  return this.getLocation().getBlockX() >> 4;
}
Program: 1878
Project: 1878
Buggy source:
@Override public HumanNPC spawn(CreatureNPCType type,Location loc){
  int offsetX=0, offsetZ=0, offset=25;
  offsetX+=offset * getRandomInt(random,2);
  offsetZ+=offset * getRandomInt(random,2);
  int startX=loc.getBlockX() + offsetX;
  int startZ=loc.getBlockZ() + offsetZ;
  int searchY=3, searchXZ=4;
  World world=loc.getWorld();
  for (int y=loc.getBlockY() + searchY; y >= loc.getBlockY() - searchY; --y) {
    for (int x=startX - searchXZ; x <= startX + searchXZ; ++x) {
      for (int z=startZ - searchXZ; z <= startZ + searchXZ; ++z) {
        if (type.spawnOn().isValid(world.getBlockTypeIdAt(x,y - 1,z)) & type.spawnIn().isValid(world.getBlockTypeIdAt(x,y,z)) && type.spawnIn().isValid(world.getBlockTypeIdAt(x,y + 1,z))) {
          if (world.isChunkLoaded(world.getChunkAt(x,z))) {
            if (areEntitiesOnBlock(world.getChunkAt(x,z),x,y,z)) {
              if (canSpawn(type)) {
                HumanNPC npc=NPCSpawner.spawnNPC(0,UtilityProperties.getRandomName(type),loc.getWorld(),x,y,z,random.nextInt(360),0,type);
                NPCCreatureSpawnEvent spawnEvent=new NPCCreatureSpawnEvent(npc,loc);
                Bukkit.getServer().getPluginManager().callEvent(spawnEvent);
                if (spawnEvent.isCancelled()) {
                  return null;
                }
                return npc;
              }
            }
          }
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public HumanNPC spawn(CreatureNPCType type,Location loc){
  int offsetX=0, offsetZ=0, offset=25;
  offsetX+=offset * getRandomInt(random,2);
  offsetZ+=offset * getRandomInt(random,2);
  int startX=loc.getBlockX() + offsetX;
  int startZ=loc.getBlockZ() + offsetZ;
  int searchY=3, searchXZ=4;
  World world=loc.getWorld();
  Chunk last=null;
  for (int y=loc.getBlockY() + searchY; y >= loc.getBlockY() - searchY; --y) {
    for (int x=startX - searchXZ; x <= startX + searchXZ; ++x) {
      for (int z=startZ - searchXZ; z <= startZ + searchXZ; ++z) {
        if (world.isChunkLoaded(x >> 4,z >> 4)) {
          if (world.getChunkAt(x >> 4,z >> 4) != last)           last=world.getChunkAt(x >> 4,z >> 4);
          if (type.spawnOn().isValid(world.getBlockTypeIdAt(x,y - 1,z)) & type.spawnIn().isValid(world.getBlockTypeIdAt(x,y,z)) && type.spawnIn().isValid(world.getBlockTypeIdAt(x,y + 1,z))) {
            if (areEntitiesOnBlock(last,x,y,z)) {
              if (canSpawn(type)) {
                HumanNPC npc=NPCSpawner.spawnNPC(0,UtilityProperties.getRandomName(type),loc.getWorld(),x,y,z,random.nextInt(360),0,type);
                NPCCreatureSpawnEvent spawnEvent=new NPCCreatureSpawnEvent(npc,loc);
                Bukkit.getServer().getPluginManager().callEvent(spawnEvent);
                if (spawnEvent.isCancelled()) {
                  return null;
                }
                return npc;
              }
            }
          }
        }
      }
    }
  }
  return null;
}
Program: 1879
Project: 1879
Buggy source:
/** 
 * Register our commands
 * @return
 */
public static void registerCommands(){
  Citizens.commands.register(BasicCommands.class);
  Citizens.commands.register(BlacksmithCommands.class);
  Citizens.commands.register(HealerCommands.class);
  Citizens.commands.register(ToggleCommands.class);
  Citizens.commands.register(TraderCommands.class);
  Citizens.commands.register(WizardCommands.class);
}

Fixed version (ground truth):
/** 
 * Register our commands
 * @return
 */
public static void registerCommands(){
  Citizens.commands.register(BasicCommands.class);
  Citizens.commands.register(BlacksmithCommands.class);
  Citizens.commands.register(GuardCommands.class);
  Citizens.commands.register(HealerCommands.class);
  Citizens.commands.register(ToggleCommands.class);
  Citizens.commands.register(TraderCommands.class);
  Citizens.commands.register(WizardCommands.class);
}
Program: 1881
Project: 1881
Buggy source:
@Override public void onChunkLoad(ChunkLoadEvent event){
  for (  NPCLocation tempLoc : toRespawn.keySet()) {
    if (tempLoc.getChunkX() == event.getChunk().getX() && tempLoc.getChunkZ() == event.getChunk().getZ()) {
      NPCManager.register(tempLoc.getUID(),tempLoc.getOwner());
      toRespawn.remove(tempLoc);
    }
  }
}

Fixed version (ground truth):
@Override public void onChunkLoad(ChunkLoadEvent event){
  for (  NPCLocation tempLoc : toRespawn.keySet()) {
    if (tempLoc.getChunkX() == event.getChunk().getX() && tempLoc.getChunkZ() == event.getChunk().getZ()) {
      if (NPCManager.get(tempLoc.getUID()) != null)       NPCManager.register(tempLoc.getUID(),tempLoc.getOwner());
      toRespawn.remove(tempLoc);
    }
  }
}
Program: 1882
Project: 1882
Buggy source:
/** 
 * Rotates an npc.
 * @param npc
 * @param player
 */
public static void facePlayer(HumanNPC npc,Player player){
  Location loc=npc.getLocation();
  double xDiff=player.getLocation().getX() - loc.getX();
  double yDiff=player.getLocation().getY() - loc.getY();
  double zDiff=player.getLocation().getZ() - loc.getZ();
  double DistanceXZ=Math.sqrt(xDiff * xDiff + zDiff * zDiff);
  double DistanceY=Math.sqrt(DistanceXZ * DistanceXZ + yDiff * yDiff);
  double yaw=(Math.acos(xDiff / DistanceXZ) * 180 / Math.PI);
  double pitch=(Math.acos(yDiff / DistanceY) * 180 / Math.PI) - 90;
  if (zDiff < 0.0) {
    yaw=yaw + (Math.abs(180 - yaw) * 2);
  }
  npc.teleport(loc.getX(),loc.getY(),loc.getZ(),(float)yaw - 90,(float)pitch);
  if (npc.getOwner().equals(player.getName())) {
    loc=npc.getNPCData().getLocation();
    loc.setPitch(npc.getLocation().getPitch());
    loc.setYaw(npc.getLocation().getYaw());
    npc.getNPCData().setLocation(loc);
  }
}

Fixed version (ground truth):
/** 
 * Rotates an npc.
 * @param npc
 * @param player
 */
public static void facePlayer(HumanNPC npc,Player player){
  Location loc=npc.getLocation(), pl=player.getLocation();
  double xDiff=pl.getX() - loc.getX();
  double yDiff=pl.getY() - loc.getY();
  double zDiff=pl.getZ() - loc.getZ();
  double DistanceXZ=Math.sqrt(xDiff * xDiff + zDiff * zDiff);
  double DistanceY=Math.sqrt(DistanceXZ * DistanceXZ + yDiff * yDiff);
  double yaw=(Math.acos(xDiff / DistanceXZ) * 180 / Math.PI);
  double pitch=(Math.acos(yDiff / DistanceY) * 180 / Math.PI) - 90;
  if (zDiff < 0.0) {
    yaw=yaw + (Math.abs(180 - yaw) * 2);
  }
  npc.teleport(loc.getX(),loc.getY(),loc.getZ(),(float)yaw - 90,(float)pitch);
  if (npc.getOwner().equals(player.getName())) {
    loc=npc.getNPCData().getLocation();
    loc.setPitch(npc.getLocation().getPitch());
    loc.setYaw(npc.getLocation().getYaw());
    npc.getNPCData().setLocation(loc);
  }
}
Program: 1883
Project: 1883
Buggy source:
/** 
 * Removes an npc.
 * @param UID
 */
public static void remove(int UID){
  PropertyManager.remove(get(UID));
  GlobalUIDs.remove(UID);
  NPCSpawner.despawnNPC(list.get(UID));
  list.remove(UID);
}

Fixed version (ground truth):
/** 
 * Removes an npc.
 * @param UID
 */
public static void remove(int UID){
  PropertyManager.remove(get(UID));
  NPCSpawner.despawnNPC(list.get(UID));
  GlobalUIDs.remove(UID);
  list.remove(UID);
}
Program: 1884
Project: 1884
Buggy source:
@Override public void save(){
  config.getAll().clear();
  for (  Entry<String,String> entry : tree.getTree().entrySet()) {
    if (entry.getValue() != null && !entry.getValue().isEmpty() && !StringUtils.isNumber(entry.getKey())) {
      this.config.setProperty(entry.getKey(),entry.getValue());
    }
  }
  this.config.save();
}

Fixed version (ground truth):
@Override public void save(){
  clear();
  for (  Entry<String,String> entry : tree.getTree().entrySet()) {
    if (entry.getValue() != null && !entry.getValue().isEmpty() && !StringUtils.isNumber(entry.getKey())) {
      this.config.setProperty(entry.getKey(),entry.getValue());
    }
  }
  this.config.save();
  clear();
}
Program: 1885
Project: 1885
Buggy source:
@Override public void load(){
  config.load();
  for (  Entry<String,Object> entry : this.config.getAll().entrySet()) {
    tree.set(entry.getKey(),entry.getValue().toString());
  }
}

Fixed version (ground truth):
@Override public void load(){
  clear();
  config.load();
  for (  Entry<String,Object> entry : this.config.getAll().entrySet()) {
    tree.set(entry.getKey(),entry.getValue().toString());
  }
  clear();
}
Program: 1886
Project: 1886
Buggy source:
public void remove(String path){
  for (  String key : tree.keySet()) {
    if (key.startsWith(path))     tree.remove(key);
  }
}

Fixed version (ground truth):
public void remove(String path){
  for (  String key : tree.keySet()) {
    if (key.startsWith(path)) {
      tree.remove(key);
    }
  }
}
Program: 1887
Project: 1887
Buggy source:
public HumanNPC getNPC(Entity entity){
  if (entity == null) {
    return null;
  }
  for (  HumanNPC bnpc : this.values()) {
    if (bnpc == null || bnpc.getPlayer() == null) {
      if (bnpc == null) {
        Messaging.log("String_Node_Str");
      }
 else       if (bnpc.getPlayer() == null) {
        Messaging.log("String_Node_Str");
      }
      continue;
    }
    if (bnpc.getPlayer().getEntityId() == entity.getEntityId()) {
      return bnpc;
    }
  }
  return null;
}

Fixed version (ground truth):
public HumanNPC getNPC(Entity entity){
  if (entity == null) {
    return null;
  }
  if (((CraftEntity)entity).getHandle() instanceof CraftNPC) {
    return ((CraftNPC)(((CraftEntity)entity).getHandle())).npc;
  }
  return null;
}
Program: 1888
Project: 1888
Buggy source:
/** 
 * Gets the text to be said for a basic NPC
 * @param npc
 * @param player
 * @return
 */
public static String getText(HumanNPC npc,Player player){
  String name=StringUtils.stripColour(npc.getStrippedName());
  ArrayDeque<String> array=NPCManager.getText(npc.getUID());
  String text="String_Node_Str";
  if (array != null && array.size() > 0) {
    text=array.pop();
    array.addLast(text);
    NPCManager.setText(npc.getUID(),array);
  }
  if (text.isEmpty()) {
    text=getRandomMessage(Constants.defaultText);
  }
  if (!text.isEmpty()) {
    if (Constants.useNPCColours) {
      text=StringUtils.colourise(Constants.chatFormat.replace("String_Node_Str",npc.getName())) + text;
    }
 else {
      text=StringUtils.colourise(Constants.chatFormat.replace("String_Node_Str","String_Node_Str" + Constants.npcColour + name+ ChatColor.WHITE)) + text;
    }
    return text;
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Gets the text to be said for a basic NPC
 * @param npc
 * @param player
 * @return
 */
public static String getText(HumanNPC npc,Player player){
  String name=StringUtils.stripColour(npc.getStrippedName());
  ArrayDeque<String> array=NPCManager.getText(npc.getUID());
  String text="String_Node_Str";
  if (array != null && array.size() > 0) {
    text=array.pop();
    array.addLast(text);
    NPCManager.setText(npc.getUID(),array);
  }
  if (text.isEmpty()) {
    text=getRandomMessage(Constants.defaultText);
  }
  if (!text.isEmpty()) {
    if (Constants.useNPCColours) {
      text=StringUtils.colourise(Constants.chatFormat.replace("String_Node_Str",npc.getStrippedName())) + text;
    }
 else {
      text=StringUtils.colourise(Constants.chatFormat.replace("String_Node_Str","String_Node_Str" + Constants.npcColour + name+ ChatColor.WHITE)) + text;
    }
    return text;
  }
  return "String_Node_Str";
}
Program: 1889
Project: 1889
Buggy source:
public static String pluralise(String string,int size){
  return size > 1 ? string + "String_Node_Str" : string;
}

Fixed version (ground truth):
public static String pluralise(String string,int size){
  return size > 1 ? string + (string.endsWith("String_Node_Str") ? "String_Node_Str" : "String_Node_Str") : string;
}
Program: 1891
Project: 1891
Buggy source:
public NPCManager(Citizens plugin){
  this.plugin=plugin;
  list=new NPCList();
}

Fixed version (ground truth):
public NPCManager(Citizens plugin){
  this.plugin=plugin;
}
Program: 1892
Project: 1892
Buggy source:
public boolean setMethod(Plugin method){
  if (hasMethod())   return true;
  if (self) {
    self=false;
    return false;
  }
  int count=0;
  boolean match=false;
  Plugin plugin=null;
  PluginManager manager=method.getServer().getPluginManager();
  for (  String name : this.getDependencies()) {
    if (hasMethod())     break;
    if (method.getDescription().getName().equals(name))     plugin=method;
 else     plugin=manager.getPlugin(name);
    if (plugin == null)     continue;
    if (!plugin.isEnabled()) {
      this.self=true;
      manager.enablePlugin(plugin);
    }
    if (plugin == null)     continue;
    Method current=this.createMethod(plugin);
    if (current == null)     continue;
    if (this.preferred.isEmpty())     this.Method=current;
 else {
      this.Attachables.add(current);
    }
  }
  if (!this.preferred.isEmpty()) {
    do {
      if (hasMethod()) {
        match=true;
      }
 else {
        for (        Method attached : this.Attachables) {
          if (attached == null)           continue;
          if (hasMethod()) {
            match=true;
            break;
          }
          if (this.preferred.isEmpty())           this.Method=attached;
          if (count == 0) {
            if (this.preferred.equalsIgnoreCase(attached.getName()))             this.Method=attached;
          }
 else {
            this.Method=attached;
          }
        }
        count++;
      }
    }
 while (!match);
  }
  return hasMethod();
}

Fixed version (ground truth):
public boolean setMethod(Plugin method){
  if (hasMethod())   return true;
  if (self) {
    self=false;
    return false;
  }
  int count=0;
  boolean match=false;
  Plugin plugin=null;
  PluginManager manager=method.getServer().getPluginManager();
  for (  String name : this.getDependencies()) {
    if (hasMethod())     break;
    if (method.getDescription().getName().equals(name))     plugin=method;
 else     plugin=manager.getPlugin(name);
    if (plugin == null)     continue;
    if (!plugin.isEnabled()) {
      this.self=true;
      manager.enablePlugin(plugin);
    }
    Method current=this.createMethod(plugin);
    if (current == null)     continue;
    if (this.preferred.isEmpty())     this.Method=current;
 else {
      this.Attachables.add(current);
    }
  }
  if (!this.preferred.isEmpty()) {
    do {
      if (hasMethod()) {
        match=true;
      }
 else {
        for (        Method attached : this.Attachables) {
          if (attached == null)           continue;
          if (hasMethod()) {
            match=true;
            break;
          }
          if (this.preferred.isEmpty())           this.Method=attached;
          if (count == 0) {
            if (this.preferred.equalsIgnoreCase(attached.getName()))             this.Method=attached;
          }
 else {
            this.Method=attached;
          }
        }
        count++;
      }
    }
 while (!match);
  }
  return hasMethod();
}
Program: 1893
Project: 1893
Buggy source:
/** 
 * Moves the selected NPC to the current location of a player.
 * @param player
 * @param npc
 * @param name
 */
private void move(Player player,HumanNPC npc){
}

Fixed version (ground truth):
/** 
 * Moves the selected NPC to the current location of a player.
 * @param player
 * @param npc
 * @param name
 */
private void move(Player player,HumanNPC npc){
  if (npc != null) {
    player.sendMessage(StringUtils.wrap(npc.getStrippedName()) + "String_Node_Str");
    npc.teleport(player.getLocation());
    npc.getNPCData().setLocation(player.getLocation());
  }
 else {
    player.sendMessage(MessageUtils.mustHaveNPCSelectedMessage);
  }
}
Program: 1894
Project: 1894
Buggy source:
@Override public void onEnable(){
  plugin=this;
  new CommandHandler().registerCommands();
  entityListener.registerEvents();
  customListener.registerEvents();
  worldListener.registerEvents();
  serverListener.registerEvents();
  playerListener.registerEvents();
  PropertyManager.registerProperties();
  Permission.initialize(Bukkit.getServer());
  Constants.setupVariables();
  getServer().getScheduler().scheduleSyncRepeatingTask(this,new CreatureTask(),Constants.spawnTaskDelay,Constants.spawnTaskDelay);
  getServer().getScheduler().scheduleSyncRepeatingTask(this,new CreatureTask.CreatureTick(),0,1);
  if (getServer().getScheduler().scheduleSyncDelayedTask(this,new Runnable(){
    @Override public void run(){
      setupNPCs();
    }
  }
) == -1) {
    Messaging.log("String_Node_Str");
    setupNPCs();
  }
  getServer().getScheduler().scheduleSyncRepeatingTask(this,new TickTask(Constants.npcRange),Constants.tickDelay,Constants.tickDelay);
  getServer().getScheduler().scheduleSyncRepeatingTask(this,new GuardTask(),Constants.tickDelay,Constants.tickDelay);
  if (Constants.useSaveTask) {
    getServer().getScheduler().scheduleSyncRepeatingTask(this,new Runnable(){
      @Override public void run(){
        Messaging.log("String_Node_Str");
        PropertyManager.stateSave();
        Messaging.log("String_Node_Str");
      }
    }
,Constants.saveDelay,Constants.saveDelay);
  }
  QuestManager.initialise();
  Messaging.log("String_Node_Str" + getVersion() + "String_Node_Str"+ codename+ "String_Node_Str");
}

Fixed version (ground truth):
@Override public void onEnable(){
  plugin=this;
  CommandHandler.registerCommands();
  entityListener.registerEvents();
  customListener.registerEvents();
  worldListener.registerEvents();
  serverListener.registerEvents();
  playerListener.registerEvents();
  PropertyManager.registerProperties();
  Permission.initialize(Bukkit.getServer());
  Constants.setupVariables();
  getServer().getScheduler().scheduleSyncRepeatingTask(this,new CreatureTask(),Constants.spawnTaskDelay,Constants.spawnTaskDelay);
  getServer().getScheduler().scheduleSyncRepeatingTask(this,new CreatureTask.CreatureTick(),0,1);
  if (getServer().getScheduler().scheduleSyncDelayedTask(this,new Runnable(){
    @Override public void run(){
      setupNPCs();
    }
  }
) == -1) {
    Messaging.log("String_Node_Str");
    setupNPCs();
  }
  getServer().getScheduler().scheduleSyncRepeatingTask(this,new TickTask(Constants.npcRange),Constants.tickDelay,Constants.tickDelay);
  getServer().getScheduler().scheduleSyncRepeatingTask(this,new GuardTask(),Constants.tickDelay,Constants.tickDelay);
  if (Constants.useSaveTask) {
    getServer().getScheduler().scheduleSyncRepeatingTask(this,new Runnable(){
      @Override public void run(){
        Messaging.log("String_Node_Str");
        PropertyManager.stateSave();
        Messaging.log("String_Node_Str");
      }
    }
,Constants.saveDelay,Constants.saveDelay);
  }
  QuestManager.initialize();
  Messaging.log("String_Node_Str" + getVersion() + "String_Node_Str"+ codename+ "String_Node_Str");
}
Program: 1895
Project: 1895
Buggy source:
/** 
 * Register our commands
 * @return
 */
public void registerCommands(){
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new BasicExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new BasicExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new BasicExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new HealerExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new TraderExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new WizardExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new BlacksmithExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new QuesterExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new GuardExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new TogglerExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new QuestsExecutor());
}

Fixed version (ground truth):
/** 
 * Register our commands
 * @return
 */
public static void registerCommands(){
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new BasicExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new BasicExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new BasicExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new HealerExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new TraderExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new WizardExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new BlacksmithExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new QuesterExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new GuardExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new TogglerExecutor());
  Citizens.plugin.getCommand("String_Node_Str").setExecutor(new QuestsExecutor());
}
Program: 1896
Project: 1896
Buggy source:
public void setProgress(QuestProgress progress){
  this.progress=progress;
  if (this.profile.pathExists("String_Node_Str"))   this.profile.removeKey("String_Node_Str");
}

Fixed version (ground truth):
public void setProgress(QuestProgress progress){
  this.progress=progress;
  if (this.profile.pathExists("String_Node_Str")) {
    this.profile.removeKey("String_Node_Str");
  }
}
Program: 1906
Project: 1906
Buggy source:
private static HashMap<String,String> writeMobSettings(){
  HashMap<String,String> nodes=new HashMap<String,String>();
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  return nodes;
}

Fixed version (ground truth):
private static HashMap<String,String> writeMobSettings(){
  HashMap<String,String> nodes=new HashMap<String,String>();
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  nodes.put("String_Node_Str","String_Node_Str");
  return nodes;
}
Program: 1907
Project: 1907
Buggy source:
@Override public void onEntityDamage(EntityDamageEvent event){
  CreatureTask.onDamage(event.getEntity(),event);
  if (event instanceof EntityDamageByEntityEvent) {
    EntityDamageByEntityEvent e=(EntityDamageByEntityEvent)event;
    HumanNPC npc=NPCManager.get(e.getEntity());
    if (npc != null) {
      if (e.getEntity() instanceof Player) {
        e.setCancelled(true);
      }
      if (e.getDamager() instanceof Player) {
        Player player=(Player)e.getDamager();
        if (npc.isHealer()) {
          npc.getHealer().onLeftClick(player,npc);
        }
        if (npc.isWizard()) {
          npc.getWizard().onLeftClick(player,npc);
        }
      }
    }
 else     if (e.getDamager() instanceof Player) {
      if (((LivingEntity)e.getEntity()).getHealth() - e.getDamage() <= 0) {
        QuestManager.incrementQuest((Player)e.getDamager(),new EntityDeathEvent(e.getEntity(),null));
      }
      CreatureTask.onLeftClick(e);
    }
  }
}

Fixed version (ground truth):
@Override public void onEntityDamage(EntityDamageEvent event){
  CreatureTask.onDamage(event.getEntity(),event);
  if (event instanceof EntityDamageByEntityEvent) {
    EntityDamageByEntityEvent e=(EntityDamageByEntityEvent)event;
    HumanNPC npc=NPCManager.get(e.getEntity());
    if (npc != null) {
      if (e.getEntity() instanceof Player) {
        e.setCancelled(true);
      }
      if (e.getDamager() instanceof Player) {
        Player player=(Player)e.getDamager();
        if (npc.isHealer()) {
          npc.getHealer().onLeftClick(player,npc);
        }
        if (npc.isWizard()) {
          npc.getWizard().onLeftClick(player,npc);
        }
      }
    }
 else     if (e.getDamager() instanceof Player) {
      if (((LivingEntity)e.getEntity()).getHealth() - e.getDamage() <= 0) {
        QuestManager.incrementQuest((Player)e.getDamager(),new EntityDeathEvent(e.getEntity(),null));
      }
      CreatureTask.onDamage(e.getEntity(),event);
    }
  }
}
Program: 1908
Project: 1908
Buggy source:
@Override public void onPlayerChat(PlayerChatEvent event){
  String msg=event.getMessage();
  String name=event.getPlayer().getName();
  if (!ChatManager.hasEditMode(name)) {
    return;
  }
  if (ChatManager.isAnswer(name,msg)) {
    event.setCancelled(true);
  }
}

Fixed version (ground truth):
@Override public void onPlayerChat(PlayerChatEvent event){
  String name=event.getPlayer().getName();
  if (!ChatManager.hasEditMode(name)) {
    return;
  }
  String msg=event.getMessage();
  if (ChatManager.isValidAnswer(name,msg,ChatManager.getMaxOptions(ChatManager.currentQuestion))) {
    event.setCancelled(true);
  }
}
Program: 1909
Project: 1909
Buggy source:
private CreatureType getMob(int UID){
  if (CreatureType.fromName(mob.getString(UID)) != null) {
    return CreatureType.fromName(mob.getString(UID));
  }
  System.out.println("String_Node_Str");
  return CreatureType.CREEPER;
}

Fixed version (ground truth):
private CreatureType getMob(int UID){
  if (CreatureType.fromName(mob.getString(UID)) != null) {
    return CreatureType.fromName(mob.getString(UID));
  }
  return CreatureType.CREEPER;
}
Program: 1910
Project: 1910
Buggy source:
/** 
 * Checks whether two locations are within range of each other.
 * @param loc
 * @param pLoc
 * @param range
 * @return
 */
public static boolean checkLocation(Location loc,Location pLoc,double range){
  if (!loc.getWorld().getName().equals(pLoc.getWorld().getName())) {
    return false;
  }
  double pX=pLoc.getX(), pY=pLoc.getY(), pZ=pLoc.getZ();
  double lX=loc.getX(), lY=loc.getY(), lZ=loc.getZ();
  if ((pX <= lX + range && pX >= lX - range) && (pY >= lY - range && pY <= lY + range) && (pZ >= lZ - range && pZ <= lZ + range)) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks whether two locations are within range of each other.
 * @param loc
 * @param pLoc
 * @param range
 * @return
 */
public static boolean checkLocation(Location loc,Location pLoc,double range){
  if (!loc.getWorld().getName().equals(pLoc.getWorld().getName())) {
    return false;
  }
  double pX=pLoc.getX(), pY=pLoc.getY(), pZ=pLoc.getZ();
  double lX=loc.getX(), lY=loc.getY(), lZ=loc.getZ();
  if ((pX <= lX + range && pX >= lX - range) && (pY >= lY - range && pY <= lY + range) && (pZ >= lZ - range && pZ <= lZ + range)) {
    return true;
  }
  return false;
}
Program: 1911
Project: 1911
Buggy source:
@Override public void a(EntityLiving entityliving){
  System.out.println(entityliving);
  super.a(entityliving);
}

Fixed version (ground truth):
@Override public void a(EntityLiving entityliving){
  super.a(entityliving);
}
Program: 1912
Project: 1912
Buggy source:
/** 
 * Buy an armor repair
 * @param player
 * @param npc
 * @param armor
 * @param armorName
 * @param plural
 */
private void buyArmorRepair(Player player,HumanNPC npc,ItemStack armor,String armorName,boolean plural){
  String msg="String_Node_Str";
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(Operation.BLACKSMITH_ARMORREPAIR,player)) {
    if (EconomyHandler.useEconomy()) {
      if (npc.getBlacksmith().validateArmor(armor)) {
        if (armor.getDurability() > 0) {
          double paid=EconomyHandler.pay(Operation.BLACKSMITH_ARMORREPAIR,player);
          if (paid > 0) {
            armor.setDurability((short)0);
            msg=ChatColor.GREEN + ("String_Node_Str") + StringUtils.wrap(armorName);
            if (plural) {
              msg+="String_Node_Str";
            }
 else {
              msg+="String_Node_Str";
            }
            msg+=StringUtils.wrap(npc.getStrippedName()) + "String_Node_Str" + StringUtils.wrap(EconomyHandler.getPaymentType(Operation.BLACKSMITH_ARMORREPAIR,"String_Node_Str" + paid,ChatColor.YELLOW))+ "String_Node_Str";
            player.sendMessage(msg);
          }
        }
 else {
          player.sendMessage(ChatColor.RED + "String_Node_Str");
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else {
      player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(Operation.BLACKSMITH_ARMORREPAIR,player));
    return;
  }
}

Fixed version (ground truth):
/** 
 * Buy an armor repair
 * @param player
 * @param npc
 * @param armor
 * @param armorName
 * @param plural
 */
private void buyArmorRepair(Player player,HumanNPC npc,ItemStack armor,String armorName,boolean plural){
  String msg="String_Node_Str";
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(Operation.BLACKSMITH_ARMORREPAIR,player)) {
    if (EconomyHandler.useEconomy()) {
      if (npc.getBlacksmith().validateArmor(armor)) {
        if (armor.getDurability() > 0) {
          double paid=EconomyHandler.pay(Operation.BLACKSMITH_ARMORREPAIR,player);
          if (paid > 0) {
            armor.setDurability((short)0);
            msg=ChatColor.GREEN + ("String_Node_Str") + StringUtils.wrap(armorName);
            if (plural) {
              msg+="String_Node_Str";
            }
 else {
              msg+="String_Node_Str";
            }
            msg+=StringUtils.wrap(npc.getStrippedName()) + "String_Node_Str" + StringUtils.wrap(EconomyHandler.getPaymentType(Operation.BLACKSMITH_ARMORREPAIR,"String_Node_Str" + paid))+ "String_Node_Str";
            player.sendMessage(msg);
          }
        }
 else {
          player.sendMessage(ChatColor.RED + "String_Node_Str");
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else {
      player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(Operation.BLACKSMITH_ARMORREPAIR,player));
    return;
  }
}
Program: 1913
Project: 1913
Buggy source:
private String getLevelUpPaidMessage(Operation op,HumanNPC npc,double paid,int level,int multiple){
  String message=ChatColor.GREEN + "String_Node_Str" + StringUtils.wrap(npc.getStrippedName())+ "String_Node_Str"+ StringUtils.wrap("String_Node_Str" + level)+ "String_Node_Str"+ StringUtils.wrap(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid * multiple,ChatColor.GREEN) + "String_Node_Str");
  return message;
}

Fixed version (ground truth):
private String getLevelUpPaidMessage(Operation op,HumanNPC npc,double paid,int level,int multiple){
  String message=ChatColor.GREEN + "String_Node_Str" + StringUtils.wrap(npc.getStrippedName())+ "String_Node_Str"+ StringUtils.wrap("String_Node_Str" + level)+ "String_Node_Str"+ StringUtils.wrap(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid * multiple) + "String_Node_Str");
  return message;
}
Program: 1915
Project: 1915
Buggy source:
public static void despawn(CreatureNPC npc){
  removeFromMaps(npc);
}

Fixed version (ground truth):
public static void despawn(CreatureNPC npc){
  removeFromMaps(npc);
  NPCSpawner.removeBasicHumanNpc(npc.npc);
}
Program: 1916
Project: 1916
Buggy source:
/** 
 * Gets what item ID or iConomy currency is being used for an operation.
 * @param op
 * @param amount
 * @return
 */
public static String getPaymentType(Operation op,String amount,ChatColor colour){
  if (useEconomy) {
    if (useIconomy()) {
      return ServerEconomyInterface.format(amount);
    }
 else {
      return ItemInterface.getCurrency(op,colour);
    }
  }
 else {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
/** 
 * Gets what item ID or iConomy currency is being used for an operation.
 * @param op
 * @param amount
 * @return
 */
public static String getPaymentType(Operation op,String amount){
  if (useEconomy) {
    if (useIconomy()) {
      return ServerEconomyInterface.format(amount);
    }
 else {
      return ItemInterface.getCurrency(op);
    }
  }
 else {
    return "String_Node_Str";
  }
}
Program: 1918
Project: 1918
Buggy source:
/** 
 * Purchase an item repair
 * @param player
 * @param npc
 * @param op
 */
private void buyItemRepair(Player player,HumanNPC npc,ItemStack item,Operation op){
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(op,player)) {
    if (item.getDurability() > 0) {
      double paid=EconomyHandler.payBlacksmith(op,player);
      if (paid > 0) {
        item.setDurability((short)0);
        player.setItemInHand(item);
        String msg=StringUtils.wrap(npc.getStrippedName()) + "String_Node_Str";
        if (EconomyHandler.useIconomy()) {
          msg+=StringUtils.wrap(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid,ChatColor.YELLOW));
        }
 else {
          msg+=StringUtils.wrap(ItemInterface.getBlacksmithPrice(player,item,op) + "String_Node_Str" + ItemInterface.getCurrencyName(op));
        }
        msg+=ChatColor.GREEN + "String_Node_Str";
        player.sendMessage(msg);
      }
    }
 else {
      player.sendMessage(ChatColor.RED + "String_Node_Str");
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(op,player));
    return;
  }
}

Fixed version (ground truth):
/** 
 * Purchase an item repair
 * @param player
 * @param npc
 * @param op
 */
private void buyItemRepair(Player player,HumanNPC npc,ItemStack item,Operation op){
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(op,player)) {
    if (item.getDurability() > 0) {
      double paid=EconomyHandler.payBlacksmith(op,player);
      if (paid > 0) {
        item.setDurability((short)0);
        player.setItemInHand(item);
        String msg=StringUtils.wrap(npc.getStrippedName()) + "String_Node_Str";
        if (EconomyHandler.useIconomy()) {
          msg+=StringUtils.wrap(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid));
        }
 else {
          msg+=StringUtils.wrap(ItemInterface.getBlacksmithCurrency(player,op));
        }
        msg+=ChatColor.GREEN + "String_Node_Str";
        player.sendMessage(msg);
      }
    }
 else {
      player.sendMessage(ChatColor.RED + "String_Node_Str");
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(op,player));
    return;
  }
}
Program: 1919
Project: 1919
Buggy source:
@Override public void onRightClick(Player player,HumanNPC npc){
  if (player.getItemInHand().getTypeId() == Constants.evilNPCTameItem) {
    if (new Random().nextInt(100) <= Constants.evilNPCTameChance) {
      setTame(true);
      npc.setEvil(false);
      NPCManager.register(npc.getName(),player.getLocation(),player.getName());
      player.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.wrap(npc.getStrippedName())+ "String_Node_Str");
    }
 else {
      player.sendMessage(ChatColor.RED + "String_Node_Str" + npc.getStrippedName()+ "String_Node_Str"+ ChatColor.WHITE+ MessageUtils.getRandomMessage(Constants.failureToTameMessages));
    }
  }
}

Fixed version (ground truth):
@Override public void onRightClick(Player player,HumanNPC npc){
  if (player.getItemInHand().getTypeId() == Constants.evilNPCTameItem) {
    if (new Random().nextInt(100) <= Constants.evilNPCTameChance) {
      setTame(true);
      npc.setEvil(false);
      CreatureTask.despawn(CreatureTask.getCreature(npc.getHandle().getBukkitEntity()));
      int UID=NPCManager.register(npc.getName(),player.getLocation(),player.getName());
      PropertyManager.getBasic().saveNPCAmountPerPlayer(player.getName(),PropertyManager.getBasic().getNPCAmountPerPlayer(player.getName()) + 1);
      NPCManager.get(UID).getNPCData().setOwner(player.getName());
      player.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.wrap(npc.getStrippedName())+ "String_Node_Str");
    }
 else {
      player.sendMessage(ChatColor.RED + "String_Node_Str" + npc.getStrippedName()+ "String_Node_Str"+ ChatColor.WHITE+ MessageUtils.getRandomMessage(Constants.failureToTameMessages));
    }
  }
}
Program: 1920
Project: 1920
Buggy source:
/** 
 * Purchase a heal from a healer
 * @param player
 * @param npc
 * @param op
 */
private void buyHeal(Player player,HumanNPC npc,Operation op,boolean healPlayer){
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(op,player)) {
    double paid=EconomyHandler.pay(op,player);
    if (paid > 0) {
      int playerHealth=0;
      int healerHealth=0;
      String msg=StringUtils.wrap(npc.getStrippedName());
      if (healPlayer) {
        playerHealth=player.getHealth() + 1;
        healerHealth=npc.getHealer().getHealth() - 1;
        msg+="String_Node_Str" + StringUtils.wrap(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid,ChatColor.YELLOW)) + "String_Node_Str";
      }
 else {
        playerHealth=player.getHealth();
        healerHealth=npc.getHealer().getHealth() + 1;
        msg+="String_Node_Str" + StringUtils.wrap(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid,ChatColor.YELLOW)) + "String_Node_Str";
      }
      player.setHealth(playerHealth);
      npc.getHealer().setHealth(healerHealth);
      player.sendMessage(msg);
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(Operation.HEALER_HEAL,player));
    return;
  }
}

Fixed version (ground truth):
/** 
 * Purchase a heal from a healer
 * @param player
 * @param npc
 * @param op
 */
private void buyHeal(Player player,HumanNPC npc,Operation op,boolean healPlayer){
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(op,player)) {
    double paid=EconomyHandler.pay(op,player);
    if (paid > 0) {
      int playerHealth=0;
      int healerHealth=0;
      String msg=StringUtils.wrap(npc.getStrippedName());
      if (healPlayer) {
        playerHealth=player.getHealth() + 1;
        healerHealth=npc.getHealer().getHealth() - 1;
        msg+="String_Node_Str" + StringUtils.wrap(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid)) + "String_Node_Str";
      }
 else {
        playerHealth=player.getHealth();
        healerHealth=npc.getHealer().getHealth() + 1;
        msg+="String_Node_Str" + StringUtils.wrap(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid)) + "String_Node_Str";
      }
      player.setHealth(playerHealth);
      npc.getHealer().setHealth(healerHealth);
      player.sendMessage(msg);
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(Operation.HEALER_HEAL,player));
    return;
  }
}