nus-yam/ex-repair huggingface dataset:
Program: 10144
Project: 10144
Buggy source:
public EntityItemProjectile_v1_10_R1(CraftWorld craftWorld,Location location,org.bukkit.inventory.ItemStack itemStack){
  super(craftWorld.getHandle());
  this.pickupDelay=Integer.MAX_VALUE;
  setPositionRotation(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  this.setSize(0.25F,0.25F);
  this.setItemStack(CraftItemStack.asNMSCopy(itemStack));
  world.addEntity(this);
  bukkitEntity=new CraftItemProjectile_v1_10_R1((CraftServer)Bukkit.getServer(),this);
}

Fixed version (ground truth):
public EntityItemProjectile_v1_10_R1(CraftWorld craftWorld,Location location,org.bukkit.inventory.ItemStack itemStack){
  super(craftWorld.getHandle());
  bukkitEntity=new CraftItemProjectile_v1_10_R1((CraftServer)Bukkit.getServer(),this);
  this.pickupDelay=Integer.MAX_VALUE;
  setPositionRotation(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  this.setSize(0.25F,0.25F);
  this.setItemStack(CraftItemStack.asNMSCopy(itemStack));
  world.addEntity(this);
}
Program: 10145
Project: 10145
Buggy source:
public EntityFakeArrow_v1_8_R3(CraftWorld craftWorld,Location location){
  super(craftWorld.getHandle());
  setPositionRotation(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  world.addEntity(this);
  bukkitEntity=new CraftFakeArrow_v1_8_R3((CraftServer)Bukkit.getServer(),this);
}

Fixed version (ground truth):
public EntityFakeArrow_v1_8_R3(CraftWorld craftWorld,Location location){
  super(craftWorld.getHandle());
  bukkitEntity=new CraftFakeArrow_v1_8_R3((CraftServer)Bukkit.getServer(),this);
  setPositionRotation(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  world.addEntity(this);
}
Program: 10146
Project: 10146
Buggy source:
public EntityItemProjectile_v1_8_R3(CraftWorld craftWorld,Location location,org.bukkit.inventory.ItemStack itemStack){
  super(craftWorld.getHandle());
  this.pickupDelay=Integer.MAX_VALUE;
  setPositionRotation(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  this.setSize(0.25F,0.25F);
  this.setItemStack(CraftItemStack.asNMSCopy(itemStack));
  world.addEntity(this);
  bukkitEntity=new CraftItemProjectile_v1_8_R3((CraftServer)Bukkit.getServer(),this);
}

Fixed version (ground truth):
public EntityItemProjectile_v1_8_R3(CraftWorld craftWorld,Location location,org.bukkit.inventory.ItemStack itemStack){
  super(craftWorld.getHandle());
  bukkitEntity=new CraftItemProjectile_v1_8_R3((CraftServer)Bukkit.getServer(),this);
  this.pickupDelay=Integer.MAX_VALUE;
  setPositionRotation(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  this.setSize(0.25F,0.25F);
  this.setItemStack(CraftItemStack.asNMSCopy(itemStack));
  world.addEntity(this);
}
Program: 10147
Project: 10147
Buggy source:
public EntityFakeArrow_v1_9_R2(CraftWorld craftWorld,Location location){
  super(craftWorld.getHandle());
  setPositionRotation(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  world.addEntity(this);
  bukkitEntity=new CraftFakeArrow_v1_9_R2((CraftServer)Bukkit.getServer(),this);
}

Fixed version (ground truth):
public EntityFakeArrow_v1_9_R2(CraftWorld craftWorld,Location location){
  super(craftWorld.getHandle());
  bukkitEntity=new CraftFakeArrow_v1_9_R2((CraftServer)Bukkit.getServer(),this);
  setPositionRotation(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  world.addEntity(this);
}
Program: 10148
Project: 10148
Buggy source:
public EntityItemProjectile_v1_9_R2(CraftWorld craftWorld,Location location,org.bukkit.inventory.ItemStack itemStack){
  super(craftWorld.getHandle());
  this.pickupDelay=Integer.MAX_VALUE;
  setPositionRotation(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  this.setSize(0.25F,0.25F);
  this.setItemStack(CraftItemStack.asNMSCopy(itemStack));
  world.addEntity(this);
  bukkitEntity=new CraftItemProjectile_v1_9_R2((CraftServer)Bukkit.getServer(),this);
}

Fixed version (ground truth):
public EntityItemProjectile_v1_9_R2(CraftWorld craftWorld,Location location,org.bukkit.inventory.ItemStack itemStack){
  super(craftWorld.getHandle());
  bukkitEntity=new CraftItemProjectile_v1_9_R2((CraftServer)Bukkit.getServer(),this);
  this.pickupDelay=Integer.MAX_VALUE;
  setPositionRotation(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  this.setSize(0.25F,0.25F);
  this.setItemStack(CraftItemStack.asNMSCopy(itemStack));
  world.addEntity(this);
}
Program: 10150
Project: 10150
Buggy source:
@Override public void run(){
  sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER,fakePlayer));
}

Fixed version (ground truth):
@Override public void run(){
  sendPacket(new PacketPlayOutMount(entity.getVehicle()));
}
Program: 10152
Project: 10152
Buggy source:
@Override public void run(){
  sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER,fakePlayer));
}

Fixed version (ground truth):
@Override public void run(){
  sendPacket(new PacketPlayOutMount(entity.getVehicle()));
}
Program: 10153
Project: 10153
Buggy source:
public Sidebar_v1_10_R1(Player player){
  super(player);
  this.obj1=new ScoreboardObjective(dummyScoreboard,"String_Node_Str",dummyCriteria);
  this.obj2=new ScoreboardObjective(dummyScoreboard,"String_Node_Str",dummyCriteria);
}

Fixed version (ground truth):
public Sidebar_v1_10_R1(Player player){
  super(player);
  this.obj1=new ScoreboardObjective(dummyScoreboard,"String_Node_Str",dummyCriteria);
  this.obj2=new ScoreboardObjective(dummyScoreboard,"String_Node_Str",dummyCriteria);
  setDisplayName(title);
}
Program: 10154
Project: 10154
Buggy source:
@Override protected void setDisplayName(String title){
  this.obj1.setDisplayName(title);
  this.obj2.setDisplayName(title);
}

Fixed version (ground truth):
@Override protected void setDisplayName(String title){
  if (this.obj1 != null) {
    this.obj1.setDisplayName(title);
    this.obj2.setDisplayName(title);
  }
}
Program: 10155
Project: 10155
Buggy source:
public Sidebar_v1_8_R3(Player player){
  super(player);
  this.obj1=new ScoreboardObjective(dummyScoreboard,"String_Node_Str",dummyCriteria);
  this.obj2=new ScoreboardObjective(dummyScoreboard,"String_Node_Str",dummyCriteria);
}

Fixed version (ground truth):
public Sidebar_v1_8_R3(Player player){
  super(player);
  this.obj1=new ScoreboardObjective(dummyScoreboard,"String_Node_Str",dummyCriteria);
  this.obj2=new ScoreboardObjective(dummyScoreboard,"String_Node_Str",dummyCriteria);
  setDisplayName(title);
}
Program: 10156
Project: 10156
Buggy source:
@Override protected void setDisplayName(String title){
  this.obj1.setDisplayName(title);
  this.obj2.setDisplayName(title);
}

Fixed version (ground truth):
@Override protected void setDisplayName(String title){
  if (this.obj1 != null) {
    this.obj1.setDisplayName(title);
    this.obj2.setDisplayName(title);
  }
}
Program: 10157
Project: 10157
Buggy source:
public Sidebar_v1_9_R2(Player player){
  super(player);
  this.obj1=new ScoreboardObjective(dummyScoreboard,"String_Node_Str",dummyCriteria);
  this.obj2=new ScoreboardObjective(dummyScoreboard,"String_Node_Str",dummyCriteria);
}

Fixed version (ground truth):
public Sidebar_v1_9_R2(Player player){
  super(player);
  this.obj1=new ScoreboardObjective(dummyScoreboard,"String_Node_Str",dummyCriteria);
  this.obj2=new ScoreboardObjective(dummyScoreboard,"String_Node_Str",dummyCriteria);
  setDisplayName(title);
}
Program: 10158
Project: 10158
Buggy source:
@Override protected void setDisplayName(String title){
  this.obj1.setDisplayName(title);
  this.obj2.setDisplayName(title);
}

Fixed version (ground truth):
@Override protected void setDisplayName(String title){
  if (this.obj1 != null) {
    this.obj1.setDisplayName(title);
    this.obj2.setDisplayName(title);
  }
}
Program: 10159
Project: 10159
Buggy source:
private void reel(){
  DenizenAPI.getDenizenNPC(npc).action("String_Node_Str",null);
  int chance=(int)(Math.random() * 100);
  try {
    fishHook.remove();
  }
 catch (  Exception e) {
  }
  if (catchPercent > chance && fishHook != null && catchType != FishingHelper.CatchType.NONE) {
    try {
      fish.remove();
    }
 catch (    Exception e) {
    }
    Location location=fishHook.getLocation();
    fish=location.getWorld().spawn(location,Item.class);
    fish.setItemStack(NMSHandler.getInstance().getFishingHelper().getResult(fishHook,catchType));
    Location npcLocation=npc.getEntity().getLocation();
    double d5=npcLocation.getX() - location.getX();
    double d6=npcLocation.getY() - location.getY();
    double d7=npcLocation.getZ() - location.getZ();
    double d8=Math.sqrt(d5 * d5 + d6 * d6 + d7 * d7);
    double d9=0.1D;
    fish.setVelocity(new Vector(d5 * d9,d6 * d9 + Math.sqrt(d8) * 0.08D,d7 * d9));
    DenizenAPI.getDenizenNPC(npc).action("String_Node_Str",null);
  }
  PlayerAnimation.ARM_SWING.play((Player)npc.getEntity());
}

Fixed version (ground truth):
private void reel(){
  DenizenAPI.getDenizenNPC(npc).action("String_Node_Str",null);
  int chance=(int)(Math.random() * 100);
  try {
    fishHook.remove();
  }
 catch (  Exception e) {
  }
  if (catchPercent > chance && fishHook != null && catchType != FishingHelper.CatchType.NONE) {
    try {
      fish.remove();
    }
 catch (    Exception e) {
    }
    Location location=fishHook.getLocation();
    ItemStack result=NMSHandler.getInstance().getFishingHelper().getResult(fishHook,catchType);
    if (result != null) {
      fish=location.getWorld().dropItem(location,result);
      Location npcLocation=npc.getEntity().getLocation();
      double d5=npcLocation.getX() - location.getX();
      double d6=npcLocation.getY() - location.getY();
      double d7=npcLocation.getZ() - location.getZ();
      double d8=Math.sqrt(d5 * d5 + d6 * d6 + d7 * d7);
      double d9=0.1D;
      fish.setVelocity(new Vector(d5 * d9,d6 * d9 + Math.sqrt(d8) * 0.08D,d7 * d9));
    }
    DenizenAPI.getDenizenNPC(npc).action("String_Node_Str",null);
  }
  PlayerAnimation.ARM_SWING.play((Player)npc.getEntity());
}
Program: 10160
Project: 10160
Buggy source:
private void cast(){
  DenizenAPI.getDenizenNPC(npc).action("String_Node_Str",null);
  if (fishingLocation == null) {
    dB.echoError("String_Node_Str");
    return;
  }
  double v=34;
  double g=20;
  Location from=npc.getEntity().getLocation();
  from=from.add(0,.33,0);
  Location to=fishingLocation;
  Vector test=to.clone().subtract(from).toVector();
  Double elev=test.getY();
  Double testAngle=launchAngle(from,to,v,elev,g);
  if (testAngle == null) {
    return;
  }
  Double hangtime=hangtime(testAngle,v,elev,g);
  Vector victor=to.clone().subtract(from).toVector();
  Double dist=Math.sqrt(Math.pow(victor.getX(),2) + Math.pow(victor.getZ(),2));
  elev=victor.getY();
  if (dist == 0) {
    return;
  }
  Double launchAngle=launchAngle(from,to,v,elev,g);
  if (launchAngle == null) {
    return;
  }
  victor.setY(Math.tan(launchAngle) * dist);
  victor=normalizeVector(victor);
  v=v + (.5 * Math.pow(hangtime,2));
  v=v + (CoreUtilities.getRandom().nextDouble() - .8) / 2;
  victor=victor.multiply(v / 20.0);
  fishHook=from.getWorld().spawn(from,FishHook.class);
  fishHook.setShooter((ProjectileSource)npc.getEntity());
  fishHook.setVelocity(victor);
  PlayerAnimation.ARM_SWING.play((Player)npc.getEntity());
}

Fixed version (ground truth):
private void cast(){
  DenizenAPI.getDenizenNPC(npc).action("String_Node_Str",null);
  if (fishingLocation == null) {
    dB.echoError("String_Node_Str");
    return;
  }
  double v=34;
  double g=20;
  Location from=npc.getEntity().getLocation();
  from=from.add(0,.33,0);
  Location to=fishingLocation;
  Vector test=to.clone().subtract(from).toVector();
  Double elev=test.getY();
  Double testAngle=launchAngle(from,to,v,elev,g);
  if (testAngle == null) {
    return;
  }
  Double hangtime=hangtime(testAngle,v,elev,g);
  Vector victor=to.clone().subtract(from).toVector();
  Double dist=Math.sqrt(Math.pow(victor.getX(),2) + Math.pow(victor.getZ(),2));
  elev=victor.getY();
  if (dist == 0) {
    return;
  }
  Double launchAngle=launchAngle(from,to,v,elev,g);
  if (launchAngle == null) {
    return;
  }
  victor.setY(Math.tan(launchAngle) * dist);
  victor=normalizeVector(victor);
  v=v + (.5 * Math.pow(hangtime,2));
  v=v + (CoreUtilities.getRandom().nextDouble() - .8) / 2;
  victor=victor.multiply(v / 20.0);
  fishHook=NMSHandler.getInstance().getFishingHelper().spawnHook(from,(Player)npc.getEntity());
  fishHook.setShooter((ProjectileSource)npc.getEntity());
  fishHook.setVelocity(victor);
  PlayerAnimation.ARM_SWING.play((Player)npc.getEntity());
}
Program: 10161
Project: 10161
Buggy source:
@Override public void removeWorldAccess(World world){
  if (!worldAccessMap.containsKey(world)) {
    return;
  }
  WorldServer worldServer=((CraftWorld)world).getHandle();
  List<IWorldAccess> list=ReflectionHelper.getFieldValue(World.class,"String_Node_Str",worldServer);
  if (list != null) {
    list.remove(worldAccessMap.get(world));
  }
  worldAccessMap.remove(world);
}

Fixed version (ground truth):
@Override public void removeWorldAccess(World world){
  if (!worldAccessMap.containsKey(world)) {
    return;
  }
  net.minecraft.server.v1_10_R1.World nmsWorld=((CraftWorld)world).getHandle();
  List<IWorldAccess> list=ReflectionHelper.getFieldValue(net.minecraft.server.v1_10_R1.World.class,"String_Node_Str",nmsWorld);
  if (list != null) {
    list.remove(worldAccessMap.get(world));
  }
  worldAccessMap.remove(world);
}
Program: 10162
Project: 10162
Buggy source:
@Override public void removeWorldAccess(World world){
  if (!worldAccessMap.containsKey(world)) {
    return;
  }
  WorldServer worldServer=((CraftWorld)world).getHandle();
  List<IWorldAccess> list=ReflectionHelper.getFieldValue(World.class,"String_Node_Str",worldServer);
  if (list != null) {
    list.remove(worldAccessMap.get(world));
  }
  worldAccessMap.remove(world);
}

Fixed version (ground truth):
@Override public void removeWorldAccess(World world){
  if (!worldAccessMap.containsKey(world)) {
    return;
  }
  net.minecraft.server.v1_9_R2.World nmsWorld=((CraftWorld)world).getHandle();
  List<IWorldAccess> list=ReflectionHelper.getFieldValue(net.minecraft.server.v1_9_R2.World.class,"String_Node_Str",nmsWorld);
  if (list != null) {
    list.remove(worldAccessMap.get(world));
  }
  worldAccessMap.remove(world);
}
Program: 10163
Project: 10163
Buggy source:
@Override public void setStatic(World world,boolean isStatic){
  WorldServer worldServer=((CraftWorld)world).getHandle();
  ReflectionHelper.setFieldValue(worldServer.getClass(),"String_Node_Str",worldServer,isStatic);
}

Fixed version (ground truth):
@Override public void setStatic(World world,boolean isStatic){
  WorldServer worldServer=((CraftWorld)world).getHandle();
  ReflectionHelper.setFieldValue(net.minecraft.server.v1_10_R1.World.class,"String_Node_Str",worldServer,isStatic);
}
Program: 10164
Project: 10164
Buggy source:
public PacketOutSpawnEntity_v1_10_R1(Packet internal){
  this.internal=internal;
  Integer integer=ReflectionHelper.getFieldValue(internal.getClass(),"String_Node_Str",internal);
  entityId=integer != null ? integer : -1;
  entityUuid=ReflectionHelper.getFieldValue(internal.getClass(),"String_Node_Str",internal);
}

Fixed version (ground truth):
public PacketOutSpawnEntity_v1_10_R1(EntityPlayer player,Packet internal){
  this.internal=internal;
  Integer integer=ReflectionHelper.getFieldValue(internal.getClass(),"String_Node_Str",internal);
  entityId=integer != null ? integer : -1;
  if (!(internal instanceof PacketPlayOutSpawnEntityExperienceOrb)) {
    entityUuid=ReflectionHelper.getFieldValue(internal.getClass(),"String_Node_Str",internal);
  }
 else {
    EntityTracker tracker=((WorldServer)player.world).tracker;
    EntityTrackerEntry entry=tracker.trackedEntities.get(entityId);
    entityUuid=entry != null ? entry.b().getUniqueID() : null;
  }
}
Program: 10165
Project: 10165
Buggy source:
@Override public void setStatic(World world,boolean isStatic){
  WorldServer worldServer=((CraftWorld)world).getHandle();
  ReflectionHelper.setFieldValue(worldServer.getClass(),"String_Node_Str",worldServer,isStatic);
}

Fixed version (ground truth):
@Override public void setStatic(World world,boolean isStatic){
  WorldServer worldServer=((CraftWorld)world).getHandle();
  ReflectionHelper.setFieldValue(net.minecraft.server.v1_8_R3.World.class,"String_Node_Str",worldServer,isStatic);
}
Program: 10166
Project: 10166
Buggy source:
@Override public void setStatic(World world,boolean isStatic){
  WorldServer worldServer=((CraftWorld)world).getHandle();
  ReflectionHelper.setFieldValue(worldServer.getClass(),"String_Node_Str",worldServer,isStatic);
}

Fixed version (ground truth):
@Override public void setStatic(World world,boolean isStatic){
  WorldServer worldServer=((CraftWorld)world).getHandle();
  ReflectionHelper.setFieldValue(net.minecraft.server.v1_9_R2.World.class,"String_Node_Str",worldServer,isStatic);
}
Program: 10167
Project: 10167
Buggy source:
public PacketOutSpawnEntity_v1_9_R2(Packet internal){
  this.internal=internal;
  Integer integer=ReflectionHelper.getFieldValue(internal.getClass(),"String_Node_Str",internal);
  entityId=integer != null ? integer : -1;
  entityUuid=ReflectionHelper.getFieldValue(internal.getClass(),"String_Node_Str",internal);
}

Fixed version (ground truth):
public PacketOutSpawnEntity_v1_9_R2(EntityPlayer player,Packet internal){
  this.internal=internal;
  Integer integer=ReflectionHelper.getFieldValue(internal.getClass(),"String_Node_Str",internal);
  entityId=integer != null ? integer : -1;
  if (!(internal instanceof PacketPlayOutSpawnEntityExperienceOrb)) {
    entityUuid=ReflectionHelper.getFieldValue(internal.getClass(),"String_Node_Str",internal);
  }
 else {
    EntityTracker tracker=((WorldServer)player.world).tracker;
    EntityTrackerEntry entry=tracker.trackedEntities.get(entityId);
    entityUuid=entry != null ? entry.b().getUniqueID() : null;
  }
}
Program: 10168
Project: 10168
Buggy source:
@Override public void removeWorldAccess(World world){
  if (!worldAccessMap.containsKey(world)) {
    return;
  }
  WorldServer worldServer=((CraftWorld)world).getHandle();
  List<IWorldAccess> list=ReflectionHelper.getFieldValue(worldServer.getClass(),"String_Node_Str",worldServer);
  if (list != null) {
    list.remove(worldAccessMap.get(world));
  }
  worldAccessMap.remove(world);
}

Fixed version (ground truth):
@Override public void removeWorldAccess(World world){
  if (!worldAccessMap.containsKey(world)) {
    return;
  }
  WorldServer worldServer=((CraftWorld)world).getHandle();
  List<IWorldAccess> list=ReflectionHelper.getFieldValue(World.class,"String_Node_Str",worldServer);
  if (list != null) {
    list.remove(worldAccessMap.get(world));
  }
  worldAccessMap.remove(world);
}
Program: 10169
Project: 10169
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException {
  String direction=scriptEntry.hasObject("String_Node_Str") ? ((Element)scriptEntry.getObject("String_Node_Str")).asString() : null;
  Element typeElement=scriptEntry.getElement("String_Node_Str");
  dList text=(dList)scriptEntry.getObject("String_Node_Str");
  dLocation location=(dLocation)scriptEntry.getObject("String_Node_Str");
  dB.report(scriptEntry,getName(),typeElement.debug() + location.debug() + text.debug());
  Type type=Type.valueOf(typeElement.asString().toUpperCase());
  Block sign=location.getBlock();
  if (type != Type.AUTOMATIC || (sign.getType() != Material.WALL_SIGN && sign.getType() != Material.SIGN_POST)) {
    sign.setType(type == Type.WALL_SIGN ? Material.WALL_SIGN : Material.SIGN_POST);
  }
  BlockState signState=sign.getState();
  Utilities.setSignLines((Sign)signState,text.toArray(4));
  if (direction != null) {
    Utilities.setSignRotation(signState,direction);
  }
 else   if (type == Type.WALL_SIGN) {
    Utilities.setSignRotation(signState);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException {
  String direction=scriptEntry.hasObject("String_Node_Str") ? ((Element)scriptEntry.getObject("String_Node_Str")).asString() : null;
  Element typeElement=scriptEntry.getElement("String_Node_Str");
  dList text=(dList)scriptEntry.getObject("String_Node_Str");
  dLocation location=(dLocation)scriptEntry.getObject("String_Node_Str");
  dB.report(scriptEntry,getName(),typeElement.debug() + location.debug() + text.debug());
  Type type=Type.valueOf(typeElement.asString().toUpperCase());
  Block sign=location.getBlock();
  if (type != Type.AUTOMATIC || (sign.getType() != Material.WALL_SIGN && sign.getType() != Material.SIGN_POST)) {
    sign.setType(type == Type.WALL_SIGN ? Material.WALL_SIGN : Material.SIGN_POST,false);
  }
  BlockState signState=sign.getState();
  Utilities.setSignLines((Sign)signState,text.toArray(4));
  if (direction != null) {
    Utilities.setSignRotation(signState,direction);
  }
 else   if (type == Type.WALL_SIGN) {
    Utilities.setSignRotation(signState);
  }
}
Program: 10171
Project: 10171
Buggy source:
public void setTitle(String title){
  if (!getIdType().equals("String_Node_Str") || title == null) {
    return;
  }
 else   if (inventory == null) {
    inventory=Bukkit.getServer().createInventory(null,maxSlots,title);
    loadIdentifiers();
    return;
  }
  ItemStack[] contents=inventory.getContents();
  if (inventory.getType() == InventoryType.CHEST) {
    inventory=Bukkit.getServer().createInventory(null,inventory.getSize(),title);
  }
 else {
    inventory=Bukkit.getServer().createInventory(null,inventory.getType(),title);
  }
  inventory.setContents(contents);
  loadIdentifiers();
}

Fixed version (ground truth):
public void setTitle(String title){
  if (!(getIdType().equals("String_Node_Str") || getIdType().equals("String_Node_Str")) || title == null) {
    return;
  }
 else   if (inventory == null) {
    inventory=Bukkit.getServer().createInventory(null,maxSlots,title);
    loadIdentifiers();
    return;
  }
  ItemStack[] contents=inventory.getContents();
  if (inventory.getType() == InventoryType.CHEST) {
    inventory=Bukkit.getServer().createInventory(null,inventory.getSize(),title);
  }
 else {
    inventory=Bukkit.getServer().createInventory(null,inventory.getType(),title);
  }
  inventory.setContents(contents);
  loadIdentifiers();
}
Program: 10174
Project: 10174
Buggy source:
@EventHandler public void entityDamage(EntityDamageEvent event){
  Entity entity=event.getEntity();
  dPlayer pl=dEntity.getPlayerFrom(entity);
  if (pl == null) {
    return;
  }
  final Player player=pl.getPlayerEntity();
  final ItemStack[] oldArmor=player.getInventory().getArmorContents();
  new BukkitRunnable(){
    @Override public void run(){
      if (!player.isValid() || player.isDead()) {
        return;
      }
      ItemStack[] newArmor=player.getInventory().getArmorContents();
      for (int i=0; i < 4; i++) {
        ItemStack o=oldArmor[i].clone();
        ItemStack n=newArmor[i].clone();
        if (o != null) {
          o.setDurability((short)0);
          if (n != null) {
            n.setDurability((short)0);
          }
          if (n == null || !n.equals(o)) {
            if (playerUnequipsArmorEvent(player,o,"String_Node_Str")) {
              newArmor[i]=o;
            }
          }
        }
        player.getInventory().setArmorContents(newArmor);
      }
    }
  }
.runTaskLater(DenizenAPI.getCurrentInstance(),1);
}

Fixed version (ground truth):
@EventHandler public void entityDamage(EntityDamageEvent event){
  Entity entity=event.getEntity();
  dPlayer pl=dEntity.getPlayerFrom(entity);
  if (pl == null) {
    return;
  }
  final Player player=pl.getPlayerEntity();
  final ItemStack[] oldArmor=player.getInventory().getArmorContents();
  new BukkitRunnable(){
    @Override public void run(){
      if (!player.isValid() || player.isDead()) {
        return;
      }
      ItemStack[] newArmor=player.getInventory().getArmorContents();
      for (int i=0; i < 4; i++) {
        ItemStack o=oldArmor[i] == null ? null : oldArmor[i].clone();
        ItemStack n=newArmor[i] == null ? null : newArmor[i].clone();
        if (o != null) {
          o.setDurability((short)0);
          if (n != null) {
            n.setDurability((short)0);
          }
          if (n == null || !n.equals(o)) {
            if (playerUnequipsArmorEvent(player,o,"String_Node_Str")) {
              newArmor[i]=o;
            }
          }
        }
        player.getInventory().setArmorContents(newArmor);
      }
    }
  }
.runTaskLater(DenizenAPI.getCurrentInstance(),1);
}
Program: 10176
Project: 10176
Buggy source:
@Override public boolean matches(ScriptContainer scriptContainer,String s){
  if (entity.isValid() && entity.isLivingEntity()) {
    if (final_damage.asDouble() <= entity.getLivingEntity().getHealth()) {
      return false;
    }
  }
  String lower=CoreUtilities.toLowerCase(s);
  String cmd=CoreUtilities.getXthArg(1,lower);
  String arg0=CoreUtilities.getXthArg(0,lower);
  String arg2=CoreUtilities.getXthArg(2,lower);
  String arg3=CoreUtilities.getXthArg(3,lower);
  String attacker=cmd.equals("String_Node_Str") ? arg0 : arg2.equals("String_Node_Str") ? arg3 : "String_Node_Str";
  String target=cmd.equals("String_Node_Str") ? arg2 : arg0;
  if (attacker.length() > 0) {
    if (damager != null) {
      if (!damager.matchesEntity(attacker) && !cause.asString().equals(attacker)) {
        return false;
      }
    }
 else     if (!cause.asString().equals(attacker)) {
      return false;
    }
  }
  if (!entity.matchesEntity(target)) {
    return false;
  }
  return runInCheck(scriptContainer,s,lower,entity.getLocation());
}

Fixed version (ground truth):
@Override public boolean matches(ScriptContainer scriptContainer,String s){
  if (entity.isValid() && entity.isLivingEntity()) {
    if (final_damage.asDouble() < entity.getLivingEntity().getHealth()) {
      return false;
    }
  }
  String lower=CoreUtilities.toLowerCase(s);
  String cmd=CoreUtilities.getXthArg(1,lower);
  String arg0=CoreUtilities.getXthArg(0,lower);
  String arg2=CoreUtilities.getXthArg(2,lower);
  String arg3=CoreUtilities.getXthArg(3,lower);
  String attacker=cmd.equals("String_Node_Str") ? arg0 : arg2.equals("String_Node_Str") ? arg3 : "String_Node_Str";
  String target=cmd.equals("String_Node_Str") ? arg2 : arg0;
  if (attacker.length() > 0) {
    if (damager != null) {
      if (!damager.matchesEntity(attacker) && !cause.asString().equals(attacker)) {
        return false;
      }
    }
 else     if (!cause.asString().equals(attacker)) {
      return false;
    }
  }
  if (!entity.matchesEntity(target)) {
    return false;
  }
  return runInCheck(scriptContainer,s,lower,entity.getLocation());
}
Program: 10178
Project: 10178
Buggy source:
@Override public ScriptEntryData getScriptEntryData(){
  return new BukkitScriptEntryData(entity.isPlayer() ? dEntity.getPlayerFrom(event.getRemover()) : null,entity.isCitizensNPC() ? dEntity.getNPCFrom(event.getRemover()) : null);
}

Fixed version (ground truth):
@Override public ScriptEntryData getScriptEntryData(){
  return new BukkitScriptEntryData(entity.isPlayer() ? entity.getDenizenPlayer() : null,entity.isCitizensNPC() ? entity.getDenizenNPC() : null);
}
Program: 10179
Project: 10179
Buggy source:
@Override public boolean couldMatch(ScriptContainer scriptContainer,String s){
  return CoreUtilities.getXthArg(1,CoreUtilities.toLowerCase(s)).equals("String_Node_Str");
}

Fixed version (ground truth):
@Override public boolean couldMatch(ScriptContainer scriptContainer,String s){
  String lower=CoreUtilities.toLowerCase(s);
  return CoreUtilities.getXthArg(1,lower).equals("String_Node_Str") && !CoreUtilities.getXthArg(2,lower).equals("String_Node_Str");
}
Program: 10180
Project: 10180
Buggy source:
@Override public boolean matches(ScriptContainer scriptContainer,String s){
  String lower=CoreUtilities.toLowerCase(s);
  String hangCheck=CoreUtilities.getXthArg(0,lower);
  if (!hangCheck.equals("String_Node_Str") && hanging.matchesEntity(hangCheck)) {
    return false;
  }
  if (CoreUtilities.xthArgEquals(2,lower,"String_Node_Str")) {
    if (!CoreUtilities.getXthArg(3,lower).equals(CoreUtilities.toLowerCase(cause.asString()))) {
      return false;
    }
  }
  if (!runInCheck(scriptContainer,s,lower,location)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean matches(ScriptContainer scriptContainer,String s){
  String lower=CoreUtilities.toLowerCase(s);
  String hangCheck=CoreUtilities.getXthArg(0,lower);
  if (!hangCheck.equals("String_Node_Str") && !hanging.matchesEntity(hangCheck)) {
    return false;
  }
  if (CoreUtilities.xthArgEquals(2,lower,"String_Node_Str")) {
    if (!CoreUtilities.getXthArg(3,lower).equals(CoreUtilities.toLowerCase(cause.asString()))) {
      return false;
    }
  }
  if (!runInCheck(scriptContainer,s,lower,location)) {
    return false;
  }
  return true;
}
Program: 10181
Project: 10181
Buggy source:
@EventHandler public void onEntityDamaged(EntityDamageEvent event){
  entity=new dEntity(event.getEntity());
  damage=new Element(event.getDamage());
  final_damage=new Element(event.getFinalDamage());
  cause=new Element(event.getCause().name().toLowerCase());
  damager=null;
  projectile=null;
  held=null;
  if (event instanceof EntityDamageByEntityEvent) {
    damager=new dEntity(((EntityDamageByEntityEvent)event).getDamager());
    if (damager.isProjectile()) {
      projectile=damager;
      if (damager.hasShooter()) {
        damager=damager.getShooter();
      }
    }
    if (damager != null) {
      held=damager.getItemInHand();
      held.setAmount(1);
    }
  }
  cancelled=event.isCancelled();
  this.event=event;
  fire();
  event.setCancelled(cancelled);
  event.setDamage(damage.asDouble());
}

Fixed version (ground truth):
@EventHandler public void onEntityDamaged(EntityDamageEvent event){
  entity=new dEntity(event.getEntity());
  damage=new Element(event.getDamage());
  final_damage=new Element(event.getFinalDamage());
  cause=new Element(event.getCause().name().toLowerCase());
  damager=null;
  projectile=null;
  held=null;
  if (event instanceof EntityDamageByEntityEvent) {
    damager=new dEntity(((EntityDamageByEntityEvent)event).getDamager());
    if (damager.isProjectile()) {
      projectile=damager;
      if (damager.hasShooter()) {
        damager=damager.getShooter();
      }
    }
    if (damager != null) {
      held=damager.getItemInHand();
      if (held != null) {
        held.setAmount(1);
      }
    }
  }
  cancelled=event.isCancelled();
  this.event=event;
  fire();
  event.setCancelled(cancelled);
  event.setDamage(damage.asDouble());
}
Program: 10182
Project: 10182
Buggy source:
@Override public boolean matches(ScriptContainer scriptContainer,String s){
  String lower=CoreUtilities.toLowerCase(s);
  String cmd=CoreUtilities.getXthArg(1,lower);
  String attacker=cmd.equals("String_Node_Str") ? CoreUtilities.getXthArg(0,lower) : CoreUtilities.getXthArg(3,lower);
  String target=cmd.equals("String_Node_Str") ? CoreUtilities.getXthArg(2,lower) : CoreUtilities.getXthArg(0,lower);
  if (attacker.length() > 0) {
    if (damager != null) {
      boolean projectileMatched=false;
      if (projectile != null) {
        projectileMatched=projectile.matchesEntity(attacker);
      }
      if (!projectileMatched && !damager.matchesEntity(attacker) && !cause.asString().equals(attacker)) {
        return false;
      }
    }
 else {
      if (!cause.asString().equals(attacker)) {
        return false;
      }
    }
  }
  if (target.length() > 0) {
    if (!entity.matchesEntity(target)) {
      return false;
    }
  }
  if (!runInCheck(scriptContainer,s,lower,entity.getLocation())) {
    return false;
  }
  String with=getSwitch(s,"String_Node_Str");
  if (with != null) {
    dItem it=dItem.valueOf(with);
    if (it == null) {
      dB.echoError("String_Node_Str" + getName() + "String_Node_Str"+ s+ "String_Node_Str"+ scriptContainer.getName());
      return false;
    }
    if (!it.identify().equalsIgnoreCase(held.identify())) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean matches(ScriptContainer scriptContainer,String s){
  String lower=CoreUtilities.toLowerCase(s);
  String cmd=CoreUtilities.getXthArg(1,lower);
  String attacker=cmd.equals("String_Node_Str") ? CoreUtilities.getXthArg(0,lower) : CoreUtilities.getXthArg(3,lower);
  String target=cmd.equals("String_Node_Str") ? CoreUtilities.getXthArg(2,lower) : CoreUtilities.getXthArg(0,lower);
  if (attacker.length() > 0) {
    if (damager != null) {
      boolean projectileMatched=false;
      if (projectile != null) {
        projectileMatched=projectile.matchesEntity(attacker);
      }
      if (!projectileMatched && !damager.matchesEntity(attacker) && !cause.asString().equals(attacker)) {
        return false;
      }
    }
 else {
      if (!cause.asString().equals(attacker)) {
        return false;
      }
    }
  }
  if (target.length() > 0) {
    if (!entity.matchesEntity(target)) {
      return false;
    }
  }
  if (!runInCheck(scriptContainer,s,lower,entity.getLocation())) {
    return false;
  }
  String with=getSwitch(s,"String_Node_Str");
  if (with != null) {
    dItem it=dItem.valueOf(with);
    if (it == null) {
      dB.echoError("String_Node_Str" + getName() + "String_Node_Str"+ s+ "String_Node_Str"+ scriptContainer.getName());
      return false;
    }
    if (held == null || !it.identify().equalsIgnoreCase(held.identify())) {
      return false;
    }
  }
  return true;
}
Program: 10183
Project: 10183
Buggy source:
@EventHandler public void onBlockIgnites(BlockIgniteEvent event){
  location=new dLocation(event.getBlock().getLocation());
  material=dMaterial.getMaterialFrom(event.getBlock().getType(),event.getBlock().getData());
  if (event.getIgnitingEntity() != null) {
    entity=new dEntity(event.getIgnitingEntity());
  }
  if (event.getIgnitingBlock() != null) {
    origin_location=new dLocation(event.getIgnitingBlock().getLocation());
  }
  cause=new Element(event.getCause().toString());
  cancelled=event.isCancelled();
  this.event=event;
  fire();
  event.setCancelled(cancelled);
}

Fixed version (ground truth):
@EventHandler public void onBlockIgnites(BlockIgniteEvent event){
  location=new dLocation(event.getBlock().getLocation());
  material=dMaterial.getMaterialFrom(event.getBlock().getType(),event.getBlock().getData());
  entity=null;
  if (event.getIgnitingEntity() != null) {
    entity=new dEntity(event.getIgnitingEntity());
  }
  origin_location=null;
  if (event.getIgnitingBlock() != null) {
    origin_location=new dLocation(event.getIgnitingBlock().getLocation());
  }
  cause=new Element(event.getCause().toString());
  cancelled=event.isCancelled();
  this.event=event;
  fire();
  event.setCancelled(cancelled);
}
Program: 10184
Project: 10184
Buggy source:
@EventHandler public void onEntityDamaged(EntityDamageEvent event){
  entity=new dEntity(event.getEntity());
  damage=new Element(event.getDamage());
  final_damage=new Element(event.getFinalDamage());
  cause=new Element(event.getCause().name().toLowerCase());
  damager=null;
  if (event instanceof EntityDamageByEntityEvent) {
    damager=new dEntity(((EntityDamageByEntityEvent)event).getDamager());
    if (damager.isProjectile()) {
      projectile=damager;
      if (damager.hasShooter()) {
        damager=damager.getShooter();
      }
    }
  }
  cancelled=event.isCancelled();
  this.event=event;
  fire();
  event.setCancelled(cancelled);
  event.setDamage(damage.asDouble());
}

Fixed version (ground truth):
@EventHandler public void onEntityDamaged(EntityDamageEvent event){
  entity=new dEntity(event.getEntity());
  damage=new Element(event.getDamage());
  final_damage=new Element(event.getFinalDamage());
  cause=new Element(event.getCause().name().toLowerCase());
  damager=null;
  projectile=null;
  if (event instanceof EntityDamageByEntityEvent) {
    damager=new dEntity(((EntityDamageByEntityEvent)event).getDamager());
    if (damager.isProjectile()) {
      projectile=damager;
      if (damager.hasShooter()) {
        damager=damager.getShooter();
      }
    }
  }
  cancelled=event.isCancelled();
  this.event=event;
  fire();
  event.setCancelled(cancelled);
  event.setDamage(damage.asDouble());
}
Program: 10185
Project: 10185
Buggy source:
@EventHandler public void onEntityDeath(EntityDeathEvent event){
  entity=new dEntity(event.getEntity());
  dPlayer player=null;
  if (entity.isPlayer()) {
    player=entity.getDenizenPlayer();
  }
  EntityDamageEvent lastDamage=entity.getBukkitEntity().getLastDamageCause();
  if (lastDamage != null && lastDamage instanceof EntityDamageByEntityEvent) {
    damager=new dEntity(((EntityDamageByEntityEvent)lastDamage).getDamager());
  }
  message=null;
  PlayerDeathEvent subEvent=null;
  if (event instanceof PlayerDeathEvent) {
    subEvent=(PlayerDeathEvent)event;
    message=new Element(subEvent.getDeathMessage());
    if (player != null) {
      inventory=player.getInventory();
    }
  }
  if (event.getEntity().getLastDamageCause() != null) {
    cause=new Element(event.getEntity().getLastDamageCause().getCause().toString());
  }
  drops=new dList();
  for (  ItemStack stack : event.getDrops()) {
    if (stack == null) {
      drops.add("String_Node_Str");
    }
 else {
      drops.add(new dItem(stack).identify());
    }
  }
  changed_drops=false;
  xp=event.getDroppedExp();
  this.event=event;
  fire();
  event.setDroppedExp(xp);
  if (changed_drops) {
    for (    String drop : drops) {
      dItem item=dItem.valueOf(drop);
      if (item != null) {
        event.getDrops().add(item.getItemStack());
      }
    }
  }
  if (message != null) {
    subEvent.setDeathMessage(message.asString());
  }
}

Fixed version (ground truth):
@EventHandler public void onEntityDeath(EntityDeathEvent event){
  entity=new dEntity(event.getEntity());
  dPlayer player=null;
  if (entity.isPlayer()) {
    player=entity.getDenizenPlayer();
  }
  damager=null;
  EntityDamageEvent lastDamage=entity.getBukkitEntity().getLastDamageCause();
  if (lastDamage != null) {
    if (lastDamage instanceof EntityDamageByEntityEvent) {
      damager=new dEntity(((EntityDamageByEntityEvent)lastDamage).getDamager()).getDenizenObject();
    }
  }
  message=null;
  inventory=null;
  PlayerDeathEvent subEvent=null;
  if (event instanceof PlayerDeathEvent) {
    subEvent=(PlayerDeathEvent)event;
    message=new Element(subEvent.getDeathMessage());
    if (player != null) {
      inventory=player.getInventory();
    }
  }
  cause=null;
  if (event.getEntity().getLastDamageCause() != null) {
    cause=new Element(event.getEntity().getLastDamageCause().getCause().toString());
  }
  drops=new dList();
  for (  ItemStack stack : event.getDrops()) {
    if (stack == null) {
      drops.add("String_Node_Str");
    }
 else {
      drops.add(new dItem(stack).identify());
    }
  }
  changed_drops=false;
  xp=event.getDroppedExp();
  this.event=event;
  fire();
  event.setDroppedExp(xp);
  if (changed_drops) {
    event.getDrops().clear();
    for (    String drop : drops) {
      dItem item=dItem.valueOf(drop);
      if (item != null) {
        event.getDrops().add(item.getItemStack());
      }
    }
  }
  if (message != null) {
    subEvent.setDeathMessage(message.asString());
  }
}
Program: 10186
Project: 10186
Buggy source:
@EventHandler public void onEntityKilled(EntityDamageEvent event){
  entity=new dEntity(event.getEntity());
  damage=new Element(event.getDamage());
  final_damage=new Element(event.getFinalDamage());
  cause=new Element(event.getCause().name().toLowerCase());
  damager=null;
  if (event instanceof EntityDamageByEntityEvent) {
    damager=new dEntity(((EntityDamageByEntityEvent)event).getDamager());
    if (damager.isProjectile()) {
      projectile=damager;
      if (damager.hasShooter()) {
        damager=damager.getShooter();
      }
    }
  }
  cancelled=event.isCancelled();
  this.event=event;
  fire();
  event.setCancelled(cancelled);
  event.setDamage(damage.asDouble());
}

Fixed version (ground truth):
@EventHandler public void onEntityKilled(EntityDamageEvent event){
  entity=new dEntity(event.getEntity());
  damage=new Element(event.getDamage());
  final_damage=new Element(event.getFinalDamage());
  cause=new Element(event.getCause().name().toLowerCase());
  damager=null;
  projectile=null;
  if (event instanceof EntityDamageByEntityEvent) {
    damager=new dEntity(((EntityDamageByEntityEvent)event).getDamager());
    if (damager.isProjectile()) {
      projectile=damager;
      if (damager.hasShooter()) {
        damager=damager.getShooter();
      }
    }
  }
  cancelled=event.isCancelled();
  this.event=event;
  fire();
  event.setCancelled(cancelled);
  event.setDamage(damage.asDouble());
}
Program: 10187
Project: 10187
Buggy source:
public int getId(){
  return getCitizen().getId();
}

Fixed version (ground truth):
public int getId(){
  return npcid;
}
Program: 10188
Project: 10188
Buggy source:
public boolean isSpawned(){
  return getCitizen().isSpawned();
}

Fixed version (ground truth):
public boolean isSpawned(){
  NPC npc=CitizensAPI.getNPCRegistry().getById(npcid);
  return npc != null && npc.isSpawned();
}
Program: 10189
Project: 10189
Buggy source:
public void checkHeld(NavigationEvent e){
  if (e.getNPC() == null)   return;
  for (int i=0; i < WalkCommand.held.size(); i++) {
    ScriptEntry entry=WalkCommand.held.get(i);
    List<dNPC> tally=(List<dNPC>)entry.getObject("String_Node_Str");
    tally.remove(dNPC.mirrorCitizensNPC(e.getNPC()));
    if (tally.isEmpty()) {
      entry.setFinished(true);
      WalkCommand.held.remove(i);
      i--;
    }
  }
}

Fixed version (ground truth):
public void checkHeld(NavigationEvent e){
  if (e.getNPC() == null)   return;
  for (int i=0; i < WalkCommand.held.size(); i++) {
    ScriptEntry entry=WalkCommand.held.get(i);
    List<dNPC> tally=(List<dNPC>)entry.getObject("String_Node_Str");
    for (int x=0; x < tally.size(); x++) {
      if (!tally.get(x).isSpawned()) {
        tally.remove(x--);
      }
    }
    tally.remove(dNPC.mirrorCitizensNPC(e.getNPC()));
    if (tally.isEmpty()) {
      entry.setFinished(true);
      WalkCommand.held.remove(i);
      i--;
    }
  }
}
Program: 10191
Project: 10191
Buggy source:
public static GameProfile fillGameProfile(GameProfile gameProfile){
  if (gameProfile != null) {
    GameProfile gameProfile1;
    if (gameProfile.getName() != null) {
      gameProfile1=MinecraftServer.getServer().getUserCache().getProfile(gameProfile.getName());
    }
 else     if (gameProfile.getId() != null) {
      gameProfile1=MinecraftServer.getServer().getUserCache().a(gameProfile.getId());
    }
 else {
      gameProfile1=gameProfile;
    }
    if (Iterables.getFirst(gameProfile1.getProperties().get("String_Node_Str"),null) == null) {
      gameProfile1=MinecraftServer.getServer().aC().fillProfileProperties(gameProfile1,true);
    }
    return gameProfile1;
  }
  return null;
}

Fixed version (ground truth):
public static GameProfile fillGameProfile(GameProfile gameProfile){
  if (gameProfile != null) {
    GameProfile gameProfile1=null;
    if (gameProfile.getName() != null) {
      gameProfile1=MinecraftServer.getServer().getUserCache().getProfile(gameProfile.getName());
    }
    if (gameProfile1 == null) {
      gameProfile1=MinecraftServer.getServer().getUserCache().a(gameProfile.getId());
    }
    if (gameProfile1 == null) {
      gameProfile1=gameProfile;
    }
    if (Iterables.getFirst(gameProfile1.getProperties().get("String_Node_Str"),null) == null) {
      gameProfile1=MinecraftServer.getServer().aC().fillProfileProperties(gameProfile1,true);
    }
    return gameProfile1;
  }
  return null;
}
Program: 10192
Project: 10192
Buggy source:
/** 
 * Gets a dInventory from an Object, which can be a dEntity, dLocation, dInventory, or a dList of dItems
 * @param arg An argument to parse
 * @return The dInventory retrieved by parsing the argument
 */
public static dInventory getInventory(Argument arg,ScriptEntry scriptEntry){
  String string=arg.getValue();
  if (dInventory.matches(string)) {
    return dInventory.valueOf(string,((BukkitScriptEntryData)scriptEntry.getData()).getTagContext());
  }
 else   if (arg.matchesArgumentList(dItem.class)) {
    List<dItem> list=dList.valueOf(string).filter(dItem.class);
    ItemStack[] items=convertItems(list).toArray(new ItemStack[list.size()]);
    dInventory inventory=new dInventory(dInventory.maxSlots);
    inventory.setContents(items);
    return inventory;
  }
 else   if (dLocation.matches(string)) {
    return dLocation.valueOf(string).getInventory();
  }
 else   if (dEntity.matches(string)) {
    return dEntity.valueOf(string).getInventory();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets a dInventory from an Object, which can be a dEntity, dLocation, dInventory, or a dList of dItems
 * @param arg An argument to parse
 * @return The dInventory retrieved by parsing the argument
 */
public static dInventory getInventory(Argument arg,ScriptEntry scriptEntry){
  String string=arg.getValue();
  if (dInventory.matches(string)) {
    BukkitScriptEntryData data=(BukkitScriptEntryData)scriptEntry.getData();
    if (data != null)     return dInventory.valueOf(string,((BukkitScriptEntryData)scriptEntry.getData()).getTagContext());
 else     return dInventory.valueOf(string);
  }
 else   if (arg.matchesArgumentList(dItem.class)) {
    List<dItem> list=dList.valueOf(string).filter(dItem.class,scriptEntry);
    ItemStack[] items=convertItems(list).toArray(new ItemStack[list.size()]);
    dInventory inventory=new dInventory(dInventory.maxSlots);
    inventory.setContents(items);
    return inventory;
  }
 else   if (dLocation.matches(string)) {
    return dLocation.valueOf(string).getInventory();
  }
 else   if (dEntity.matches(string)) {
    return dEntity.valueOf(string).getInventory();
  }
  return null;
}
Program: 10193
Project: 10193
Buggy source:
public dList flags(){
}

Fixed version (ground truth):
public dList flags(){
  dList output=new dList();
  for (  ItemFlag flag : item.getItemStack().getItemMeta().getItemFlags()) {
    output.add(flag.name());
  }
  return output;
}