nus-yam/ex-repair huggingface dataset:
Program: 133988
Project: 133988
Buggy source:
public static boolean isEarthbendable(Player player,String ability,Block block){
  Material material=block.getType();
  boolean valid=false;
  for (  String s : config.getStringList("String_Node_Str"))   if (material == Material.getMaterial(s)) {
    valid=true;
    break;
  }
  if (isMetal(block) && canMetalbend(player)) {
    valid=true;
  }
  if (!valid)   return false;
  if (tempNoEarthbending.contains(block))   return false;
  if (!GeneralMethods.isRegionProtectedFromBuild(player,ability,block.getLocation()))   return true;
  return false;
}

Fixed version (ground truth):
public static boolean isEarthbendable(Player player,String ability,Block block){
  Material material=block.getType();
  boolean valid=false;
  for (  String s : config.getStringList("String_Node_Str"))   if (material == Material.getMaterial(s)) {
    valid=true;
    break;
  }
  if (isMetal(block) && canMetalbend(player)) {
    valid=true;
  }
  if (tempNoEarthbending.contains(block))   valid=false;
  if (GeneralMethods.isRegionProtectedFromBuild(player,ability,block.getLocation()))   valid=false;
  return valid;
}
Program: 133989
Project: 133989
Buggy source:
/** 
 * Finds a valid Earth source for a Player. To use dynamic source selection, use BlockSource.getEarthSourceBlock() instead of this method. Dynamic source selection saves the user's previous source for future use.  {@link BlockSource#getEarthSourceBlock(Player,double,com.projectkorra.projectkorra.util.ClickType)}
 * @param player the player that is attempting to Earthbend.
 * @param range the maximum block selection range.
 * @return a valid Earth source block, or null if one could not be found.
 */
