nus-yam/ex-repair huggingface dataset:
Program: 1820
Project: 1820
Buggy source:
private void reset(){
  this.pathTicks=0;
  this.stationaryTicks=0;
  this.path=null;
  this.pathTickLimit=-1;
  this.stationaryTickLimit=-1;
  this.pathingRange=16;
}

Fixed version (ground truth):
private void reset(){
  this.path=null;
  this.pathTicks=this.stationaryTicks=0;
  this.pathTickLimit=this.stationaryTickLimit=-1;
  this.pathingRange=16;
}
Program: 1822
Project: 1822
Buggy source:
private Vec3D getPathVector(){
  Vec3D vec3d=path.a(this);
  double length=(this.length * 1.85F);
  while (vec3d != null && vec3d.d(this.locX,vec3d.b,this.locZ) < length * length) {
    this.path.a();
    if (this.path.b()) {
      vec3d=null;
      reset();
    }
 else {
      vec3d=this.path.a(this);
    }
  }
  return vec3d;
}

Fixed version (ground truth):
private Vec3D getPathVector(){
  Vec3D vec3d=path.a(this);
  double length=(this.length * 1.82F);
  while (vec3d != null && vec3d.d(this.locX,vec3d.b,this.locZ) < length * length) {
    this.path.a();
    if (this.path.b()) {
      vec3d=null;
      reset();
    }
 else {
      vec3d=this.path.a(this);
    }
  }
  return vec3d;
}
Program: 1823
Project: 1823
Buggy source:
private void updateTarget(){
  if (!this.hasAttacked && this.targetEntity != null) {
    this.path=this.world.findPath(this,this.targetEntity,pathingRange);
  }
  if (targetEntity != null) {
    if (this.targetEntity.dead) {
      resetTarget();
    }
    if (targetEntity != null && targetAggro) {
      double distanceToEntity=distance(this,this.targetEntity);
      if (this.e(this.targetEntity)) {
        if (isWithinAttackRange(this.targetEntity,distanceToEntity)) {
          this.attackEntity(this.targetEntity);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void updateTarget(){
  if (!this.hasAttacked && this.targetEntity != null) {
    this.path=this.world.findPath(this,this.targetEntity,pathingRange);
  }
  if (targetEntity != null) {
    if (this.targetEntity.dead) {
      resetTarget();
    }
    if (targetEntity != null && targetAggro) {
      if (this.e(this.targetEntity)) {
        if (isWithinAttackRange(this.targetEntity,this.bukkitEntity.getLocation().distance(this.targetEntity.getBukkitEntity().getLocation()))) {
          this.attackEntity(this.targetEntity);
        }
      }
    }
  }
}
Program: 1824
Project: 1824
Buggy source:
/** 
 * Get whether a guard NPC is a bouncer
 * @return
 */
public boolean isBouncer(){
  return guardType == GuardType.BOUNCER;
}

Fixed version (ground truth):
/** 
 * Set whether a guard NPC is a bodyguard
 * @param state
 */
public boolean isBouncer(){
  return guardType == GuardType.BOUNCER;
}
Program: 1826
Project: 1826
Buggy source:
/** 
 * Return a bouncer to its original position
 * @param guard
 * @param npc
 */
public static void returnToBase(Guard guard,HumanNPC npc){
  Location loc;
  if (guard.isBodyguard()) {
    Player owner=Bukkit.getServer().getPlayer(npc.getOwner());
    if (owner != null) {
      loc=owner.getLocation();
    }
 else {
      return;
    }
  }
 else {
    if (npc.getWaypoints().size() > 0) {
      loc=npc.getWaypoints().current().getLocation();
    }
 else {
      loc=npc.getNPCData().getLocation();
    }
  }
  PathUtils.createPath(npc,loc,-1,-1,SettingsManager.getDouble("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Return a bouncer to its original position
 * @param guard
 * @param npc
 */
public static void returnToBase(Guard guard,HumanNPC npc){
  Location loc;
  if (guard.isBodyguard()) {
    Player owner=Bukkit.getServer().getPlayer(npc.getOwner());
    if (owner != null) {
      loc=owner.getLocation();
    }
 else {
      return;
    }
  }
 else {
    if (npc.getWaypoints().size() > 0) {
      loc=npc.getWaypoints().current().getLocation();
    }
 else {
      loc=npc.getNPCData().getLocation();
    }
  }
  if (npc.getLocation().distance(loc) > SettingsManager.getDouble("String_Node_Str"))   npc.teleport(loc);
  PathUtils.createPath(npc,loc,-1,-1,SettingsManager.getDouble("String_Node_Str"));
}
Program: 1828
Project: 1828
Buggy source:
static boolean isTargetable(Map<String,FlagInfo> search,String key){
  if (search.containsKey("String_Node_Str")) {
    return !search.get("String_Node_Str").isSafe();
  }
  return search.containsKey(key) && !search.get(key).isSafe();
}

Fixed version (ground truth):
static boolean isTargetable(Map<String,FlagInfo> search,String key){
  if (!search.containsKey(key)) {
    key="String_Node_Str";
  }
  return search.containsKey(key) && !search.get(key).isSafe();
}
Program: 1829
Project: 1829
Buggy source:
List<LivingEntity> getPossible(Iterable<LivingEntity> toProcess){
  List<LivingEntity> processed=Lists.newArrayList();
  FlagInfo retrieved=null;
  for (  LivingEntity entity : toProcess) {
    if (CreatureTask.getCreature(entity) != null) {
      retrieved=getByType(MOBS).get(StringUtils.format(CreatureTask.getCreature(entity).getType(),false));
    }
 else     if (entity instanceof Player) {
      String name=((Player)entity).getName().toLowerCase();
      retrieved=getByType(PLAYERS).get(name) == null ? groupMap.get(name) : getByType(PLAYERS).get(name);
    }
 else {
      retrieved=getByType(MOBS).get(EntityUtils.getMonsterName(entity));
    }
    if (retrieved.priority() == lowestFound) {
      processed.add(entity);
    }
  }
  reset();
  return processed;
}

Fixed version (ground truth):
List<LivingEntity> getPossible(Iterable<LivingEntity> toProcess){
  List<LivingEntity> processed=Lists.newArrayList();
  FlagInfo retrieved=null;
  for (  LivingEntity entity : toProcess) {
    if (CreatureTask.getCreature(entity) != null) {
      retrieved=get(getByType(MOBS),StringUtils.format(CreatureTask.getCreature(entity).getType(),false));
    }
 else     if (entity instanceof Player) {
      String name=((Player)entity).getName().toLowerCase();
      retrieved=get(getByType(PLAYERS),name) == null ? groupMap.get(name) : get(getByType(PLAYERS),name);
    }
 else {
      retrieved=get(getByType(MOBS),EntityUtils.getMonsterName(entity));
    }
    if (retrieved.priority() == lowestFound) {
      processed.add(entity);
    }
  }
  reset();
  return processed;
}
Program: 1830
Project: 1830
Buggy source:
private FlagInfo get(Map<String,FlagInfo> source,String name){
  if (!source.containsKey(name))   return source.get("String_Node_Str");
  return source.get(name);
}

Fixed version (ground truth):
private FlagInfo get(Map<String,FlagInfo> source,String name){
  if (!source.containsKey(name))   name="String_Node_Str";
  return source.get(name);
}
Program: 1831
Project: 1831
Buggy source:
/** 
 * Toggles an NPC state.
 * @param player
 * @param register
 * @param toggleable
 */
private static void toggleState(Player player,HumanNPC npc,CitizensNPC type,boolean register){
  if (register) {
    PropertyManager.get(type.getType());
  }
  if (!npc.isType(type.getType())) {
    npc.addType(type.getType());
    player.sendMessage(StringUtils.wrap(npc.getStrippedName()) + "String_Node_Str" + type.getType()+ "String_Node_Str");
  }
 else {
    npc.removeType(type.getType());
    player.sendMessage(StringUtils.wrap(npc.getStrippedName()) + "String_Node_Str" + type.getType()+ "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Toggles an NPC state.
 * @param player
 * @param npc
 * @param type
 * @param register
 */
private static void toggleState(Player player,HumanNPC npc,CitizensNPC type){
  if (!npc.isType(type.getType())) {
    PropertyManager.get(type.getType()).setEnabled(npc,true);
    npc.addType(type.getType());
    player.sendMessage(StringUtils.wrap(npc.getStrippedName()) + "String_Node_Str" + type.getType()+ "String_Node_Str");
  }
 else {
    PropertyManager.get(type.getType()).setEnabled(npc,false);
    npc.removeType(type.getType());
    player.sendMessage(StringUtils.wrap(npc.getStrippedName()) + "String_Node_Str" + type.getType()+ "String_Node_Str");
  }
}
Program: 1832
Project: 1832
Buggy source:
/** 
 * Buys an NPC state.
 * @param player
 * @param toggleable
 */
private static void buyState(Player player,HumanNPC npc,CitizensNPC type){
  String toggle=type.getType();
  if (!Permission.generic(player,"String_Node_Str" + toggle)) {
    Messaging.send(player,npc,MessageUtils.noPermissionsMessage);
    return;
  }
  if (EconomyManager.hasEnough(player,UtilityProperties.getPrice(toggle + "String_Node_Str"))) {
    double paid=EconomyManager.pay(player,UtilityProperties.getPrice(toggle + "String_Node_Str"));
    if (paid > 0) {
      Messaging.send(player,MessageUtils.getPaidMessage(player,toggle,toggle + "String_Node_Str",npc.getStrippedName(),true));
    }
    toggleState(player,npc,type,true);
  }
 else {
    Messaging.send(player,npc,MessageUtils.getNoMoneyMessage(player,toggle + "String_Node_Str"));
  }
}

Fixed version (ground truth):
/** 
 * Buys an NPC state.
 * @param player
 * @param npc
 * @param type
 */
private static void buyState(Player player,HumanNPC npc,CitizensNPC type){
  String toggle=type.getType();
  if (!Permission.generic(player,"String_Node_Str" + toggle)) {
    Messaging.send(player,npc,MessageUtils.noPermissionsMessage);
    return;
  }
  if (EconomyManager.hasEnough(player,UtilityProperties.getPrice(toggle + "String_Node_Str"))) {
    double paid=EconomyManager.pay(player,UtilityProperties.getPrice(toggle + "String_Node_Str"));
    if (paid > 0) {
      Messaging.send(player,MessageUtils.getPaidMessage(player,toggle,toggle + "String_Node_Str",npc.getStrippedName(),true));
    }
    toggleState(player,npc,type);
  }
 else {
    Messaging.send(player,npc,MessageUtils.getNoMoneyMessage(player,toggle + "String_Node_Str"));
  }
}
Program: 1833
Project: 1833
Buggy source:
/** 
 * Toggles all types of NPCs
 * @param player
 * @param npc
 * @param on
 */
private static void toggleAll(Player player,HumanNPC npc,boolean on){
  if (on) {
    for (    CitizensNPC type : npc.types()) {
      if (!npc.isType(type.getType())) {
        toggleState(player,npc,type,false);
      }
    }
  }
 else {
    for (    CitizensNPC type : npc.types()) {
      toggleState(player,npc,type,false);
    }
  }
}

Fixed version (ground truth):
/** 
 * Toggles all types of NPCs
 * @param player
 * @param npc
 * @param on
 */
private static void toggleAll(Player player,HumanNPC npc,boolean on){
  if (on) {
    for (    Entry<String,CitizensNPC> entry : CitizensNPCManager.getTypes().entrySet()) {
      if (!npc.isType(entry.getValue().getType())) {
        toggleState(player,npc,entry.getValue());
      }
    }
  }
 else {
    for (    Entry<String,CitizensNPC> entry : CitizensNPCManager.getTypes().entrySet()) {
      toggleState(player,npc,entry.getValue());
    }
  }
}
Program: 1834
Project: 1834
Buggy source:
@CommandRequirements(requireSelected=true,requireOwnership=true) @Command(aliases={"String_Node_Str","String_Node_Str","String_Node_Str"},usage="String_Node_Str",desc="String_Node_Str",modifiers="String_Node_Str",min=1,max=1) public static void toggle(CommandContext args,Player player,HumanNPC npc){
  String type=args.getString(0).toLowerCase();
  if (!CitizensNPCManager.validType(type)) {
    Messaging.sendError(player,"String_Node_Str");
    return;
  }
  if (!PropertyManager.npcHasType(npc,type)) {
    buyState(player,npc,CitizensNPCManager.getType(type));
  }
 else {
    toggleState(player,npc,CitizensNPCManager.getType(type),false);
  }
}

Fixed version (ground truth):
@CommandRequirements(requireSelected=true,requireOwnership=true) @Command(aliases={"String_Node_Str","String_Node_Str","String_Node_Str"},usage="String_Node_Str",desc="String_Node_Str",modifiers="String_Node_Str",min=1,max=1) public static void toggle(CommandContext args,Player player,HumanNPC npc){
  String type=args.getString(0).toLowerCase();
  if (!CitizensNPCManager.validType(type)) {
    Messaging.sendError(player,"String_Node_Str");
    return;
  }
  if (!PropertyManager.npcHasType(npc,type)) {
    buyState(player,npc,CitizensNPCManager.getType(type));
  }
 else {
    toggleState(player,npc,CitizensNPCManager.getType(type));
  }
}
Program: 1835
Project: 1835
Buggy source:
public static CitizensNPC registerType(CitizensNPC type,boolean autosave){
  if (autosave) {
    PropertyManager.add(type.getType(),type.getProperties());
  }
  return registerType(type);
}

Fixed version (ground truth):
public static CitizensNPC registerType(CitizensNPC type){
  types.put(type.getType(),type);
  PropertyManager.add(type.getType(),type.getProperties());
  Citizens.commands.register(type.getCommands().getClass());
  return type;
}
Program: 1836
Project: 1836
Buggy source:
/** 
 * Sets the next location in the list as active.
 * @return
 */
public void cycle(HumanNPC npc,WizardMode mode){
  Wizard wizard=npc.getType("String_Node_Str");
switch (mode) {
case TELEPORT:
    currentLocation++;
  if (currentLocation >= numberOfLocations) {
    currentLocation=0;
  }
break;
case SPAWN_MOB:
CreatureType type=wizard.getMob();
CreatureType newType=null;
switch (type) {
case PIG:
newType=CreatureType.WOLF;
break;
case WOLF:
newType=CreatureType.COW;
break;
case COW:
newType=CreatureType.CHICKEN;
break;
case CHICKEN:
newType=CreatureType.SHEEP;
break;
case SHEEP:
newType=CreatureType.SQUID;
break;
case SQUID:
newType=CreatureType.PIG_ZOMBIE;
break;
case PIG_ZOMBIE:
newType=CreatureType.GHAST;
break;
case GHAST:
newType=CreatureType.GIANT;
break;
case GIANT:
newType=CreatureType.CREEPER;
break;
case CREEPER:
newType=CreatureType.ZOMBIE;
break;
case ZOMBIE:
newType=CreatureType.SPIDER;
break;
case SPIDER:
newType=CreatureType.SKELETON;
break;
case SKELETON:
newType=CreatureType.PIG;
break;
}
wizard.setMob(newType);
break;
case CHANGE_TIME:
String time=wizard.getTime();
String newTime="String_Node_Str";
if (time.equals("String_Node_Str")) {
newTime="String_Node_Str";
}
 else if (time.equals("String_Node_Str")) {
newTime="String_Node_Str";
}
 else if (time.equals("String_Node_Str")) {
newTime="String_Node_Str";
}
 else if (time.equals("String_Node_Str")) {
newTime="String_Node_Str";
}
wizard.setTime(newTime);
break;
}
}

Fixed version (ground truth):
/** 
 * Sets the next location in the list as active.
 * @return
 */
public void cycle(HumanNPC npc,WizardMode mode){
  Wizard wizard=npc.getType("String_Node_Str");
switch (mode) {
case TELEPORT:
    currentLocation++;
  if (currentLocation >= numberOfLocations) {
    currentLocation=0;
  }
break;
case SPAWN:
CreatureType type=wizard.getMob();
CreatureType newType=null;
switch (type) {
case PIG:
newType=CreatureType.WOLF;
break;
case WOLF:
newType=CreatureType.COW;
break;
case COW:
newType=CreatureType.CHICKEN;
break;
case CHICKEN:
newType=CreatureType.SHEEP;
break;
case SHEEP:
newType=CreatureType.SQUID;
break;
case SQUID:
newType=CreatureType.PIG_ZOMBIE;
break;
case PIG_ZOMBIE:
newType=CreatureType.GHAST;
break;
case GHAST:
newType=CreatureType.GIANT;
break;
case GIANT:
newType=CreatureType.CREEPER;
break;
case CREEPER:
newType=CreatureType.ZOMBIE;
break;
case ZOMBIE:
newType=CreatureType.SPIDER;
break;
case SPIDER:
newType=CreatureType.SKELETON;
break;
case SKELETON:
newType=CreatureType.PIG;
break;
}
wizard.setMob(newType);
break;
case TIME:
String time=wizard.getTime();
String newTime="String_Node_Str";
if (time.equals("String_Node_Str")) {
newTime="String_Node_Str";
}
 else if (time.equals("String_Node_Str")) {
newTime="String_Node_Str";
}
 else if (time.equals("String_Node_Str")) {
newTime="String_Node_Str";
}
 else if (time.equals("String_Node_Str")) {
newTime="String_Node_Str";
}
wizard.setTime(newTime);
break;
}
}
Program: 1837
Project: 1837
Buggy source:
@Override public void onLeftClick(Player player,HumanNPC npc){
  if (Permission.generic(player,"String_Node_Str")) {
    if (player.getItemInHand().getTypeId() == SettingsManager.getInt("String_Node_Str")) {
      Wizard wizard=npc.getType("String_Node_Str");
      String msg=ChatColor.GREEN + "String_Node_Str";
switch (wizard.getMode()) {
case EXECUTE_COMMAND:
        return;
case TELEPORT:
      if (wizard.getNumberOfLocations() > 0) {
        wizard.cycle(npc,WizardMode.TELEPORT);
        msg+="String_Node_Str" + StringUtils.wrap(wizard.getCurrentLocationName());
      }
 else {
        msg+=ChatColor.RED + npc.getStrippedName() + "String_Node_Str";
      }
    break;
case SPAWN_MOB:
  wizard.cycle(npc,WizardMode.SPAWN_MOB);
msg+="String_Node_Str" + StringUtils.wrap(StringUtils.format(wizard.getMob()));
break;
case CHANGE_TIME:
wizard.cycle(npc,WizardMode.CHANGE_TIME);
msg+="String_Node_Str" + StringUtils.wrap(wizard.getTime());
break;
case TOGGLE_STORM:
return;
default :
msg=ChatColor.RED + "String_Node_Str";
break;
}
player.sendMessage(msg);
}
}
 else {
player.sendMessage(MessageUtils.noPermissionsMessage);
}
}

Fixed version (ground truth):
@Override public void onLeftClick(Player player,HumanNPC npc){
  if (Permission.generic(player,"String_Node_Str")) {
    if (player.getItemInHand().getTypeId() == SettingsManager.getInt("String_Node_Str")) {
      Wizard wizard=npc.getType("String_Node_Str");
      String msg=ChatColor.GREEN + "String_Node_Str";
switch (wizard.getMode()) {
case COMMAND:
        return;
case TELEPORT:
      if (wizard.getNumberOfLocations() > 0) {
        wizard.cycle(npc,WizardMode.TELEPORT);
        msg+="String_Node_Str" + StringUtils.wrap(wizard.getCurrentLocationName());
      }
 else {
        msg+=ChatColor.RED + npc.getStrippedName() + "String_Node_Str";
      }
    break;
case SPAWN:
  wizard.cycle(npc,WizardMode.SPAWN);
msg+="String_Node_Str" + StringUtils.wrap(StringUtils.format(wizard.getMob()));
break;
case TIME:
wizard.cycle(npc,WizardMode.TIME);
msg+="String_Node_Str" + StringUtils.wrap(wizard.getTime());
break;
case WEATHER:
return;
default :
msg=ChatColor.RED + "String_Node_Str";
break;
}
player.sendMessage(msg);
}
}
 else {
player.sendMessage(MessageUtils.noPermissionsMessage);
}
}
Program: 1838
Project: 1838
Buggy source:
@Override public void onRightClick(Player player,HumanNPC npc){
  if (Permission.generic(player,"String_Node_Str")) {
    Wizard wizard=npc.getType("String_Node_Str");
    if (Citizens.validateTool("String_Node_Str",player.getItemInHand().getTypeId(),player.isSneaking())) {
      WizardManager.buy(player,npc,"String_Node_Str" + StringUtils.format(wizard.getMode()));
    }
 else     if (player.getItemInHand().getTypeId() == SettingsManager.getInt("String_Node_Str")) {
      String msg=StringUtils.wrap(npc.getStrippedName() + "String_Node_Str");
      int mana=0;
      if (wizard.getMana() + 10 < SettingsManager.getInt("String_Node_Str")) {
        mana=wizard.getMana() + 10;
        msg+="String_Node_Str" + StringUtils.wrap(mana) + "String_Node_Str";
      }
 else       if (wizard.getMana() + 10 == SettingsManager.getInt("String_Node_Str")) {
        mana=SettingsManager.getInt("String_Node_Str");
        msg+="String_Node_Str";
      }
 else {
        msg+="String_Node_Str";
        return;
      }
      InventoryUtils.decreaseItemInHand(player);
      player.sendMessage(msg);
      wizard.setMana(mana);
    }
  }
 else {
    player.sendMessage(MessageUtils.noPermissionsMessage);
  }
}

Fixed version (ground truth):
@Override public void onRightClick(Player player,HumanNPC npc){
  if (Permission.generic(player,"String_Node_Str")) {
    Wizard wizard=npc.getType("String_Node_Str");
    if (player.getItemInHand().getTypeId() == SettingsManager.getInt("String_Node_Str")) {
      String op="String_Node_Str";
switch (wizard.getMode()) {
case COMMAND:
        op="String_Node_Str";
      break;
case TELEPORT:
    op="String_Node_Str";
  break;
case TIME:
op="String_Node_Str";
break;
case SPAWN:
op="String_Node_Str";
break;
case WEATHER:
op="String_Node_Str";
break;
}
WizardManager.buy(player,npc,"String_Node_Str" + op);
}
 else if (player.getItemInHand().getTypeId() == SettingsManager.getInt("String_Node_Str")) {
String msg=StringUtils.wrap(npc.getStrippedName() + "String_Node_Str");
int mana=0;
if (wizard.getMana() + 10 < SettingsManager.getInt("String_Node_Str")) {
mana=wizard.getMana() + 10;
msg+="String_Node_Str" + StringUtils.wrap(mana) + "String_Node_Str";
}
 else if (wizard.getMana() + 10 == SettingsManager.getInt("String_Node_Str")) {
mana=SettingsManager.getInt("String_Node_Str");
msg+="String_Node_Str";
}
 else {
msg+="String_Node_Str";
return;
}
InventoryUtils.decreaseItemInHand(player);
player.sendMessage(msg);
wizard.setMana(mana);
}
}
 else {
player.sendMessage(MessageUtils.noPermissionsMessage);
}
}
Program: 1840
Project: 1840
Buggy source:
/** 
 * Executes a command
 * @param player
 * @param npc
 */
public static boolean executeCommand(Player player,HumanNPC npc){
  if (decreaseMana(player,npc,5)) {
    return player.performCommand(((Wizard)npc.getType("String_Node_Str")).getCommand());
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Executes a command
 * @param player
 * @param npc
 */
public static boolean executeCommand(Player player,HumanNPC npc){
  if (player.performCommand(((Wizard)npc.getType("String_Node_Str")).getCommand())) {
    return decreaseMana(player,npc,5);
  }
  return false;
}
Program: 1841
Project: 1841
Buggy source:
/** 
 * Sets up miscellaneous variables, mostly reading from property files.
 */
public static void setupVariables(){
  Messaging.log("String_Node_Str");
  PropertyManager.registerProperties();
  Storage local=null;
  loadSettings();
  for (  String t : Citizens.loadedTypes) {
    nodes.add(new Node("String_Node_Str",SettingsType.ECONOMY,"String_Node_Str" + t + "String_Node_Str",100));
    for (    Node node : CitizensNPCManager.getType(t).getNodes()) {
      nodes.add(node);
    }
  }
  for (  Node node : nodes) {
    local=node.getFile();
    if (!local.keyExists(node.getPath())) {
      Messaging.log("String_Node_Str" + node.getPath() + "String_Node_Str");
      local.setRaw(node.getPath(),node.getValue());
    }
 else {
      node.set(node.getFile().getRaw(node.getPath()));
    }
    loadedNodes.put(node.getName(),node.getValue());
    local.save();
  }
}

Fixed version (ground truth):
/** 
 * Sets up miscellaneous variables, mostly reading from property files.
 */
public static void setupVariables(){
  PropertyManager.registerProperties();
  Storage local=null;
  loadSettings();
  for (  String t : Citizens.loadedTypes) {
    nodes.add(new Node("String_Node_Str",SettingsType.ECONOMY,"String_Node_Str" + t + "String_Node_Str",100));
    for (    Node node : CitizensNPCManager.getType(t).getNodes()) {
      nodes.add(node);
    }
  }
  for (  Node node : nodes) {
    local=node.getFile();
    if (!local.keyExists(node.getPath())) {
      Messaging.log("String_Node_Str" + node.getPath() + "String_Node_Str");
      local.setRaw(node.getPath(),node.getValue());
    }
 else {
      node.set(node.getFile().getRaw(node.getPath()));
    }
    loadedNodes.put(node.getName(),node.getValue());
    local.save();
  }
}
Program: 1842
Project: 1842
Buggy source:
private void saveWaypoints(int UID,List<Waypoint> list){
  int count=0, innercount=0;
  String path="String_Node_Str", root="String_Node_Str";
  for (  Waypoint waypoint : list) {
    innercount=0;
    path=UID + this.waypoints + "String_Node_Str"+ count;
    LocationUtils.saveLocation(profiles,waypoint.getLocation(),path,true);
    profiles.setInt(path + "String_Node_Str",waypoint.getDelay());
    path+="String_Node_Str";
    for (    WaypointModifier modifier : waypoint.getModifiers()) {
      root=path + innercount;
      profiles.setString(root + "String_Node_Str",modifier.getType().name());
      modifier.save(profiles,root);
      ++innercount;
    }
    ++count;
  }
}

Fixed version (ground truth):
private void saveWaypoints(int UID,List<Waypoint> list){
  profiles.removeKey(UID + this.waypoints);
  int count=0, innercount=0;
  String path="String_Node_Str", root="String_Node_Str";
  for (  Waypoint waypoint : list) {
    innercount=0;
    path=UID + this.waypoints + "String_Node_Str"+ count;
    LocationUtils.saveLocation(profiles,waypoint.getLocation(),path,true);
    profiles.setInt(path + "String_Node_Str",waypoint.getDelay());
    path+="String_Node_Str";
    for (    WaypointModifier modifier : waypoint.getModifiers()) {
      root=path + innercount;
      profiles.setString(root + "String_Node_Str",modifier.getType().name());
      modifier.save(profiles,root);
      ++innercount;
    }
    ++count;
  }
}
Program: 1843
Project: 1843
Buggy source:
public static String format(Enum toFormat){
  String[] split=toFormat.name().toLowerCase().split("String_Node_Str");
  split[0]=capitalise(split[0]);
  return Joiner.on("String_Node_Str").join(split);
}

Fixed version (ground truth):
public static String format(Enum<?> toFormat){
  String[] split=toFormat.name().toLowerCase().split("String_Node_Str");
  split[0]=capitalise(split[0]);
  return Joiner.on("String_Node_Str").join(split);
}
Program: 1844
Project: 1844
Buggy source:
@Override public boolean converse(Player player,ConversationMessage message){
  super.resetExit();
  if (Effects.getByName(message.getMessage()) == null) {
    player.sendMessage("String_Node_Str");
  }
 else {
    if (inProgress == null) {
      IEffect effect=Effects.getByName(message.getMessage());
      if (effect instanceof Effect) {
switch ((Effect)effect) {
case DISPENSER_PARTICLE_SPAWN:
          player.sendMessage(ChatColor.GREEN + "String_Node_Str");
        inProgress=effect;
      break;
case DIG:
    player.sendMessage(ChatColor.GREEN + "String_Node_Str");
  inProgress=effect;
break;
default :
}
}
 else {
add(player,new EffectData(effect));
}
}
 else {
if (inProgress instanceof Effect) {
int data=message.getInteger(0);
switch ((Effect)inProgress) {
case DISPENSER_PARTICLE_SPAWN:
break;
case DIG:
if (data > 255 || Material.getMaterial(data) == null) {
player.sendMessage(ChatColor.GRAY + "String_Node_Str");
return false;
}
player.sendMessage(super.getMessage("String_Node_Str",StringUtils.format(Material.getMaterial(data))));
break;
}
add(player,new EffectData(inProgress,data));
inProgress=null;
}
}
}
return false;
}

Fixed version (ground truth):
@Override public boolean converse(Player player,ConversationMessage message){
  super.resetExit();
  if (Effects.getByName(message.getMessage()) == null) {
    player.sendMessage("String_Node_Str");
  }
 else {
    if (inProgress == null) {
      IEffect effect=Effects.getByName(message.getMessage());
      if (effect instanceof Effect) {
        inProgress=effect;
switch ((Effect)effect) {
case DISPENSER_PARTICLE_SPAWN:
          player.sendMessage(ChatColor.GREEN + "String_Node_Str");
        break;
case DIG:
      player.sendMessage(ChatColor.GREEN + "String_Node_Str");
    break;
case RECORD_PLAY:
  player.sendMessage(ChatColor.GREEN + "String_Node_Str");
break;
default :
}
}
 else {
add(player,new EffectData(effect));
}
}
 else {
if (inProgress instanceof Effect) {
int data=0;
switch ((Effect)inProgress) {
case DISPENSER_PARTICLE_SPAWN:
data=message.getInteger(0);
if (data > 8 || data < 1) {
player.sendMessage(ChatColor.GRAY + "String_Node_Str");
return false;
}
player.sendMessage(getMessage("String_Node_Str",data));
break;
case DIG:
data=message.getInteger(0);
if (data > 255 || Material.getMaterial(data) == null) {
player.sendMessage(ChatColor.GRAY + "String_Node_Str");
return false;
}
player.sendMessage(super.getMessage("String_Node_Str",StringUtils.format(Material.getMaterial(data))));
break;
case RECORD_PLAY:
if (message.getMessage().equalsIgnoreCase("String_Node_Str")) data=2257;
 else if (message.getMessage().equalsIgnoreCase("String_Node_Str")) data=2256;
 else data=-1;
if (data != 2256 && data != 2257) {
player.sendMessage(ChatColor.GRAY + "String_Node_Str");
}
break;
}
add(player,new EffectData(inProgress,data));
inProgress=null;
}
}
}
return false;
}
Program: 1845
Project: 1845
Buggy source:
private static ItemPrice createItemPrice(Player player,String price){
  ItemStack cost=parseItemStack(player,price,true);
  boolean econPlugin=false;
  if (cost == null) {
    econPlugin=true;
  }
  ItemPrice itemPrice;
  if (!econPlugin) {
    itemPrice=new ItemPrice(cost);
  }
 else {
    itemPrice=new ItemPrice(Double.parseDouble(price));
  }
  itemPrice.setEconPlugin(econPlugin);
  return itemPrice;
}

Fixed version (ground truth):
private static ItemPrice createItemPrice(Player player,String price){
  ItemStack cost=parseItemStack(player,price,true);
  boolean econPlugin=false;
  if (cost == null) {
    econPlugin=true;
  }
  ItemPrice itemPrice;
  if (!econPlugin) {
    itemPrice=new ItemPrice(cost);
  }
 else {
    if (Double.parseDouble(price) < 0) {
      player.sendMessage(ChatColor.GRAY + "String_Node_Str");
      return null;
    }
    itemPrice=new ItemPrice(Double.parseDouble(price));
  }
  itemPrice.setEconPlugin(econPlugin);
  return itemPrice;
}
Program: 1846
Project: 1846
Buggy source:
@Override public void onLeftClick(Player player,HumanNPC npc){
  if (Permission.generic(player,"String_Node_Str")) {
    if (player.getItemInHand().getTypeId() == SettingsManager.getInt("String_Node_Str")) {
      Wizard wizard=npc.getType("String_Node_Str");
      WizardMode mode=wizard.getMode();
      String msg=ChatColor.GREEN + "String_Node_Str";
switch (mode) {
case EXECUTE_COMMAND:
        return;
case TELEPORT:
      if (wizard.getNumberOfLocations() > 0) {
        wizard.cycle(npc,WizardMode.TELEPORT);
        msg+="String_Node_Str" + StringUtils.wrap(wizard.getCurrentLocationName());
      }
 else {
        msg+=ChatColor.RED + npc.getStrippedName() + "String_Node_Str";
      }
    break;
case SPAWN_MOB:
  wizard.cycle(npc,WizardMode.SPAWN_MOB);
msg+="String_Node_Str" + StringUtils.wrap(wizard.getMob().name().toLowerCase().replace("String_Node_Str","String_Node_Str"));
break;
case CHANGE_TIME:
wizard.cycle(npc,WizardMode.CHANGE_TIME);
msg+="String_Node_Str" + StringUtils.wrap(wizard.getTime());
break;
case TOGGLE_STORM:
return;
default :
msg=ChatColor.RED + "String_Node_Str";
break;
}
player.sendMessage(msg);
}
}
 else {
player.sendMessage(MessageUtils.noPermissionsMessage);
}
}

Fixed version (ground truth):
@Override public void onLeftClick(Player player,HumanNPC npc){
  if (Permission.generic(player,"String_Node_Str")) {
    if (player.getItemInHand().getTypeId() == SettingsManager.getInt("String_Node_Str")) {
      Wizard wizard=npc.getType("String_Node_Str");
      String msg=ChatColor.GREEN + "String_Node_Str";
switch (wizard.getMode()) {
case EXECUTE_COMMAND:
        return;
case TELEPORT:
      if (wizard.getNumberOfLocations() > 0) {
        wizard.cycle(npc,WizardMode.TELEPORT);
        msg+="String_Node_Str" + StringUtils.wrap(wizard.getCurrentLocationName());
      }
 else {
        msg+=ChatColor.RED + npc.getStrippedName() + "String_Node_Str";
      }
    break;
case SPAWN_MOB:
  wizard.cycle(npc,WizardMode.SPAWN_MOB);
msg+="String_Node_Str" + StringUtils.wrap(StringUtils.format(wizard.getMob()));
break;
case CHANGE_TIME:
wizard.cycle(npc,WizardMode.CHANGE_TIME);
msg+="String_Node_Str" + StringUtils.wrap(wizard.getTime());
break;
case TOGGLE_STORM:
return;
default :
msg=ChatColor.RED + "String_Node_Str";
break;
}
player.sendMessage(msg);
}
}
 else {
player.sendMessage(MessageUtils.noPermissionsMessage);
}
}
Program: 1847
Project: 1847
Buggy source:
@Override public void onRightClick(Player player,HumanNPC npc){
  if (Permission.generic(player,"String_Node_Str")) {
    Wizard wizard=npc.getType("String_Node_Str");
    if (Citizens.validateTool("String_Node_Str",player.getItemInHand().getTypeId(),player.isSneaking())) {
      WizardManager.buy(player,npc,"String_Node_Str" + wizard.getMode().toString().toLowerCase().replace("String_Node_Str","String_Node_Str"));
    }
 else     if (player.getItemInHand().getTypeId() == SettingsManager.getInt("String_Node_Str")) {
      String msg=StringUtils.wrap(npc.getStrippedName() + "String_Node_Str");
      int mana=0;
      if (wizard.getMana() + 10 < SettingsManager.getInt("String_Node_Str")) {
        mana=wizard.getMana() + 10;
        msg+="String_Node_Str" + StringUtils.wrap(mana) + "String_Node_Str";
      }
 else       if (wizard.getMana() + 10 == SettingsManager.getInt("String_Node_Str")) {
        mana=SettingsManager.getInt("String_Node_Str");
        msg+="String_Node_Str";
      }
 else {
        msg+="String_Node_Str";
        return;
      }
      InventoryUtils.decreaseItemInHand(player);
      player.sendMessage(msg);
      wizard.setMana(mana);
    }
  }
 else {
    player.sendMessage(MessageUtils.noPermissionsMessage);
  }
}

Fixed version (ground truth):
@Override public void onRightClick(Player player,HumanNPC npc){
  if (Permission.generic(player,"String_Node_Str")) {
    Wizard wizard=npc.getType("String_Node_Str");
    if (Citizens.validateTool("String_Node_Str",player.getItemInHand().getTypeId(),player.isSneaking())) {
      WizardManager.buy(player,npc,"String_Node_Str" + StringUtils.format(wizard.getMode()));
    }
 else     if (player.getItemInHand().getTypeId() == SettingsManager.getInt("String_Node_Str")) {
      String msg=StringUtils.wrap(npc.getStrippedName() + "String_Node_Str");
      int mana=0;
      if (wizard.getMana() + 10 < SettingsManager.getInt("String_Node_Str")) {
        mana=wizard.getMana() + 10;
        msg+="String_Node_Str" + StringUtils.wrap(mana) + "String_Node_Str";
      }
 else       if (wizard.getMana() + 10 == SettingsManager.getInt("String_Node_Str")) {
        mana=SettingsManager.getInt("String_Node_Str");
        msg+="String_Node_Str";
      }
 else {
        msg+="String_Node_Str";
        return;
      }
      InventoryUtils.decreaseItemInHand(player);
      player.sendMessage(msg);
      wizard.setMana(mana);
    }
  }
 else {
    player.sendMessage(MessageUtils.noPermissionsMessage);
  }
}
Program: 1848
Project: 1848
Buggy source:
/** 
 * Teleport a player to one of a wizard's locations
 * @param player
 * @param npc
 */
public static boolean teleportPlayer(Player player,HumanNPC npc){
  WizardNPC wizard=npc.getType("String_Node_Str");
  if (wizard.getNumberOfLocations() > 0) {
    if (decreaseMana(player,npc,5)) {
      player.teleport(wizard.getCurrentLocation());
      return true;
    }
    return false;
  }
  Messaging.sendError(player,npc.getStrippedName() + "String_Node_Str");
  return false;
}

Fixed version (ground truth):
/** 
 * Teleport a player to one of a wizard's locations
 * @param player
 * @param npc
 */
public static boolean teleportPlayer(Player player,HumanNPC npc){
  Wizard wizard=npc.getType("String_Node_Str");
  if (wizard.getNumberOfLocations() > 0) {
    if (decreaseMana(player,npc,5)) {
      player.teleport(wizard.getCurrentLocation());
      return true;
    }
    return false;
  }
  Messaging.sendError(player,npc.getStrippedName() + "String_Node_Str");
  return false;
}
Program: 1849
Project: 1849
Buggy source:
/** 
 * Executes a command
 * @param player
 * @param npc
 */
public static boolean executeCommand(Player player,HumanNPC npc){
  if (decreaseMana(player,npc,5)) {
    Bukkit.getServer().dispatchCommand(player,((Wizard)npc.getType("String_Node_Str")).getCommand());
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Executes a command
 * @param player
 * @param npc
 */
public static boolean executeCommand(Player player,HumanNPC npc){
  if (decreaseMana(player,npc,5)) {
    return player.performCommand(((Wizard)npc.getType("String_Node_Str")).getCommand());
  }
  return false;
}
Program: 1850
Project: 1850
Buggy source:
@Override public void run(){
  for (  Entry<Integer,HumanNPC> entry : NPCManager.getList().entrySet()) {
    HumanNPC npc=entry.getValue();
    if (!npc.isType("String_Node_Str")) {
      return;
    }
    Wizard wizard=npc.getType("String_Node_Str");
    if (SettingsManager.getBoolean("String_Node_Str") && !wizard.hasUnlimitedMana()) {
      WizardManager.increaseMana(npc,1);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  for (  Entry<Integer,HumanNPC> entry : NPCManager.getList().entrySet()) {
    if (!entry.getValue().isType("String_Node_Str")) {
      return;
    }
    HumanNPC npc=entry.getValue();
    Wizard wizard=npc.getType("String_Node_Str");
    if (SettingsManager.getBoolean("String_Node_Str") && !wizard.hasUnlimitedMana()) {
      WizardManager.increaseMana(npc,1);
    }
  }
}
Program: 1851
Project: 1851
Buggy source:
/** 
 * Get the currency using a payment
 * @param payment
 * @param colour
 * @return
 */
public static String getCurrency(Payment payment,ChatColor colour){
  return MessageUtils.getStackString(payment.getItem(),colour);
}

Fixed version (ground truth):
/** 
 * Gets the item currency from an operation.
 * @param op
 * @return
 */
public static String getCurrency(EconomyOperation op){
  return ChatColor.stripColor(MessageUtils.getStackString(new ItemStack(op.getItemCurrencyID(),op.getItemPrice())));
}
Program: 1852
Project: 1852
Buggy source:
/** 
 * Checks the inventory of a player for having enough for a payment.
 * @param payment
 * @param player
 * @return
 */
public static boolean hasEnough(Payment payment,Player player){
  int current=0;
  if (payment.getItem().getAmount() <= 0 || payment.getItem().getTypeId() == 0) {
    return true;
  }
  for (  ItemStack i : player.getInventory().getContents()) {
    if (i != null && i.getTypeId() == payment.getItem().getTypeId()) {
      current+=i.getAmount();
      if (current >= payment.getPrice()) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks the inventory of a player for having enough for an operation.
 * @param player
 * @param op
 * @return
 */
public static boolean hasEnough(Player player,int itemCurrencyID,int itemPrice){
  int current=0;
  for (  ItemStack i : player.getInventory().getContents()) {
    if (i != null && i.getTypeId() == itemCurrencyID) {
      current+=i.getAmount();
      if (current >= itemPrice) {
        return true;
      }
    }
  }
  return false;
}
Program: 1853
Project: 1853
Buggy source:
/** 
 * Pays for a payment from the player's inventory.
 * @param player
 * @param payment
 * @param slot
 * @return
 */
public static double pay(Player player,Payment payment,int slot){
  int currencyID=payment.getItem().getTypeId();
  double current=payment.getPrice();
  if (current <= 0) {
    return current;
  }
  int count=0;
  if (slot != -1) {
    current=decreaseItemStack(player,currencyID,current,slot);
  }
  if (current <= 0) {
    return payment.getPrice();
  }
  for (  ItemStack item : player.getInventory().getContents()) {
    if (item != null) {
      current=decreaseItemStack(player,currencyID,current,count);
      if (current <= 0) {
        break;
      }
    }
    count+=1;
  }
  return payment.getPrice();
}

Fixed version (ground truth):
/** 
 * Pays from the player's inventory using an operation.
 * @param player
 * @param op
 * @return
 */
public static double pay(Player player,int itemCurrencyID,int itemPrice){
  double current=itemPrice;
  int count=0;
  for (  ItemStack i : player.getInventory().getContents()) {
    if (i != null) {
      current=decreaseItemStack(player,itemCurrencyID,current,count);
      if (current <= 0) {
        break;
      }
    }
    count+=1;
  }
  return itemPrice;
}
Program: 1854
Project: 1854
Buggy source:
/** 
 * Checks whether an npc has enough in its balance for a payment.
 * @param payment
 * @param npc
 * @return
 */
public static boolean hasEnough(Payment payment,HumanNPC npc){
  return npc.getBalance() - payment.getPrice() >= 0;
}

Fixed version (ground truth):
/** 
 * Checks whether the player has enough money for an operation.
 * @param player
 * @param op
 * @return
 */
public static boolean hasEnough(Player player,double price){
  return playerHasEnough(player.getName(),price);
}
Program: 1855
Project: 1855
Buggy source:
/** 
 * Pays for a payment using the player's money.
 * @param player
 * @param payment
 * @return
 */
public static double pay(Player player,Payment payment){
  subtract(player.getName(),payment.getPrice());
  return payment.getPrice();
}

Fixed version (ground truth):
/** 
 * Pays for an operation using the player's money.
 * @param player
 * @param op
 * @return
 */
public static double pay(Player player,double price){
  subtract(player.getName(),price);
  return price;
}
Program: 1856
Project: 1856
Buggy source:
@Override public boolean canTake(Player player){
  return take ? ItemInterface.hasEnough(new Payment(reward),player) : true;
}

Fixed version (ground truth):
@Override public boolean canTake(Player player){
  return take;
}
Program: 1857
Project: 1857
Buggy source:
/** 
 * Formats the price message for an ItemPrice.
 * @param price
 * @return
 */
public static String getPriceMessage(ItemPrice price,ChatColor colour){
  String message="String_Node_Str";
  message+=colour + StringUtils.wrap(EconomyManager.getCurrency(new Payment(price),colour),colour);
  return message;
}

Fixed version (ground truth):
/** 
 * Formats the price message for an ItemPrice.
 * @param price
 * @return
 */
public static String getPriceMessage(ItemPrice price,ChatColor colour){
  String message="String_Node_Str";
  return message;
}
Program: 1858
Project: 1858
Buggy source:
@Command(aliases={"String_Node_Str","String_Node_Str"},usage="String_Node_Str",desc="String_Node_Str",modifiers={"String_Node_Str","String_Node_Str"},min=3,max=3) @CommandPermissions("String_Node_Str") public static void addWaypointModifier(CommandContext args,Player player,HumanNPC npc){
  if (NPCDataManager.pathEditors.get(player.getName()) == null) {
    player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    return;
  }
  String type=args.getString(2);
  if (WaypointModifierType.valueOf(type.toUpperCase()) == null) {
    player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    return;
  }
  WaypointModifierType modifier=WaypointModifierType.valueOf(type.toUpperCase());
  player.sendMessage(ChatColor.AQUA + StringUtils.listify(StringUtils.wrap(StringUtils.capitalise(modifier.name().toLowerCase())) + "String_Node_Str" + ChatColor.AQUA));
  Waypoint waypoint=npc.getWaypoints().getLast();
  ConversationUtils.addConverser(player,modifier.create(waypoint));
}

Fixed version (ground truth):
@Command(aliases={"String_Node_Str","String_Node_Str"},usage="String_Node_Str",desc="String_Node_Str",modifiers={"String_Node_Str","String_Node_Str"},min=3,max=3) @CommandPermissions("String_Node_Str") public static void addWaypointModifier(CommandContext args,Player player,HumanNPC npc){
  if (NPCDataManager.pathEditors.get(player.getName()) == null) {
    player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    return;
  }
  String type=args.getString(2);
  WaypointModifierType modifier;
  try {
    modifier=WaypointModifierType.valueOf(type.toUpperCase());
    if (modifier == null) {
      player.sendMessage(ChatColor.GRAY + "String_Node_Str");
      return;
    }
  }
 catch (  Exception e) {
    player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    return;
  }
  modifier=WaypointModifierType.valueOf(type.toUpperCase());
  player.sendMessage(ChatColor.AQUA + StringUtils.listify(StringUtils.wrap(StringUtils.capitalise(modifier.name().toLowerCase())) + "String_Node_Str" + ChatColor.AQUA));
  Waypoint waypoint=npc.getWaypoints().getLast();
  ConversationUtils.addConverser(player,modifier.create(waypoint));
}
Program: 1859
Project: 1859
Buggy source:
public float toFloat(){
  return (Float)this.getValue();
}

Fixed version (ground truth):
public float toFloat(){
  return this.getValue() instanceof Double ? new Float((Double)this.getValue()) : (Integer)this.getValue();
}
Program: 1860
Project: 1860
Buggy source:
public double toDouble(){
  return (Double)this.getValue();
}

Fixed version (ground truth):
public double toDouble(){
  return this.getValue() instanceof Double ? (Double)this.getValue() : (Integer)this.getValue();
}
Program: 1861
Project: 1861
Buggy source:
public int getColour(int UID){
  if (Strings.isNullOrEmpty(profiles.getString(UID + color))) {
    profiles.setInt(UID + color,0xF);
    return 0xF;
  }
  return Integer.parseInt(profiles.getString(UID + color),16);
}

Fixed version (ground truth):
public int getColour(int UID){
  if (Strings.isNullOrEmpty(profiles.getString(UID + color))) {
    profiles.setInt(UID + color,0xF);
    return 0xF;
  }
  try {
    return Integer.parseInt(profiles.getString(UID + color),16);
  }
 catch (  NumberFormatException ex) {
    return 0xF;
  }
}
Program: 1862
Project: 1862
Buggy source:
public boolean hasTarget(){
  return this.targetEntity == null;
}

Fixed version (ground truth):
public boolean hasTarget(){
  return this.targetEntity != null;
}
Program: 1864
Project: 1864
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 copyNPC(CommandContext args,Player player,HumanNPC npc){
  if (UtilityProperties.getNPCCount(player.getName()) >= Constants.maxNPCsPerPlayer && !Permission.isAdmin(player)) {
    player.sendMessage(MessageUtils.reachedNPCLimitMessage);
    return;
  }
  PropertyManager.save(npc);
  int newUID=NPCManager.register(npc.getName(),player.getLocation(),player.getName());
  HumanNPC newNPC=NPCManager.get(newUID);
  newNPC.teleport(player.getLocation());
  newNPC.getNPCData().setLocation(player.getLocation());
  PropertyManager.copyNPCs(npc.getUID(),newUID);
}

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 copyNPC(CommandContext args,Player player,HumanNPC npc){
  if (UtilityProperties.getNPCCount(player.getName()) >= Constants.maxNPCsPerPlayer && !Permission.isAdmin(player)) {
    player.sendMessage(MessageUtils.reachedNPCLimitMessage);
    return;
  }
  PropertyManager.save(npc);
  int newUID=NPCManager.register(npc.getName(),player.getLocation(),player.getName());
  HumanNPC newNPC=NPCManager.get(newUID);
  newNPC.teleport(player.getLocation());
  newNPC.getNPCData().setLocation(player.getLocation());
  PropertyManager.copyNPCs(npc.getUID(),newUID);
  PropertyManager.load(newNPC);
}
Program: 1865
Project: 1865
Buggy source:
@Command(aliases="String_Node_Str",usage="String_Node_Str",desc="String_Node_Str",modifiers="String_Node_Str",min=2,max=2) @CommandPermissions("String_Node_Str") public static void selectNPC(CommandContext args,Player player,HumanNPC npc){
  npc=NPCManager.get(Integer.valueOf(args.getString(1)));
  if (npc == null) {
    player.sendMessage(ChatColor.RED + "String_Node_Str" + StringUtils.wrap(args.getString(1),ChatColor.RED)+ "String_Node_Str");
  }
 else {
    NPCManager.selectNPC(player,npc);
    Messaging.send(player,npc,Constants.selectionMessage);
  }
}

Fixed version (ground truth):
@Command(aliases="String_Node_Str",usage="String_Node_Str",desc="String_Node_Str",modifiers="String_Node_Str",min=2,max=2) @CommandPermissions("String_Node_Str") @CommandRequirements() public static void selectNPC(CommandContext args,Player player,HumanNPC npc){
  npc=NPCManager.get(Integer.valueOf(args.getString(1)));
  if (npc == null) {
    player.sendMessage(ChatColor.RED + "String_Node_Str" + StringUtils.wrap(args.getString(1),ChatColor.RED)+ "String_Node_Str");
  }
 else {
    NPCManager.selectNPC(player,npc);
    Messaging.send(player,npc,Constants.selectionMessage);
  }
}