@SuppressWarnings("String_Node_Str") public static Block getEarthSourceBlock(Player player,double range){
  Block testblock=player.getTargetBlock(getTransparentEarthbending(),(int)range);
  if (isEarthbendable(player,testblock))   return testblock;
  Location location=player.getEyeLocation();
  Vector vector=location.getDirection().clone().normalize();
  for (double i=0; i <= range; i++) {
    Block block=location.clone().add(vector.clone().multiply(i)).getBlock();
    if (GeneralMethods.isRegionProtectedFromBuild(player,"String_Node_Str",location))     continue;
    if (isEarthbendable(player,block)) {
      return block;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Finds a valid Earth source for a Player. To use dynamic source selection, use BlockSource.getEarthSourceBlock() instead of this method. Dynamic source selection saves the user's previous source for future use.  {@link BlockSource#getEarthSourceBlock(Player,double,com.projectkorra.projectkorra.util.ClickType)}
 * @param player the player that is attempting to Earthbend.
 * @param range the maximum block selection range.
 * @return a valid Earth source block, or null if one could not be found.
 */
@SuppressWarnings("String_Node_Str") public static Block getEarthSourceBlock(Player player,double range){
  Block testblock=player.getTargetBlock(getTransparentEarthbending(),(int)range);
  if (isEarthbendable(player,testblock) || isMetalbendable(player,testblock.getType()))   return testblock;
  Location location=player.getEyeLocation();
  Vector vector=location.getDirection().clone().normalize();
  for (double i=0; i <= range; i++) {
    Block block=location.clone().add(vector.clone().multiply(i)).getBlock();
    if (GeneralMethods.isRegionProtectedFromBuild(player,"String_Node_Str",location))     continue;
    if (isEarthbendable(player,block)) {
      return block;
    }
  }
  return null;
}
Program: 133991
Project: 133991
Buggy source:
/** 
 * Switches the Sand Material and Gravel to SandStone and stone respectively, since gravel and sand cannot be bent due to gravity.
 */
public Material selectMaterialForRepresenter(Material mat){
  Material tempMat=selectMaterial(mat);
  Random rand=new Random();
  if (!isEarthbendableMaterial(tempMat)) {
    if (currentBlocks.size() < 1)     return Material.DIRT;
 else     return currentBlocks.get(rand.nextInt(currentBlocks.size())).getType();
  }
  return tempMat;
}

Fixed version (ground truth):
/** 
 * Switches the Sand Material and Gravel to SandStone and stone respectively, since gravel and sand cannot be bent due to gravity.
 */
public Material selectMaterialForRepresenter(Material mat){
  Material tempMat=selectMaterial(mat);
  Random rand=new Random();
  if (!EarthMethods.isEarthbendable(tempMat) || !EarthMethods.isMetalbendable(player,tempMat)) {
    if (currentBlocks.size() < 1)     return Material.DIRT;
 else     return currentBlocks.get(rand.nextInt(currentBlocks.size())).getType();
  }
  return tempMat;
}
Program: 133993
Project: 133993
Buggy source:
public ChiCombo(Player player,String ability){
  if (!enabled)   return;
  if (ability.equalsIgnoreCase("String_Node_Str")) {
    if (!GeneralMethods.canBend(player.getName(),"String_Node_Str") || GeneralMethods.getBendingPlayer(player).isOnCooldown("String_Node_Str"))     return;
 else {
      this.player=player;
      target=GeneralMethods.getTargetedEntity(player,5,new ArrayList<Entity>());
      paralyze(target,IMMOBILIZE_DURATION);
      instances.add(this);
      GeneralMethods.getBendingPlayer(player).addCooldown("String_Node_Str",IMMOBILIZE_COOLDOWN);
    }
  }
}

Fixed version (ground truth):
public ChiCombo(Player player,String ability){
  if (!enabled)   return;
  if (ability.equalsIgnoreCase("String_Node_Str")) {
    if (!GeneralMethods.canBend(player.getName(),"String_Node_Str") || GeneralMethods.getBendingPlayer(player).isOnCooldown("String_Node_Str"))     return;
 else {
      target=GeneralMethods.getTargetedEntity(player,5,new ArrayList<Entity>());
      paralyze(target,IMMOBILIZE_DURATION);
      instances.add(this);
      GeneralMethods.getBendingPlayer(player).addCooldown("String_Node_Str",IMMOBILIZE_COOLDOWN);
    }
  }
}
Program: 133995
Project: 133995
Buggy source:
private void focusBlock(){
  if (EarthPassive.isPassiveSand(sourceblock))   EarthPassive.revertSand(sourceblock);
  if (sourceblock.getType() == Material.SAND) {
    sourcetype=Material.SAND;
    if (sourceblock.getData() == (byte)0x1) {
      sourceblock.setType(Material.RED_SANDSTONE);
    }
 else {
      sourceblock.setType(Material.SANDSTONE);
    }
  }
 else   if (sourceblock.getType() == Material.STONE) {
    sourceblock.setType(Material.COBBLESTONE);
    sourcetype=Material.STONE;
  }
 else {
    sourcetype=sourceblock.getType();
    sourceblock.setType(Material.STONE);
  }
  location=sourceblock.getLocation();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void focusBlock(){
  if (EarthPassive.isPassiveSand(sourceblock))   EarthPassive.revertSand(sourceblock);
  if (sourceblock.getType() == Material.SAND) {
    sourcetype=Material.SAND;
    if (sourceblock.getData() == (byte)0x1) {
      sourceblock.setType(Material.RED_SANDSTONE);
    }
 else {
      sourceblock.setType(Material.SANDSTONE);
    }
  }
 else   if (sourceblock.getType() == Material.STONE) {
    sourceblock.setType(Material.COBBLESTONE);
    sourcetype=Material.STONE;
  }
 else {
    sourcetype=sourceblock.getType();
    sourceblock.setType(Material.STONE);
  }
  location=sourceblock.getLocation();
}
Program: 133996
Project: 133996
Buggy source:
private void unfocusBlock(){
  if (destination != null) {
    breakBlock();
    return;
  }
  if (sourceblock.getType() == Material.SAND) {
    if (sourceblock.getData() == (byte)0x1) {
      sourceblock.setType(sourcetype);
      sourceblock.setData((byte)0x1);
    }
 else {
      sourceblock.setType(sourcetype);
    }
  }
 else {
    sourceblock.setType(sourcetype);
  }
  instances.remove(id);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void unfocusBlock(){
  if (destination != null) {
    breakBlock();
    return;
  }
  if (sourceblock.getType() == Material.SAND) {
    if (sourceblock.getData() == (byte)0x1) {
      sourceblock.setType(sourcetype);
      sourceblock.setData((byte)0x1);
    }
 else {
      sourceblock.setType(sourcetype);
    }
  }
 else {
    sourceblock.setType(sourcetype);
  }
  instances.remove(id);
}
Program: 133999
Project: 133999
Buggy source:
public static void revertSand(Block block){
  MaterialData materialdata=sandidentities.get(block);
  sandidentities.remove(block);
  sandblocks.remove(block);
  if (block.getType() == Material.SAND) {
    block.setType(materialdata.getItemType());
    block.setData(materialdata.getData());
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static void revertSand(Block block){
  MaterialData materialdata=sandidentities.get(block);
  sandidentities.remove(block);
  sandblocks.remove(block);
  if (block.getType() == Material.SAND) {
    block.setType(materialdata.getItemType());
    block.setData(materialdata.getData());
  }
}
Program: 134000
Project: 134000
Buggy source:
@SuppressWarnings("String_Node_Str") public static void handlePassive(){
  for (  Player player : Bukkit.getServer().getOnlinePlayers()) {
    String ability=GeneralMethods.getBoundAbility(player);
    if (GeneralMethods.canBendPassive(player.getName(),Element.Water)) {
      if (WaterSpout.instances.containsKey(player) || EarthArmor.instances.containsKey(player)) {
        continue;
      }
 else       if (ability == null || !AbilityModuleManager.shiftabilities.contains(ability)) {
        if (player.isSneaking() && WaterMethods.isWater(player.getLocation().getBlock())) {
          player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(swimFactor));
        }
      }
    }
  }
}

Fixed version (ground truth):
public static void handlePassive(){
  for (  Player player : Bukkit.getServer().getOnlinePlayers()) {
    String ability=GeneralMethods.getBoundAbility(player);
    if (GeneralMethods.canBendPassive(player.getName(),Element.Water)) {
      if (WaterSpout.instances.containsKey(player) || EarthArmor.instances.containsKey(player)) {
        continue;
      }
 else       if (ability == null || !AbilityModuleManager.shiftabilities.contains(ability)) {
        if (player.isSneaking() && WaterMethods.isWater(player.getLocation().getBlock())) {
          player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(swimFactor));
        }
      }
    }
  }
}
Program: 134001
Project: 134001
Buggy source:
public WaterSpout(Player player){
  if (instances.containsKey(player)) {
    instances.get(player).remove();
    return;
  }
  this.player=player;
  WaterWave wwave=new WaterWave(player,WaterWave.AbilityType.CLICK);
  if (WaterWave.instances.contains(wwave))   return;
  Block topBlock=GeneralMethods.getTopBlock(player.getLocation(),0,-50);
  if (topBlock == null)   topBlock=player.getLocation().getBlock();
  Material mat=topBlock.getType();
  if (mat != Material.WATER && mat != Material.STATIONARY_WATER && mat != Material.ICE && mat != Material.PACKED_ICE && mat != Material.SNOW && mat != Material.SNOW_BLOCK)   return;
  new Flight(player);
  player.setAllowFlight(true);
  instances.put(player,this);
  spout(player);
}

Fixed version (ground truth):
public WaterSpout(Player player){
  if (instances.containsKey(player)) {
    instances.get(player).remove();
    return;
  }
  this.player=player;
  this.canBendOnPackedIce=ProjectKorra.plugin.getConfig().getBoolean("String_Node_Str");
  WaterWave wwave=new WaterWave(player,WaterWave.AbilityType.CLICK);
  if (WaterWave.instances.contains(wwave))   return;
  Block topBlock=GeneralMethods.getTopBlock(player.getLocation(),0,-50);
  if (topBlock == null)   topBlock=player.getLocation().getBlock();
  Material mat=topBlock.getType();
  if (mat != Material.WATER && mat != Material.STATIONARY_WATER && mat != Material.ICE && mat != Material.PACKED_ICE && mat != Material.SNOW && mat != Material.SNOW_BLOCK)   return;
  if (mat == Material.PACKED_ICE && !canBendOnPackedIce)   return;
  new Flight(player);
  player.setAllowFlight(true);
  instances.put(player,this);
  spout(player);
}
Program: 134005
Project: 134005
Buggy source:
public Catapult(Player player,Catapult source){
  this.player=player;
  flying=true;
  moving=false;
  location=source.location.clone();
  direction=source.direction.clone();
  distance=source.distance;
  putInstance(player,this);
  EarthMethods.playEarthbendingSound(player.getLocation());
  fly();
}

Fixed version (ground truth):
public Catapult(Player player,Catapult source){
  this.player=player;
  reloadVariables();
  flying=true;
  moving=false;
  location=source.location.clone();
  direction=source.direction.clone();
  distance=source.distance;
  putInstance(player,this);
  EarthMethods.playEarthbendingSound(player.getLocation());
  fly();
}
Program: 134006
Project: 134006
Buggy source:
public boolean progress(){
  if (player.isDead() || !player.isOnline()) {
    remove();
    return false;
  }
  if (moving)   if (!moveEarth()) {
    moving=false;
  }
  if (flying)   fly();
  if (!flying && !moving)   remove();
  return true;
}

Fixed version (ground truth):
@Override public boolean progress(){
  if (player.isDead() || !player.isOnline()) {
    remove();
    return false;
  }
  if (moving)   if (!moveEarth()) {
    moving=false;
  }
  if (flying)   fly();
  if (!flying && !moving)   remove();
  return true;
}
Program: 134007
Project: 134007
Buggy source:
/** 
 * Gets latest plugin version.
 * @return Latest plugin version, or null if it cannot connect
 */
public String getUpdateVersion(){
  if (document != null) {
    Node latestFile=document.getElementsByTagName("String_Node_Str").item(0);
    NodeList children=latestFile.getChildNodes();
    String version=children.item(1).getTextContent();
    return version;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets latest plugin version.
 * @return Latest plugin version, or null if it cannot connect
 */
public String getUpdateVersion(){
  if (document != null) {
    Node latestFile=document.getElementsByTagName("String_Node_Str").item(0);
    NodeList children=latestFile.getChildNodes();
    String version=children.item(1).getTextContent();
    return version.toUpperCase();
  }
  return null;
}
Program: 134010
Project: 134010
Buggy source:
/** 
 * Sets the   {@link BendingPlayer}'s abilities. This method also saves the abilities to the database.
 * @param abilities The abilities to set/save
 */
public void setAbilities(HashMap<Integer,String> abilities){
  this.abilities=abilities;
  for (int i=1; i <= 9; i++) {
    DBConnection.sql.modifyQuery("String_Node_Str" + i + "String_Node_Str"+ (abilities.get(i) == null ? null : abilities.get(i))+ "String_Node_Str"+ uuid+ "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Sets the   {@link BendingPlayer}'s abilities. This method also saves the abilities to the database.
 * @param abilities The abilities to set/save
 */
public void setAbilities(HashMap<Integer,String> abilities){
  this.abilities=abilities;
  for (int i=1; i <= 9; i++) {
    DBConnection.sql.modifyQuery("String_Node_Str" + i + "String_Node_Str"+ abilities.get(i)+ "String_Node_Str"+ uuid+ "String_Node_Str");
  }
}
Program: 134012
Project: 134012
Buggy source:
public static void reloadPlugin(){
  ProjectKorra.log.info("String_Node_Str");
  BendingReloadEvent event=new BendingReloadEvent();
  Bukkit.getServer().getPluginManager().callEvent(event);
  if (DBConnection.isOpen) {
    DBConnection.sql.close();
  }
  GeneralMethods.stopBending();
  ConfigManager.defaultConfig.reload();
  ConfigManager.deathMsgConfig.reload();
  BendingManager.getInstance().reloadVariables();
  new AbilityModuleManager(plugin);
  new ComboManager();
  new MultiAbilityModuleManager();
  DBConnection.host=plugin.getConfig().getString("String_Node_Str");
  DBConnection.port=plugin.getConfig().getInt("String_Node_Str");
  DBConnection.pass=plugin.getConfig().getString("String_Node_Str");
  DBConnection.db=plugin.getConfig().getString("String_Node_Str");
  DBConnection.user=plugin.getConfig().getString("String_Node_Str");
  DBConnection.init();
  if (!DBConnection.isOpen()) {
    ProjectKorra.log.severe("String_Node_Str");
    stopPlugin();
  }
  for (  Player player : Bukkit.getOnlinePlayers()) {
    GeneralMethods.createBendingPlayer(player.getUniqueId(),player.getName());
    Preset.loadPresets(player);
  }
  plugin.updater.checkUpdate();
  ProjectKorra.log.info("String_Node_Str");
}

Fixed version (ground truth):
public static void reloadPlugin(){
  ProjectKorra.log.info("String_Node_Str");
  BendingReloadEvent event=new BendingReloadEvent();
  Bukkit.getServer().getPluginManager().callEvent(event);
  if (DBConnection.isOpen) {
    DBConnection.sql.close();
  }
  GeneralMethods.stopBending();
  ConfigManager.defaultConfig.reload();
  ConfigManager.deathMsgConfig.reload();
  BendingManager.getInstance().reloadVariables();
  new AbilityModuleManager(plugin);
  new ComboManager();
  new MultiAbilityModuleManager();
  DBConnection.host=plugin.getConfig().getString("String_Node_Str");
  DBConnection.port=plugin.getConfig().getInt("String_Node_Str");
  DBConnection.pass=plugin.getConfig().getString("String_Node_Str");
  DBConnection.db=plugin.getConfig().getString("String_Node_Str");
  DBConnection.user=plugin.getConfig().getString("String_Node_Str");
  DBConnection.init();
  if (!DBConnection.isOpen()) {
    ProjectKorra.log.severe("String_Node_Str");
    stopPlugin();
  }
  for (  Player player : Bukkit.getOnlinePlayers()) {
    GeneralMethods.createBendingPlayer(player.getUniqueId(),player.getName());
  }
  plugin.updater.checkUpdate();
  ProjectKorra.log.info("String_Node_Str");
}
Program: 134014
Project: 134014
Buggy source:
@Override public void execute(CommandSender sender,List<String> args){
  if (!hasPermission(sender)) {
    return;
  }
 else   if (args.size() > 0) {
    help(sender,false);
    return;
  }
  if (ProjectKorra.plugin.updater.updateAvailable()) {
    sender.sendMessage(ChatColor.GREEN + "String_Node_Str" + ChatColor.GOLD+ "String_Node_Str"+ ChatColor.GREEN+ "String_Node_Str");
    sender.sendMessage(ChatColor.YELLOW + "String_Node_Str" + ChatColor.RED+ ProjectKorra.plugin.updater.getCurrentVersion());
    sender.sendMessage(ChatColor.YELLOW + "String_Node_Str" + ChatColor.GOLD+ ProjectKorra.plugin.updater.getCurrentVersion());
  }
 else {
    sender.sendMessage(ChatColor.YELLOW + "String_Node_Str" + ChatColor.GOLD+ "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void execute(CommandSender sender,List<String> args){
  if (!hasPermission(sender)) {
    return;
  }
 else   if (args.size() > 0) {
    help(sender,false);
    return;
  }
  if (ProjectKorra.plugin.updater.updateAvailable()) {
    sender.sendMessage(ChatColor.GREEN + "String_Node_Str" + ChatColor.GOLD+ "String_Node_Str"+ ChatColor.GREEN+ "String_Node_Str");
    sender.sendMessage(ChatColor.YELLOW + "String_Node_Str" + ChatColor.RED+ ProjectKorra.plugin.updater.getCurrentVersion());
    sender.sendMessage(ChatColor.YELLOW + "String_Node_Str" + ChatColor.GOLD+ ProjectKorra.plugin.updater.getUpdateVersion());
  }
 else {
    sender.sendMessage(ChatColor.YELLOW + "String_Node_Str" + ChatColor.GOLD+ "String_Node_Str");
  }
}
Program: 134017
Project: 134017
Buggy source:
/** 
 * Checks if the CommandSender is an instance of a Player. If not, it tells them they must be a Player to use the command.
 * @param sender The CommandSender to check
 * @return True if sender instanceof Player, false otherwise
 */
protected boolean isPlayer(CommandSender sender){
  if (sender instanceof Player)   return true;
 else {
    sender.sendMessage(ChatColor.RED + "String_Node_Str");
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks if the CommandSender is an instance of a Player. If not, it tells them they must be a Player to use the command.
 * @param sender The CommandSender to check
 * @return True if sender instanceof Player, false otherwise
 */
protected boolean isPlayer(CommandSender sender){
  if (sender instanceof Player) {
    return true;
  }
 else {
    sender.sendMessage(ChatColor.RED + "String_Node_Str");
    return false;
  }
}
Program: 134018
Project: 134018
Buggy source:
public void help(CommandSender sender,boolean description){
  sender.sendMessage(ChatColor.GOLD + "String_Node_Str" + ChatColor.DARK_AQUA+ properUse);
  if (description)   sender.sendMessage(ChatColor.YELLOW + this.description);
}

Fixed version (ground truth):
public void help(CommandSender sender,boolean description){
  sender.sendMessage(ChatColor.GOLD + "String_Node_Str" + ChatColor.DARK_AQUA+ properUse);
  if (description) {
    sender.sendMessage(ChatColor.YELLOW + this.description);
  }
}
Program: 134019
Project: 134019
Buggy source:
/** 
 * Checks if the   {@link CommandSender} has permission to execute thecommand. The permission is in the format 'bending.command. {@link PKCommand#name name}.extra'. If not, they are told so.
 * @param sender The CommandSender to check
 * @param extra The additional node to check
 * @return True if they have permission, false otherwise
 */
protected boolean hasPermission(CommandSender sender,String extra){
  if (sender.hasPermission("String_Node_Str" + name + "String_Node_Str"+ extra))   return true;
 else {
    sender.sendMessage(ChatColor.RED + "String_Node_Str");
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks if the   {@link CommandSender} has permission to execute thecommand. The permission is in the format 'bending.command. {@link PKCommand#name name}.extra'. If not, they are told so.
 * @param sender The CommandSender to check
 * @param extra The additional node to check
 * @return True if they have permission, false otherwise
 */
protected boolean hasPermission(CommandSender sender,String extra){
  if (sender.hasPermission("String_Node_Str" + name + "String_Node_Str"+ extra)) {
    return true;
  }
 else {
    sender.sendMessage(ChatColor.RED + "String_Node_Str");
    return false;
  }
}
Program: 134020
Project: 134020
Buggy source:
/** 
 * Checks if the argument length is within certain parameters, and if not, informs the CommandSender of how to correctly use the command.
 * @param sender The CommandSender who issued the command
 * @param size The length of the arguments list
 * @param min The minimum acceptable number of arguments
 * @param max The maximum acceptable number of arguments
 * @return True if min < size < max, false otherwise
 */
protected boolean correctLength(CommandSender sender,int size,int min,int max){
  if (size < min || size > max) {
    help(sender,false);
    return false;
  }
 else   return true;
}

Fixed version (ground truth):
/** 
 * Checks if the argument length is within certain parameters, and if not, informs the CommandSender of how to correctly use the command.
 * @param sender The CommandSender who issued the command
 * @param size The length of the arguments list
 * @param min The minimum acceptable number of arguments
 * @param max The maximum acceptable number of arguments
 * @return True if min < size < max, false otherwise
 */
protected boolean correctLength(CommandSender sender,int size,int min,int max){
  if (size < min || size > max) {
    help(sender,false);
    return false;
  }
 else {
    return true;
  }
}
Program: 134022
Project: 134022
Buggy source:
/** 
 * Saves the Preset to the database.
 */
public void save(){
  try {
    PreparedStatement ps=DBConnection.sql.getConnection().prepareStatement(loadNameQuery);
    ps.setString(1,uuid.toString());
    ps.setString(2,name);
    ResultSet rs=ps.executeQuery();
    if (!rs.next()) {
      ps=DBConnection.sql.getConnection().prepareStatement(insertQuery);
      ps.setString(1,uuid.toString());
      ps.setString(2,name);
      ps.execute();
    }
  }
 catch (  SQLException e) {
    e.printStackTrace();
  }
  for (  Integer i : abilities.keySet()) {
    new BukkitRunnable(){
      PreparedStatement ps;
      @Override public void run(){
        try {
          ps=DBConnection.sql.getConnection().prepareStatement(updateQuery1 + i + updateQuery2);
          ps.setString(1,abilities.get(i));
          ps.setString(2,uuid.toString());
          ps.setString(3,name);
          ps.execute();
        }
 catch (        SQLException e) {
          e.printStackTrace();
        }
      }
    }
.runTaskAsynchronously(ProjectKorra.plugin);
  }
}

Fixed version (ground truth):
/** 
 * Saves the Preset to the database.
 */
public void save(){
  try {
    PreparedStatement ps=DBConnection.sql.getConnection().prepareStatement(loadNameQuery);
    ps.setString(1,uuid.toString());
    ps.setString(2,name);
    ResultSet rs=ps.executeQuery();
    if (!rs.next()) {
      ps=DBConnection.sql.getConnection().prepareStatement(insertQuery);
      ps.setString(1,uuid.toString());
      ps.setString(2,name);
      ps.execute();
    }
  }
 catch (  SQLException e) {
    e.printStackTrace();
  }
  for (  final Integer i : abilities.keySet()) {
    new BukkitRunnable(){
      PreparedStatement ps;
      @Override public void run(){
        try {
          ps=DBConnection.sql.getConnection().prepareStatement(updateQuery1 + i + updateQuery2);
          ps.setString(1,abilities.get(i));
          ps.setString(2,uuid.toString());
          ps.setString(3,name);
          ps.execute();
        }
 catch (        SQLException e) {
          e.printStackTrace();
        }
      }
    }
.runTaskAsynchronously(ProjectKorra.plugin);
  }
}
Program: 134024
Project: 134024
Buggy source:
/** 
 * Logs and update message in console.  Displays different messages dependent on   {@link #updateAvailable()}
 */
public void checkUpdate(){
  if (getUpdateVersion() == null)   return;
 else   if (updateAvailable()) {
    plugin.getLogger().info("String_Node_Str");
    plugin.getLogger().info("String_Node_Str" + getCurrentVersion());
    plugin.getLogger().info("String_Node_Str" + getUpdateVersion());
  }
 else {
    plugin.getLogger().info("String_Node_Str" + pluginName);
  }
}

Fixed version (ground truth):
/** 
 * Logs and update message in console.  Displays different messages dependent on   {@link #updateAvailable()}
 */
public void checkUpdate(){
  if (getUpdateVersion() == null) {
    return;
  }
 else   if (updateAvailable()) {
    plugin.getLogger().info("String_Node_Str");
    plugin.getLogger().info("String_Node_Str" + getCurrentVersion());
    plugin.getLogger().info("String_Node_Str" + getUpdateVersion());
  }
 else {
    plugin.getLogger().info("String_Node_Str" + pluginName);
  }
}
Program: 134025
Project: 134025
Buggy source:
/** 
 * Checks to see if an update is available.
 * @return true If there is an update
 */
public boolean updateAvailable(){
  String updateVersion=getUpdateVersion();
  if (updateVersion == null || currentVersion.equalsIgnoreCase(getUpdateVersion())) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks to see if an update is available.
 * @return true If there is an update
 */
public boolean updateAvailable(){
  String updateVersion=getUpdateVersion();
  if (updateVersion == null) {
    return false;
  }
  int currentNumber=Integer.parseInt(currentVersion.substring(0,5).replaceAll("String_Node_Str","String_Node_Str"));
  int updateNumber=Integer.parseInt(updateVersion.substring(0,5).replaceAll("String_Node_Str","String_Node_Str"));
  if (updateNumber == currentNumber) {
    if (currentVersion.contains("String_Node_Str") && updateVersion.contains("String_Node_Str")) {
      int currentBeta=Integer.parseInt(currentVersion.substring(currentVersion.lastIndexOf("String_Node_Str") + 1));
      int updateBeta=Integer.parseInt(updateVersion.substring(updateVersion.lastIndexOf("String_Node_Str") + 1));
      if (currentBeta == updateBeta || currentBeta > updateBeta) {
        return false;
      }
    }
 else     if (!currentVersion.contains("String_Node_Str") && updateVersion.contains("String_Node_Str")) {
      return false;
    }
  }
 else   if (currentVersion.equalsIgnoreCase(updateVersion) || currentNumber > updateNumber) {
    return false;
  }
  return true;
}
Program: 134026
Project: 134026
Buggy source:
/** 
 * Adds an   {@link AbilityInformation} to the player's {@link ComboManager#recentlyUsedAbilities recentlyUsedAbilities}.
 * @param player The player to add the AbilityInformation for
 * @param info The AbilityInformation to add
 */
public static void addRecentAbility(Player player,AbilityInformation info){
  ArrayList<AbilityInformation> list;
  String name=player.getName();
  if (recentlyUsedAbilities.containsKey(name))   list=recentlyUsedAbilities.get(name);
 else   list=new ArrayList<AbilityInformation>();
  list.add(info);
  recentlyUsedAbilities.put(name,list);
}

Fixed version (ground truth):
/** 
 * Adds an   {@link AbilityInformation} to the player's{@link ComboManager#recentlyUsedAbilities recentlyUsedAbilities}.
 * @param player The player to add the AbilityInformation for
 * @param info The AbilityInformation to add
 */
public static void addRecentAbility(Player player,AbilityInformation info){
  ArrayList<AbilityInformation> list;
  String name=player.getName();
  if (recentlyUsedAbilities.containsKey(name))   list=recentlyUsedAbilities.get(name);
 else   list=new ArrayList<AbilityInformation>();
  list.add(info);
  recentlyUsedAbilities.put(name,list);
}
Program: 134027
Project: 134027
Buggy source:
/** 
 * Gets the player's most recently used abilities, up to a maximum of 10.
 * @param player The player to get recent abilities for
 * @param amount The amount of recent abilities to get, starting from most recent and getting older
 * @return An ArrayList<{@link AbilityInformation}> of the player's recently used abilities
 */
public static ArrayList<AbilityInformation> getRecentlyUsedAbilities(Player player,int amount){
  String name=player.getName();
  if (!recentlyUsedAbilities.containsKey(name))   return new ArrayList<AbilityInformation>();
  ArrayList<AbilityInformation> list=recentlyUsedAbilities.get(name);
  if (list.size() < amount)   return new ArrayList<AbilityInformation>(list);
  ArrayList<AbilityInformation> tempList=new ArrayList<AbilityInformation>();
  for (int i=0; i < amount; i++)   tempList.add(0,list.get(list.size() - 1 - i));
  return tempList;
}

Fixed version (ground truth):
/** 
 * Gets the player's most recently used abilities, up to a maximum of 10.
 * @param player The player to get recent abilities for
 * @param amount The amount of recent abilities to get, starting from mostrecent and getting older
 * @return An ArrayList<{@link AbilityInformation}> of the player's recently used abilities
 */
public static ArrayList<AbilityInformation> getRecentlyUsedAbilities(Player player,int amount){
  String name=player.getName();
  if (!recentlyUsedAbilities.containsKey(name))   return new ArrayList<AbilityInformation>();
  ArrayList<AbilityInformation> list=recentlyUsedAbilities.get(name);
  if (list.size() < amount)   return new ArrayList<AbilityInformation>(list);
  ArrayList<AbilityInformation> tempList=new ArrayList<AbilityInformation>();
  for (int i=0; i < amount; i++)   tempList.add(0,list.get(list.size() - 1 - i));
  return tempList;
}
Program: 134028
Project: 134028
Buggy source:
public static void cleanupOldCombos(){
  Enumeration<String> keys=recentlyUsedAbilities.keys();
  while (keys.hasMoreElements()) {
    String name=keys.nextElement();
    ArrayList<AbilityInformation> usedAbilities=recentlyUsedAbilities.get(name);
    ArrayList<AbilityInformation> stillValidAbilities=new ArrayList<AbilityInformation>();
    recentlyUsedAbilities.remove(name);
    for (    AbilityInformation info : usedAbilities) {
      if (System.currentTimeMillis() - info.getTime() <= CLEANUP_DELAY) {
        stillValidAbilities.add(info);
      }
    }
    if (stillValidAbilities.size() > 0)     recentlyUsedAbilities.put(name,stillValidAbilities);
  }
}

Fixed version (ground truth):
public static void cleanupOldCombos(){
  Enumeration<String> keys=recentlyUsedAbilities.keys();
  while (keys.hasMoreElements()) {
    String name=keys.nextElement();
    ArrayList<AbilityInformation> usedAbilities=recentlyUsedAbilities.get(name);
    usedAbilities.clear();
  }
}
Program: 134029
Project: 134029
Buggy source:
public static void startCleanupTask(){
  new BukkitRunnable(){
    public void run(){
      cleanupOldCombos();
    }
  }
.runTaskTimer(ProjectKorra.plugin,0,CLEANUP_DELAY / 1000 * 20);
}

Fixed version (ground truth):
public static void startCleanupTask(){
  new BukkitRunnable(){
    public void run(){
      cleanupOldCombos();
    }
  }
.runTaskTimer(ProjectKorra.plugin,0,CLEANUP_DELAY);
}
Program: 134030
Project: 134030
Buggy source:
/** 
 * Checks if a Player's   {@link ComboManager#recentlyUsedAbilities recentlyUsedAbilities}contains a valid set of moves to perform any combos. If it does, it returns the valid combo.
 * @param player The player for whom to check if a valid combo has been performed
 * @return The ComboAbility of the combo that has been performed, or null if no valid combo was found
 */
public static ComboAbility checkForValidCombo(Player player){
  ArrayList<AbilityInformation> playerCombo=getRecentlyUsedAbilities(player,8);
  for (  ComboAbility customAbility : comboAbilityList) {
    ArrayList<AbilityInformation> abilityCombo=customAbility.getAbilities();
    int size=abilityCombo.size();
    if (playerCombo.size() < size)     continue;
    boolean isValid=true;
    for (int i=1; i <= size; i++) {
      if (!playerCombo.get(playerCombo.size() - i).equalsWithoutTime(abilityCombo.get(abilityCombo.size() - i))) {
        isValid=false;
        break;
      }
    }
    if (isValid)     return customAbility;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Checks if a Player's   {@link ComboManager#recentlyUsedAbilities recentlyUsedAbilities} contains a valid set of moves to perform anycombos. If it does, it returns the valid combo.
 * @param player The player for whom to check if a valid combo has beenperformed
 * @return The ComboAbility of the combo that has been performed, or null ifno valid combo was found
 */
public static ComboAbility checkForValidCombo(Player player){
  ArrayList<AbilityInformation> playerCombo=getRecentlyUsedAbilities(player,8);
  for (  ComboAbility customAbility : comboAbilityList) {
    ArrayList<AbilityInformation> abilityCombo=customAbility.getAbilities();
    int size=abilityCombo.size();
    if (playerCombo.size() < size)     continue;
    boolean isValid=true;
    for (int i=1; i <= size; i++) {
      if (!playerCombo.get(playerCombo.size() - i).equalsWithoutTime(abilityCombo.get(abilityCombo.size() - i))) {
        isValid=false;
        break;
      }
    }
    if (isValid)     return customAbility;
  }
  return null;
}
Program: 134031
Project: 134031
Buggy source:
/** 
 * Gets latest plugin version.
 * @return Latest plugin version
 */
public String getUpdateVersion(){
  Node latestFile=document.getElementsByTagName("String_Node_Str").item(0);
  NodeList children=latestFile.getChildNodes();
  String version=children.item(1).getTextContent();
  return version;
}

Fixed version (ground truth):
/** 
 * Gets latest plugin version.
 * @return Latest plugin version, or null if it cannot connect
 */
public String getUpdateVersion(){
  if (document != null) {
    Node latestFile=document.getElementsByTagName("String_Node_Str").item(0);
    NodeList children=latestFile.getChildNodes();
    String version=children.item(1).getTextContent();
    return version;
  }
  return null;
}
Program: 134032
Project: 134032
Buggy source:
/** 
 * Creates a new instance of Updater. This constructor should only be called inside of   {@code plugin.onEnable()} or called after the plugin is loaded.<br><br> This constructor should NEVER be called to initiate a field. If called to initiate a field, Updater will throw NullPointerExceptions
 * @param plugin Plugin to check updates for
 * @param URL RSS feed URL link to check for updates on.
 */
public Updater(Plugin plugin,String URL){
  this.plugin=plugin;
  try {
    url=new URL(URL);
    urlc=url.openConnection();
    urlc.setRequestProperty("String_Node_Str","String_Node_Str");
    document=DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(urlc.getInputStream());
  }
 catch (  IOException|SAXException|ParserConfigurationException e) {
    e.printStackTrace();
  }
  this.currentVersion=plugin.getDescription().getVersion();
  this.pluginName=plugin.getDescription().getName();
}

Fixed version (ground truth):
/** 
 * Creates a new instance of Updater. This constructor should only be called inside of   {@code plugin.onEnable()} or called after the plugin is loaded.<br><br> This constructor should NEVER be called to initiate a field. If called to initiate a field, Updater will throw NullPointerExceptions
 * @param plugin Plugin to check updates for
 * @param URL RSS feed URL link to check for updates on.
 */
public Updater(Plugin plugin,String URL){
  this.plugin=plugin;
  try {
    url=new URL(URL);
    urlc=url.openConnection();
    urlc.setRequestProperty("String_Node_Str","String_Node_Str");
    document=DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(urlc.getInputStream());
  }
 catch (  UnknownHostException e) {
    plugin.getLogger().info("String_Node_Str");
  }
catch (  IOException|SAXException|ParserConfigurationException e) {
    e.printStackTrace();
  }
  this.currentVersion=plugin.getDescription().getVersion();
  this.pluginName=plugin.getDescription().getName();
}
Program: 134033
Project: 134033
Buggy source:
/** 
 * Logs and update message in console.  Displays different messages dependent on   {@link #updateAvailable()}
 */
public void checkUpdate(){
  if (updateAvailable()) {
    plugin.getLogger().info("String_Node_Str");
    plugin.getLogger().info("String_Node_Str" + getCurrentVersion());
    plugin.getLogger().info("String_Node_Str" + getUpdateVersion());
  }
 else {
    plugin.getLogger().info("String_Node_Str" + pluginName);
  }
}

Fixed version (ground truth):
/** 
 * Logs and update message in console.  Displays different messages dependent on   {@link #updateAvailable()}
 */
public void checkUpdate(){
  if (getUpdateVersion() == null)   return;
 else   if (updateAvailable()) {
    plugin.getLogger().info("String_Node_Str");
    plugin.getLogger().info("String_Node_Str" + getCurrentVersion());
    plugin.getLogger().info("String_Node_Str" + getUpdateVersion());
  }
 else {
    plugin.getLogger().info("String_Node_Str" + pluginName);
  }
}
Program: 134034
Project: 134034
Buggy source:
/** 
 * Checks to see if an update is available.
 * @return true If there is an update
 */
public boolean updateAvailable(){
  if (currentVersion.equalsIgnoreCase(getUpdateVersion())) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks to see if an update is available.
 * @return true If there is an update
 */
public boolean updateAvailable(){
  String updateVersion=getUpdateVersion();
  if (updateVersion == null || currentVersion.equalsIgnoreCase(getUpdateVersion())) {
    return false;
  }
  return true;
}
Program: 134035
Project: 134035
Buggy source:
public static boolean isSolid(Block block){
  return Arrays.asList(nonOpaque).contains(block.getTypeId());
}

Fixed version (ground truth):
public static boolean isSolid(Block block){
  return !Arrays.asList(nonOpaque).contains(block.getTypeId());
}
Program: 134037
Project: 134037
Buggy source:
@Override public void reloadVariables(){
  speed=config.get().getDouble("String_Node_Str");
  defaultrange=config.get().getDouble("String_Node_Str");
  affectingradius=config.get().getDouble("String_Node_Str");
  defaultpushfactor=config.get().getDouble("String_Node_Str");
  maxspeed=1. / defaultpushfactor;
  range=defaultrange;
  pushfactor=defaultpushfactor;
}

Fixed version (ground truth):
@Override public void reloadVariables(){
  speed=config.get().getDouble("String_Node_Str");
  defaultrange=config.get().getDouble("String_Node_Str");
  affectingradius=config.get().getDouble("String_Node_Str");
  defaultpushfactor=config.get().getDouble("String_Node_Str");
  flickLevers=config.get().getBoolean("String_Node_Str");
  openDoors=config.get().getBoolean("String_Node_Str");
  pressButtons=config.get().getBoolean("String_Node_Str");
  coolLava=config.get().getBoolean("String_Node_Str");
  maxspeed=1. / defaultpushfactor;
  range=defaultrange;
  pushfactor=defaultpushfactor;
}
Program: 134040
Project: 134040
Buggy source:
public void dealDamage(Entity entity){
  if (explosion == null)   return;
  double distance=entity.getLocation().distance(explosion.getLocation());
  if (distance > explosionradius)   return;
  if (distance < innerradius) {
    GeneralMethods.damageEntity(player,entity,maxdamage);
    return;
  }
  double slope=-(maxdamage * .5) / (explosionradius - innerradius);
  double damage=slope * (distance - innerradius) + maxdamage;
  GeneralMethods.damageEntity(player,entity,damage);
  AirMethods.breakBreathbendingHold(entity);
}

Fixed version (ground truth):
public void dealDamage(Entity entity){
  if (explosion == null)   return;
  double distance=entity.getLocation().distance(explosion.getLocation());
  if (distance > damageradius)   return;
  if (distance < innerradius) {
    GeneralMethods.damageEntity(player,entity,maxdamage);
    return;
  }
  double slope=-(maxdamage * .5) / (damageradius - innerradius);
  double damage=slope * (distance - innerradius) + maxdamage;
  GeneralMethods.damageEntity(player,entity,damage);
  AirMethods.breakBreathbendingHold(entity);
}
Program: 134041
Project: 134041
Buggy source:
public void explode(){
  boolean explode=true;
  for (  Block block : GeneralMethods.getBlocksAroundPoint(location,3)) {
    if (GeneralMethods.isRegionProtectedFromBuild(player,"String_Node_Str",block.getLocation())) {
      explode=false;
      break;
    }
  }
  if (explode) {
    explosion=player.getWorld().spawn(location,TNTPrimed.class);
    explosion.setFuseTicks(0);
    float yield=(float)power;
    if (!AvatarState.isAvatarState(player)) {
      if (FireMethods.isDay(player.getWorld())) {
        FireMethods.getFirebendingDayAugment(yield,player.getWorld());
      }
 else {
        yield*=1.;
      }
    }
 else {
      yield*=AvatarState.factor;
    }
    explosion.setYield(yield);
    explosions.put(explosion,this);
  }
  ignite(location);
  remove();
}

Fixed version (ground truth):
public void explode(){
  boolean explode=true;
  for (  Block block : GeneralMethods.getBlocksAroundPoint(location,3)) {
    if (GeneralMethods.isRegionProtectedFromBuild(player,"String_Node_Str",block.getLocation())) {
      explode=false;
      break;
    }
  }
  if (explode) {
    if (damage_blocks && explosionradius > 0) {
      explosion=player.getWorld().spawn(location,TNTPrimed.class);
      explosion.setFuseTicks(0);
      float yield=(float)explosionradius;
      if (!AvatarState.isAvatarState(player)) {
        if (FireMethods.isDay(player.getWorld())) {
          yield=(float)FireMethods.getFirebendingDayAugment(yield,player.getWorld());
        }
      }
 else {
        yield*=AvatarState.factor;
      }
      explosion.setYield(yield);
      explosions.put(explosion,this);
    }
 else {
      List<Entity> l=GeneralMethods.getEntitiesAroundPoint(location,damageradius);
      for (      Entity e : l) {
        if (e instanceof LivingEntity) {
          double slope=-(maxdamage * .5) / (damageradius - innerradius);
          double damage=slope * (e.getLocation().distance(location) - innerradius) + maxdamage;
          GeneralMethods.damageEntity(getPlayer(),e,damage);
        }
      }
      location.getWorld().playSound(location,Sound.EXPLODE,5,1);
      ParticleEffect.EXPLOSION_HUGE.display(new Vector(0,0,0),0,location,256);
    }
  }
  ignite(location);
  remove();
}
Program: 134042
Project: 134042
Buggy source:
private void fireball(){
  for (  Block block : GeneralMethods.getBlocksAroundPoint(location,radius)) {
    ParticleEffect.FLAME.display(block.getLocation(),0.6F,0.6F,0.6F,0,5);
    ParticleEffect.SMOKE.display(block.getLocation(),0.6F,0.6F,0.6F,0,2);
    if (GeneralMethods.rand.nextInt(4) == 0) {
      FireMethods.playFirebendingSound(location);
    }
  }
  for (  Entity entity : GeneralMethods.getEntitiesAroundPoint(location,2 * radius)) {
    if (entity.getEntityId() == player.getEntityId())     continue;
    entity.setFireTicks((int)(fireticks * 20));
    if (entity instanceof LivingEntity) {
      explode();
      dealDamage(entity);
      return;
    }
  }
}

Fixed version (ground truth):
private void fireball(){
  for (  Block block : GeneralMethods.getBlocksAroundPoint(location,radius)) {
    ParticleEffect.FLAME.display(block.getLocation(),0.6F,0.6F,0.6F,0,5);
    ParticleEffect.SMOKE.display(block.getLocation(),0.6F,0.6F,0.6F,0,2);
    if (GeneralMethods.rand.nextInt(4) == 0) {
      FireMethods.playFirebendingSound(location);
    }
  }
  boolean exploded=false;
  for (  Entity entity : GeneralMethods.getEntitiesAroundPoint(location,2 * radius)) {
    if (entity.getEntityId() == player.getEntityId())     continue;
    entity.setFireTicks((int)(fireticks * 20));
    if (entity instanceof LivingEntity) {
      if (!exploded) {
        explode();
        exploded=true;
      }
      dealDamage(entity);
    }
  }
}
Program: 134043
Project: 134043
Buggy source:
@Override public void reloadVariables(){
  defaultchargetime=config.get().getLong("String_Node_Str");
  interval=25;
  radius=1.5;
  MAX_DAMAGE=config.get().getDouble("String_Node_Str");
  DAMAGE_RADIUS=config.get().getDouble("String_Node_Str");
  RANGE=config.get().getDouble("String_Node_Str");
  POWER=config.get().getDouble("String_Node_Str");
  fireticks=config.get().getDouble("String_Node_Str");
  maxdamage=MAX_DAMAGE;
  range=RANGE;
  explosionradius=DAMAGE_RADIUS;
  power=POWER;
  chargetime=defaultchargetime;
}

Fixed version (ground truth):
@Override public void reloadVariables(){
  defaultchargetime=config.get().getLong("String_Node_Str");
  interval=25;
  radius=1.5;
  MAX_DAMAGE=config.get().getDouble("String_Node_Str");
  DAMAGE_RADIUS=config.get().getDouble("String_Node_Str");
  RANGE=config.get().getDouble("String_Node_Str");
  DAMAGEBLOCKS=config.get().getBoolean("String_Node_Str");
  EXPLOSIONRADIUS=config.get().getDouble("String_Node_Str");
  fireticks=config.get().getDouble("String_Node_Str");
  maxdamage=MAX_DAMAGE;
  range=RANGE;
  damageradius=DAMAGE_RADIUS;
  explosionradius=EXPLOSIONRADIUS;
  damage_blocks=DAMAGEBLOCKS;
  chargetime=defaultchargetime;
}
Program: 134044
Project: 134044
Buggy source:
/** 
 * Creates a LavaBlock and also accounts for melting over plants by creating new Plantbending() objects. It also appends the TempBlock to our arraylist called TEMP_LAVA_BLOCKS. If ALLOW_NATURAL_FLOW is turned on then this method will remove the block from TempBlock.instances, which will allow the lava to flow naturally.
 * @param block the block that will be turned to lava
 */
public void createLava(Block block){
  boolean valid=false;
  if (!isEarthbendableMaterial(block.getType(),player) && WaterMethods.isPlant(block)) {
    new Plantbending(block);
    block.setType(Material.AIR);
    valid=true;
  }
 else   if (isEarthbendableMaterial(block.getType(),player))   valid=true;
  if (valid) {
    TempBlock tblock=new TempBlock(block,Material.STATIONARY_LAVA,(byte)0);
    TEMP_LAVA_BLOCKS.add(tblock);
    affectedBlocks.add(tblock);
    if (allowNaturalFlow)     TempBlock.instances.remove(block);
  }
}

Fixed version (ground truth):
/** 
 * Creates a LavaBlock and appends the TempBlock to our arraylist called TEMP_LAVA_BLOCKS. If ALLOW_NATURAL_FLOW is turned on then this method will remove the block from TempBlock.instances, which will allow the lava to flow naturally.
 * @param block the block that will be turned to lava
 */
public void createLava(Block block){
  if (isEarthbendableMaterial(block.getType(),player)) {
    TempBlock tblock=new TempBlock(block,Material.STATIONARY_LAVA,(byte)0);
    TEMP_LAVA_BLOCKS.add(tblock);
    affectedBlocks.add(tblock);
    if (allowNaturalFlow)     TempBlock.instances.remove(block);
  }
}