nus-yam/ex-repair huggingface dataset:
Program: 133830
Project: 133830
Buggy source:
public WaterSpout(Player player){
  super(player);
  WaterSpout oldSpout=getAbility(player,WaterSpout.class);
  if (oldSpout != null) {
    oldSpout.remove();
    return;
  }
  this.canBendOnPackedIce=getConfig().getBoolean("String_Node_Str");
  this.useParticles=getConfig().getBoolean("String_Node_Str");
  this.useBlockSpiral=getConfig().getBoolean("String_Node_Str");
  this.height=getConfig().getDouble("String_Node_Str");
  this.interval=getConfig().getLong("String_Node_Str");
  hadFly=player.isFlying();
  canFly=player.getAllowFlight();
  maxHeight=getNightFactor(height);
  WaterSpoutWave spoutWave=new WaterSpoutWave(player,WaterSpoutWave.AbilityType.CLICK);
  if (spoutWave.isStarted() && !spoutWave.isRemoved()) {
    return;
  }
  Block topBlock=GeneralMethods.getTopBlock(player.getLocation(),(int)-getNightFactor(height),(int)-getNightFactor(height));
  if (topBlock == null) {
    topBlock=player.getLocation().getBlock();
  }
  if (!isWater(topBlock) && !isIcebendable(topBlock) && !isSnow(topBlock)) {
    return;
  }
 else   if (topBlock.getType() == Material.PACKED_ICE && !canBendOnPackedIce) {
    return;
  }
  double heightRemoveThreshold=2;
  if (!isWithinMaxSpoutHeight(topBlock.getLocation(),heightRemoveThreshold)) {
    return;
  }
  new Flight(player);
  player.setAllowFlight(true);
  start();
}

Fixed version (ground truth):
public WaterSpout(Player player){
  super(player);
  WaterSpout oldSpout=getAbility(player,WaterSpout.class);
  if (oldSpout != null) {
    oldSpout.remove();
    return;
  }
  this.canBendOnPackedIce=getConfig().getBoolean("String_Node_Str");
  this.useParticles=getConfig().getBoolean("String_Node_Str");
  this.useBlockSpiral=getConfig().getBoolean("String_Node_Str");
  this.height=getConfig().getDouble("String_Node_Str");
  this.interval=getConfig().getLong("String_Node_Str");
  hadFly=player.isFlying();
  canFly=player.getAllowFlight();
  maxHeight=getNightFactor(height);
  WaterSpoutWave spoutWave=new WaterSpoutWave(player,WaterSpoutWave.AbilityType.CLICK);
  if (spoutWave.isStarted() && !spoutWave.isRemoved()) {
    return;
  }
  Block topBlock=GeneralMethods.getTopBlock(player.getLocation(),(int)-getNightFactor(height),(int)-getNightFactor(height));
  if (topBlock == null) {
    topBlock=player.getLocation().getBlock();
  }
  if (!isWater(topBlock) && !isIcebendable(topBlock) && !isSnow(topBlock)) {
    return;
  }
 else   if (topBlock.getType() == Material.PACKED_ICE && !canBendOnPackedIce) {
    return;
  }
  double heightRemoveThreshold=2;
  if (!isWithinMaxSpoutHeight(topBlock.getLocation(),heightRemoveThreshold)) {
    return;
  }
  new Flight(player);
  player.setAllowFlight(true);
  spoutableWaterHeight(player.getLocation());
  start();
}
Program: 133831
Project: 133831
Buggy source:
private void getGround(){
  for (int i=0; i <= 5; i++) {
    Block block=loc.getBlock().getRelative(BlockFace.DOWN,i);
    if (isEarthbendable(block)) {
      groundBlock=block;
      blockType=block.getType();
      return;
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void getGround(){
  for (int i=0; i <= 5; i++) {
    Block block=loc.getBlock().getRelative(BlockFace.DOWN,i);
    if (isEarthbendable(block)) {
      groundBlock=block;
      blockType=block.getType();
      blockByte=block.getData();
      return;
    }
  }
}
Program: 133832
Project: 133832
Buggy source:
public EarthGrab(Player player){
  super(player);
  this.selectRange=getConfig().getDouble("String_Node_Str");
  this.height=getConfig().getDouble("String_Node_Str");
  this.cooldown=getConfig().getLong("String_Node_Str");
  this.origin=player.getEyeLocation();
  this.direction=origin.getDirection();
  this.lowestDistance=selectRange + 1;
  this.closestEntity=null;
  this.startLoc=player.getLocation();
  this.loc=player.getLocation();
  this.dir=player.getLocation().getDirection();
  this.random=new Random();
  if (!bPlayer.canBend(this)) {
    return;
  }
  if (player.isSneaking()) {
    start();
  }
  Location targetLocation=GeneralMethods.getTargetedLocation(player,1);
  Block block=GeneralMethods.getTopBlock(targetLocation,1);
  if (isEarthbendable(block) && block.getLocation().distance(player.getLocation()) <= 2) {
    earthGrabSelf();
    remove();
  }
}

Fixed version (ground truth):
public EarthGrab(Player player){
  super(player);
  this.selectRange=getConfig().getDouble("String_Node_Str");
  this.height=getConfig().getDouble("String_Node_Str");
  this.cooldown=getConfig().getLong("String_Node_Str");
  this.origin=player.getEyeLocation();
  this.direction=origin.getDirection();
  this.lowestDistance=selectRange + 1;
  this.closestEntity=null;
  this.startLoc=player.getLocation();
  this.loc=player.getLocation();
  this.dir=player.getLocation().getDirection().clone().normalize().multiply(1.5);
  this.random=new Random();
  if (!bPlayer.canBend(this)) {
    return;
  }
  if (player.isSneaking()) {
    start();
  }
 else {
    Location targetLocation=GeneralMethods.getTargetedLocation(player,1);
    Block block=GeneralMethods.getTopBlock(targetLocation,1,1);
    if (isEarthbendable(block) && block.getLocation().distance(player.getLocation()) <= 1.3) {
      earthGrabSelf();
      remove();
    }
  }
}
Program: 133833
Project: 133833
Buggy source:
@Override public void progress(){
  getGround();
  bPlayer.addCooldown(this);
  if (groundBlock == null) {
    remove();
    return;
  }
  dir=player.getLocation().getDirection().clone().normalize().multiply(1.5);
  dir.setY(0);
  double distance=loc.getY() - (double)groundBlock.getY();
  double dx=Math.abs(distance - 2.4);
  if (distance > 1.75) {
    dir.setY(-.50 * dx * dx);
  }
 else   if (distance < 1) {
    dir.setY(.50 * dx * dx);
  }
 else {
    dir.setY(0);
  }
  loc.add(dir);
  ParticleEffect.BLOCK_CRACK.display((ParticleEffect.ParticleData)new ParticleEffect.BlockData(blockType,(byte)0),1F,0.1F,1F,0.1F,100,loc.add(0,-1,0),500);
  if (player.isDead() || !player.isOnline()) {
    remove();
    return;
  }
  if (!player.isSneaking()) {
    remove();
    return;
  }
  if (loc.distance(startLoc) >= selectRange) {
    remove();
    return;
  }
  for (  Entity e : GeneralMethods.getEntitiesAroundPoint(loc,2.5)) {
    if (e.getEntityId() != player.getEntityId() && e instanceof LivingEntity) {
      closestEntity=e;
      formDome();
      remove();
      return;
    }
  }
  if (random.nextInt(2) == 0) {
    playEarthbendingSound(loc);
  }
}

Fixed version (ground truth):
@Override public void progress(){
  getGround();
  bPlayer.addCooldown(this);
  if (groundBlock == null) {
    remove();
    return;
  }
  dir=dir.clone().normalize().multiply(1.5);
  dir.setY(0);
  double distance=loc.getY() - (double)groundBlock.getY();
  double dx=Math.abs(distance - 2.4);
  if (distance > 1.75) {
    dir.setY(-.50 * dx * dx);
  }
 else   if (distance < 1) {
    dir.setY(.50 * dx * dx);
  }
 else {
    dir.setY(0);
  }
  loc.add(dir);
  ParticleEffect.BLOCK_CRACK.display((ParticleEffect.ParticleData)new ParticleEffect.BlockData(blockType,blockByte),1F,0.1F,1F,0.1F,100,loc.add(0,-1,0),500);
  if (player.isDead() || !player.isOnline()) {
    remove();
    return;
  }
  if (!player.isSneaking()) {
    remove();
    return;
  }
  if (loc.distance(startLoc) >= selectRange) {
    remove();
    return;
  }
  for (  Entity e : GeneralMethods.getEntitiesAroundPoint(loc,2.5)) {
    if (e.getEntityId() != player.getEntityId() && e instanceof LivingEntity) {
      closestEntity=e;
      formDome();
      remove();
      return;
    }
  }
  if (random.nextInt(2) == 0) {
    playEarthbendingSound(loc);
  }
}
Program: 133835
Project: 133835
Buggy source:
public static void stopBending(){
  BlazeArc.removeAllCleanup();
  for (  Location loc : TEMP_FIRE.keySet()) {
    revertTempFire(loc);
  }
}

Fixed version (ground truth):
public static void stopBending(){
  BlazeArc.removeAllCleanup();
  HeatControlSolidify.revertAllInstances();
  for (  Location loc : TEMP_FIRE.keySet()) {
    revertTempFire(loc);
  }
}
Program: 133836
Project: 133836
Buggy source:
@Override public void remove(){
  ProjectKorra.plugin.getServer().getScheduler().scheduleSyncDelayedTask(ProjectKorra.plugin,new Runnable(){
    @Override public void run(){
      revertAll();
      HeatControlSolidify.super.remove();
    }
  }
,revertTime);
}

Fixed version (ground truth):
@Override public void remove(){
  if (Bukkit.getServer().getPluginManager().isPluginEnabled(ProjectKorra.plugin.getName())) {
    revert();
  }
 else {
    HeatControlSolidify.super.remove();
  }
}
Program: 133837
Project: 133837
Buggy source:
public void progress(){
  if (!bPlayer.canBendIgnoreCooldowns(this)) {
    remove();
    return;
  }
  if (player.isDead() || !player.isOnline()) {
    remove();
    return;
  }
  if (!charging) {
    if (elements.isEmpty()) {
      remove();
      return;
    }
    advanceSwipe();
  }
 else {
    if (!player.isSneaking()) {
      double factor=1;
      if (System.currentTimeMillis() >= getStartTime() + maxChargeTime) {
        factor=maxChargeFactor;
      }
 else       if (bPlayer.isAvatarState()) {
        factor=AvatarState.getValue(factor);
      }
 else {
        factor=maxChargeFactor * (double)(System.currentTimeMillis() - getStartTime()) / (double)maxChargeTime;
      }
      charging=false;
      launch();
      factor=Math.max(1,factor);
      damage*=factor;
      pushFactor*=factor;
    }
 else     if (System.currentTimeMillis() >= getStartTime() + maxChargeTime) {
      playAirbendingParticles(player.getEyeLocation(),particles);
    }
  }
}

Fixed version (ground truth):
public void progress(){
  if (!bPlayer.canBendIgnoreBindsCooldowns(this)) {
    remove();
    return;
  }
  if (player.isDead() || !player.isOnline()) {
    remove();
    return;
  }
  if (!charging) {
    if (elements.isEmpty()) {
      remove();
      return;
    }
    advanceSwipe();
  }
 else {
    if (!player.isSneaking()) {
      double factor=1;
      if (System.currentTimeMillis() >= getStartTime() + maxChargeTime) {
        factor=maxChargeFactor;
      }
 else       if (bPlayer.isAvatarState()) {
        factor=AvatarState.getValue(factor);
      }
 else {
        factor=maxChargeFactor * (double)(System.currentTimeMillis() - getStartTime()) / (double)maxChargeTime;
      }
      charging=false;
      launch();
      factor=Math.max(1,factor);
      damage*=factor;
      pushFactor*=factor;
    }
 else     if (System.currentTimeMillis() >= getStartTime() + maxChargeTime) {
      playAirbendingParticles(player.getEyeLocation(),particles);
    }
  }
}
Program: 133839
Project: 133839
Buggy source:
@Override public void progress(){
  if (!bPlayer.canBendIgnoreCooldowns(this) || GeneralMethods.isRegionProtectedFromBuild(this,location)) {
    remove();
    return;
  }
  speedFactor=speed * (ProjectKorra.time_step / 1000.0);
  ticks++;
  if (ticks > MAX_TICKS) {
    remove();
    return;
  }
  Block block=location.getBlock();
  if (GeneralMethods.isSolid(block) || block.isLiquid()) {
    if (block.getType() == Material.FURNACE && powerFurnace) {
      Furnace furnace=(Furnace)block.getState();
      furnace.setBurnTime((short)800);
      furnace.setCookTime((short)800);
      furnace.update();
    }
 else     if (BlazeArc.isIgnitable(player,block.getRelative(BlockFace.UP))) {
      if ((isFireBurst && fireBurstIgnite) || !isFireBurst) {
        ignite(location);
      }
    }
    remove();
    return;
  }
  if (location.distanceSquared(origin) > range * range) {
    remove();
    return;
  }
  for (  Entity entity : GeneralMethods.getEntitiesAroundPoint(location,collisionRadius)) {
    affect(entity);
    if (entity instanceof LivingEntity) {
      break;
    }
  }
  advanceLocation();
}

Fixed version (ground truth):
@Override public void progress(){
  if (!bPlayer.canBendIgnoreBindsCooldowns(this) || GeneralMethods.isRegionProtectedFromBuild(this,location)) {
    remove();
    return;
  }
  speedFactor=speed * (ProjectKorra.time_step / 1000.0);
  ticks++;
  if (ticks > MAX_TICKS) {
    remove();
    return;
  }
  Block block=location.getBlock();
  if (GeneralMethods.isSolid(block) || block.isLiquid()) {
    if (block.getType() == Material.FURNACE && powerFurnace) {
      Furnace furnace=(Furnace)block.getState();
      furnace.setBurnTime((short)800);
      furnace.setCookTime((short)800);
      furnace.update();
    }
 else     if (BlazeArc.isIgnitable(player,block.getRelative(BlockFace.UP))) {
      if ((isFireBurst && fireBurstIgnite) || !isFireBurst) {
        ignite(location);
      }
    }
    remove();
    return;
  }
  if (location.distanceSquared(origin) > range * range) {
    remove();
    return;
  }
  for (  Entity entity : GeneralMethods.getEntitiesAroundPoint(location,collisionRadius)) {
    affect(entity);
    if (entity instanceof LivingEntity) {
      break;
    }
  }
  advanceLocation();
}
Program: 133840
Project: 133840
Buggy source:
private void applyHealing(LivingEntity livingEntity){
  if (livingEntity.getHealth() < livingEntity.getMaxHealth()) {
    livingEntity.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,duration,1));
    AirAbility.breakBreathbendingHold(livingEntity);
    healing=true;
    healingSelf=false;
  }
}

Fixed version (ground truth):
private void applyHealing(LivingEntity livingEntity){
  if (livingEntity.getHealth() < livingEntity.getMaxHealth()) {
    livingEntity.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,duration,power));
    AirAbility.breakBreathbendingHold(livingEntity);
    healing=true;
    healingSelf=false;
  }
}
Program: 133841
Project: 133841
Buggy source:
public static boolean isObstructed(Location location1,Location location2){
  Vector loc1=location1.toVector();
  Vector loc2=location2.toVector();
  Vector direction=loc2.subtract(loc1);
  direction.normalize();
  Location loc;
  double max=location1.distance(location2);
  for (double i=0; i <= max; i++) {
    loc=location1.clone().add(direction.clone().multiply(i));
    Material type=loc.getBlock().getType();
    if (type != Material.AIR && !(Arrays.asList(ElementalAbility.getTransparentMaterialSet()).contains(type.getId()) || ElementalAbility.isWater(loc.getBlock()))) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean isObstructed(Location location1,Location location2){
  Vector loc1=location1.toVector();
  Vector loc2=location2.toVector();
  Vector direction=loc2.subtract(loc1);
  direction.normalize();
  Location loc;
  double max=0;
  if (location1.getWorld().equals(location2.getWorld()))   max=location1.distance(location2);
  for (double i=0; i <= max; i++) {
    loc=location1.clone().add(direction.clone().multiply(i));
    Material type=loc.getBlock().getType();
    if (type != Material.AIR && !(Arrays.asList(ElementalAbility.getTransparentMaterialSet()).contains(type.getId()) || ElementalAbility.isWater(loc.getBlock()))) {
      return true;
    }
  }
  return false;
}
Program: 133845
Project: 133845
Buggy source:
public static boolean removeAroundPoint(Player player,String ability,Location loc,double radius){
  boolean removed=false;
  for (  AirCombo combo : getAbilities(AirCombo.class)) {
    if (combo.getPlayer().equals(player)) {
      continue;
    }
 else     if (ability.equalsIgnoreCase("String_Node_Str") && combo.abilityName.equalsIgnoreCase("String_Node_Str")) {
      if (combo.currentLoc != null && Math.abs(combo.currentLoc.distance(loc)) <= radius) {
        combo.remove();
        removed=true;
      }
    }
 else     if (ability.equalsIgnoreCase("String_Node_Str") && combo.abilityName.equalsIgnoreCase("String_Node_Str")) {
      if (combo.currentLoc != null && Math.abs(combo.currentLoc.distance(loc)) <= radius) {
        combo.remove();
        removed=true;
      }
    }
 else     if (ability.equalsIgnoreCase("String_Node_Str") && combo.abilityName.equalsIgnoreCase("String_Node_Str")) {
      for (int j=0; j < combo.tasks.size(); j++) {
        FireComboStream fs=(FireComboStream)combo.tasks.get(j);
        if (fs.getLocation() != null && fs.getLocation().getWorld().equals(loc.getWorld()) && Math.abs(fs.getLocation().distance(loc)) <= radius) {
          fs.remove();
          removed=true;
        }
      }
    }
  }
  return removed;
}

Fixed version (ground truth):
public static boolean removeAroundPoint(Player player,String ability,Location loc,double radius){
  boolean removed=false;
  for (  AirCombo combo : getAbilities(AirCombo.class)) {
    if (combo.getPlayer().equals(player)) {
      continue;
    }
 else     if (ability.equalsIgnoreCase("String_Node_Str") && combo.abilityName.equalsIgnoreCase("String_Node_Str")) {
      if (combo.currentLoc != null && combo.currentLoc.getWorld().equals(loc.getWorld()) && Math.abs(combo.currentLoc.distance(loc)) <= radius) {
        combo.remove();
        removed=true;
      }
    }
 else     if (ability.equalsIgnoreCase("String_Node_Str") && combo.abilityName.equalsIgnoreCase("String_Node_Str")) {
      if (combo.currentLoc != null && combo.currentLoc.getWorld().equals(loc.getWorld()) && Math.abs(combo.currentLoc.distance(loc)) <= radius) {
        combo.remove();
        removed=true;
      }
    }
 else     if (ability.equalsIgnoreCase("String_Node_Str") && combo.abilityName.equalsIgnoreCase("String_Node_Str")) {
      for (int j=0; j < combo.tasks.size(); j++) {
        FireComboStream fs=(FireComboStream)combo.tasks.get(j);
        if (fs.getLocation() != null && fs.getLocation().getWorld().equals(loc.getWorld()) && Math.abs(fs.getLocation().distance(loc)) <= radius) {
          fs.remove();
          removed=true;
        }
      }
    }
  }
  return removed;
}
Program: 133850
Project: 133850
Buggy source:
private boolean moveEarth(){
  location=location.clone().add(direction);
  if (catapult) {
    if (location.distance(origin) < 0.5) {
      for (      Entity entity : GeneralMethods.getEntitiesAroundPoint(origin,2)) {
        if (entity instanceof Player) {
          Player target=(Player)entity;
          new Catapult(target,this);
        }
        entity.setVelocity(direction.clone().multiply(push * distance / length));
      }
      return false;
    }
  }
 else {
    double lengthSquared=(length - distance) * (length - distance);
    if (location.distanceSquared(origin) <= lengthSquared) {
      for (      Entity entity : GeneralMethods.getEntitiesAroundPoint(location,2)) {
        entity.setVelocity(direction.clone().multiply(push * distance / length));
      }
      return false;
    }
  }
  moveEarth(location.clone().subtract(direction),direction,distance,false);
  return true;
}

Fixed version (ground truth):
private boolean moveEarth(){
  location=location.clone().add(direction);
  if (catapult) {
    if (location.getWorld().equals(origin.getWorld()) && location.distance(origin) < 0.5) {
      for (      Entity entity : GeneralMethods.getEntitiesAroundPoint(origin,2)) {
        if (entity instanceof Player) {
          Player target=(Player)entity;
          new Catapult(target,this);
        }
        entity.setVelocity(direction.clone().multiply(push * distance / length));
      }
      return false;
    }
  }
 else {
    double lengthSquared=(length - distance) * (length - distance);
    if (location.distanceSquared(origin) <= lengthSquared) {
      for (      Entity entity : GeneralMethods.getEntitiesAroundPoint(location,2)) {
        entity.setVelocity(direction.clone().multiply(push * distance / length));
      }
      return false;
    }
  }
  moveEarth(location.clone().subtract(direction),direction,distance,false);
  return true;
}
Program: 133852
Project: 133852
Buggy source:
public EarthTunnel(Player player){
  super(player);
  this.maxRadius=getConfig().getDouble("String_Node_Str");
  this.range=getConfig().getDouble("String_Node_Str");
  this.radius=getConfig().getDouble("String_Node_Str");
  this.interval=getConfig().getLong("String_Node_Str");
  this.revert=getConfig().getBoolean("String_Node_Str");
  this.radiusIncrement=radius;
  this.time=System.currentTimeMillis();
  this.location=player.getEyeLocation().clone();
  this.origin=player.getTargetBlock((HashSet<Material>)null,(int)range).getLocation();
  this.block=origin.getBlock();
  this.direction=location.getDirection().clone().normalize();
  this.depth=Math.max(0,origin.distance(location) - 1);
  this.angle=0;
  if (!bPlayer.canBend(this)) {
    return;
  }
  start();
}

Fixed version (ground truth):
public EarthTunnel(Player player){
  super(player);
  this.maxRadius=getConfig().getDouble("String_Node_Str");
  this.range=getConfig().getDouble("String_Node_Str");
  this.radius=getConfig().getDouble("String_Node_Str");
  this.interval=getConfig().getLong("String_Node_Str");
  this.revert=getConfig().getBoolean("String_Node_Str");
  this.radiusIncrement=radius;
  this.time=System.currentTimeMillis();
  this.location=player.getEyeLocation().clone();
  this.origin=player.getTargetBlock((HashSet<Material>)null,(int)range).getLocation();
  this.block=origin.getBlock();
  this.direction=location.getDirection().clone().normalize();
  this.depth=0;
  if (origin.getWorld().equals(location.getWorld())) {
    this.depth=Math.max(0,origin.distance(location) - 1);
  }
  this.angle=0;
  if (!bPlayer.canBend(this)) {
    return;
  }
  start();
}
Program: 133853
Project: 133853
Buggy source:
public static boolean isBlockInWave(Block block){
  for (  LavaSurgeWave lavaWave : getAbilities(LavaSurgeWave.class)) {
    if (block.getLocation().distance(lavaWave.location) <= 2 * lavaWave.radius) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean isBlockInWave(Block block){
  for (  LavaSurgeWave lavaWave : getAbilities(LavaSurgeWave.class)) {
    if (block.getWorld().equals(lavaWave.location.getWorld()) && block.getLocation().distance(lavaWave.location) <= 2 * lavaWave.radius) {
      return true;
    }
  }
  return false;
}
Program: 133855
Project: 133855
Buggy source:
public double getDistanceTraveled(){
  if (start.getWorld() != end.getWorld()) {
    return 0;
  }
  return start.distance(end);
}

Fixed version (ground truth):
public double getDistanceTraveled(){
  if (!start.getWorld().equals(end.getWorld())) {
    return 0;
  }
  return start.distance(end);
}
Program: 133856
Project: 133856
Buggy source:
public void explode(){
  boolean explode=true;
  for (  Block block : GeneralMethods.getBlocksAroundPoint(location,3)) {
    if (GeneralMethods.isRegionProtectedFromBuild(this,block.getLocation())) {
      explode=false;
      break;
    }
  }
  if (explode) {
    if (canDamageBlocks && explosionRadius > 0 && canFireGrief()) {
      explosion=player.getWorld().spawn(location,TNTPrimed.class);
      explosion.setFuseTicks(0);
      double yield=explosionRadius;
      if (!bPlayer.isAvatarState()) {
        yield=getDayFactor(yield,player.getWorld());
      }
 else {
        yield=AvatarState.getValue(yield);
      }
      explosion.setYield((float)yield);
      EXPLOSIONS.put(explosion,this);
    }
 else {
      List<Entity> entities=GeneralMethods.getEntitiesAroundPoint(location,damageRadius);
      for (      Entity entity : entities) {
        if (entity instanceof LivingEntity) {
          double slope=-(maxDamage * .5) / (damageRadius - innerRadius);
          double damage=slope * (entity.getLocation().distance(location) - innerRadius) + maxDamage;
          DamageHandler.damageEntity(entity,damage,this);
        }
      }
      location.getWorld().playSound(location,Sound.ENTITY_GENERIC_EXPLODE,5,1);
      ParticleEffect.EXPLOSION_HUGE.display(new Vector(0,0,0),0,location,255.0D);
    }
  }
  ignite(location);
  remove();
}

Fixed version (ground truth):
public void explode(){
  boolean explode=true;
  for (  Block block : GeneralMethods.getBlocksAroundPoint(location,3)) {
    if (GeneralMethods.isRegionProtectedFromBuild(this,block.getLocation())) {
      explode=false;
      break;
    }
  }
  if (explode) {
    if (canDamageBlocks && explosionRadius > 0 && canFireGrief()) {
      explosion=player.getWorld().spawn(location,TNTPrimed.class);
      explosion.setFuseTicks(0);
      double yield=explosionRadius;
      if (!bPlayer.isAvatarState()) {
        yield=getDayFactor(yield,player.getWorld());
      }
 else {
        yield=AvatarState.getValue(yield);
      }
      explosion.setYield((float)yield);
      EXPLOSIONS.put(explosion,this);
    }
 else {
      List<Entity> entities=GeneralMethods.getEntitiesAroundPoint(location,damageRadius);
      for (      Entity entity : entities) {
        if (entity instanceof LivingEntity) {
          double slope=-(maxDamage * .5) / (damageRadius - innerRadius);
          double damage=0;
          if (entity.getWorld().equals(location.getWorld())) {
            damage=slope * (entity.getLocation().distance(location) - innerRadius) + maxDamage;
          }
          DamageHandler.damageEntity(entity,damage,this);
        }
      }
      location.getWorld().playSound(location,Sound.ENTITY_GENERIC_EXPLODE,5,1);
      ParticleEffect.EXPLOSION_HUGE.display(new Vector(0,0,0),0,location,255.0D);
    }
  }
  ignite(location);
  remove();
}
Program: 133857
Project: 133857
Buggy source:
public void dealDamage(Entity entity){
  if (explosion == null) {
    return;
  }
  double distance=entity.getLocation().distance(explosion.getLocation());
  if (distance > damageRadius) {
    return;
  }
 else   if (distance < innerRadius) {
    DamageHandler.damageEntity(entity,maxDamage,this);
    return;
  }
  double slope=-(maxDamage * .5) / (damageRadius - innerRadius);
  double damage=slope * (distance - innerRadius) + maxDamage;
  DamageHandler.damageEntity(entity,damage,this);
  AirAbility.breakBreathbendingHold(entity);
}

Fixed version (ground truth):
public void dealDamage(Entity entity){
  if (explosion == null) {
    return;
  }
  double distance=0;
  if (entity.getWorld().equals(explosion.getWorld())) {
    distance=entity.getLocation().distance(explosion.getLocation());
  }
  if (distance > damageRadius) {
    return;
  }
 else   if (distance < innerRadius) {
    DamageHandler.damageEntity(entity,maxDamage,this);
    return;
  }
  double slope=-(maxDamage * .5) / (damageRadius - innerRadius);
  double damage=slope * (distance - innerRadius) + maxDamage;
  DamageHandler.damageEntity(entity,damage,this);
  AirAbility.breakBreathbendingHold(entity);
}
Program: 133858
Project: 133858
Buggy source:
public static boolean isWithinShield(Location loc){
  for (  FireShield fshield : getAbilities(FireShield.class)) {
    Location playerLoc=fshield.player.getLocation();
    if (fshield.shield) {
      if (!playerLoc.getWorld().equals(loc.getWorld())) {
        return false;
      }
 else       if (playerLoc.distanceSquared(loc) <= fshield.radius * fshield.radius) {
        return true;
      }
    }
 else {
      Location tempLoc=playerLoc.clone().add(playerLoc.multiply(fshield.discRadius));
      if (!tempLoc.getWorld().equals(loc.getWorld())) {
        return false;
      }
 else       if (tempLoc.distance(loc) <= fshield.discRadius * fshield.discRadius) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean isWithinShield(Location loc){
  for (  FireShield fshield : getAbilities(FireShield.class)) {
    Location playerLoc=fshield.player.getLocation();
    if (fshield.shield) {
      if (!playerLoc.getWorld().equals(loc.getWorld())) {
        return false;
      }
 else       if (playerLoc.distanceSquared(loc) <= fshield.radius * fshield.radius) {
        return true;
      }
    }
 else {
      Location tempLoc=playerLoc.clone().add(playerLoc.multiply(fshield.discRadius));
      if (!tempLoc.getWorld().equals(loc.getWorld())) {
        return false;
      }
 else       if (tempLoc.getWorld().equals(loc.getWorld()) && tempLoc.distance(loc) <= fshield.discRadius * fshield.discRadius) {
        return true;
      }
    }
  }
  return false;
}
Program: 133859
Project: 133859
Buggy source:
/** 
 * Runs an arc generation algorithm by first creating two points, the starting point and the ending point. Next, it creates a point in the middle that has an offset relative to the beginning and end points. Now that the arc is split into 3 points, we continue this processes by generating middle points in the two halfs of this arc. This process continues the amount of times specified.
 * @param times The amount of times that the arc will be split in half causes O(n^2)complexity
 */
public void generatePoints(int times){
  for (int i=0; i < times; i++) {
    for (int j=0; j < points.size() - 1; j+=2) {
      Location loc1=points.get(j);
      Location loc2=points.get(j + 1);
      double adjac=loc1.distance(loc2) / 2;
      double angle=(Math.random() - 0.5) * maxArcAngle;
      angle+=angle >= 0 ? 10 : -10;
      double radians=Math.toRadians(angle);
      double hypot=adjac / Math.cos(radians);
      Vector dir=GeneralMethods.rotateXZ(direction.clone(),angle);
      Location newLoc=loc1.clone().add(dir.normalize().multiply(hypot));
      newLoc.add(0,(Math.random() - 0.5) / 2.0,0);
      points.add(j + 1,newLoc);
    }
  }
  for (int i=0; i < points.size(); i++) {
    animationLocations.add(new AnimationLocation(points.get(i),animationCounter));
    animationCounter++;
  }
}

Fixed version (ground truth):
/** 
 * Runs an arc generation algorithm by first creating two points, the starting point and the ending point. Next, it creates a point in the middle that has an offset relative to the beginning and end points. Now that the arc is split into 3 points, we continue this processes by generating middle points in the two halfs of this arc. This process continues the amount of times specified.
 * @param times The amount of times that the arc will be split in half causes O(n^2)complexity
 */
public void generatePoints(int times){
  for (int i=0; i < times; i++) {
    for (int j=0; j < points.size() - 1; j+=2) {
      Location loc1=points.get(j);
      Location loc2=points.get(j + 1);
      double adjac=0;
      if (loc1.getWorld().equals(loc2.getWorld())) {
        adjac=loc1.distance(loc2) / 2;
      }
      double angle=(Math.random() - 0.5) * maxArcAngle;
      angle+=angle >= 0 ? 10 : -10;
      double radians=Math.toRadians(angle);
      double hypot=adjac / Math.cos(radians);
      Vector dir=GeneralMethods.rotateXZ(direction.clone(),angle);
      Location newLoc=loc1.clone().add(dir.normalize().multiply(hypot));
      newLoc.add(0,(Math.random() - 0.5) / 2.0,0);
      points.add(j + 1,newLoc);
    }
  }
  for (int i=0; i < points.size(); i++) {
    animationLocations.add(new AnimationLocation(points.get(i),animationCounter));
    animationCounter++;
  }
}
Program: 133861
Project: 133861
Buggy source:
private void launch(){
  Location location=player.getLocation();
  for (  Entity entity : TARGETED_ENTITIES.keySet()) {
    Location target=entity.getLocation().clone();
    Vector vector=GeneralMethods.getDirection(location,GeneralMethods.getTargetedLocation(player,location.distance(target)));
    vector.normalize();
    entity.setVelocity(vector.multiply(throwFactor));
    new HorizontalVelocityTracker(entity,player,200,this);
  }
  remove();
  bPlayer.addCooldown(this);
}

Fixed version (ground truth):
private void launch(){
  Location location=player.getLocation();
  for (  Entity entity : TARGETED_ENTITIES.keySet()) {
    Location target=entity.getLocation().clone();
    Vector vector=new Vector(0,0,0);
    if (location.getWorld().equals(target.getWorld())) {
      vector=GeneralMethods.getDirection(location,GeneralMethods.getTargetedLocation(player,location.distance(target)));
    }
    vector.normalize();
    entity.setVelocity(vector.multiply(throwFactor));
    new HorizontalVelocityTracker(entity,player,200,this);
  }
  remove();
  bPlayer.addCooldown(this);
}
Program: 133863
Project: 133863
Buggy source:
@SuppressWarnings("String_Node_Str") private void getGround(){
  for (int i=0; i <= 5; i++) {
    Block block=loc.getBlock().getRelative(BlockFace.DOWN,i);
    if (isEarthbendable(block)) {
      groundBlock=block;
      blockType=block.getType();
      blockByte=block.getData();
      return;
    }
  }
}

Fixed version (ground truth):
private void getGround(){
  for (int i=0; i <= 5; i++) {
    Block block=loc.getBlock().getRelative(BlockFace.DOWN,i);
    if (isEarthbendable(block)) {
      groundBlock=block;
      blockType=block.getType();
      return;
    }
  }
}
Program: 133864
Project: 133864
Buggy source:
public EarthGrab(Player player){
  super(player);
  this.selectRange=getConfig().getDouble("String_Node_Str");
  this.height=getConfig().getDouble("String_Node_Str");
  this.cooldown=getConfig().getLong("String_Node_Str");
  this.origin=player.getEyeLocation();
  this.direction=origin.getDirection();
  this.lowestDistance=selectRange + 1;
  this.closestEntity=null;
  this.startLoc=player.getLocation();
  this.loc=player.getLocation();
  this.dir=player.getLocation().getDirection().clone().normalize().multiply(1.5);
  this.random=new Random();
  if (!bPlayer.canBend(this)) {
    return;
  }
  if (player.isSneaking()) {
    start();
  }
 else {
    Location targetLocation=GeneralMethods.getTargetedLocation(player,1);
    Block block=GeneralMethods.getTopBlock(targetLocation,1,1);
    if (isEarthbendable(block) && block.getLocation().distance(player.getLocation()) <= 1.3) {
      earthGrabSelf();
      remove();
    }
  }
}

Fixed version (ground truth):
public EarthGrab(Player player){
  super(player);
  this.selectRange=getConfig().getDouble("String_Node_Str");
  this.height=getConfig().getDouble("String_Node_Str");
  this.cooldown=getConfig().getLong("String_Node_Str");
  this.origin=player.getEyeLocation();
  this.direction=origin.getDirection();
  this.lowestDistance=selectRange + 1;
  this.closestEntity=null;
  this.startLoc=player.getLocation();
  this.loc=player.getLocation();
  this.dir=player.getLocation().getDirection();
  this.random=new Random();
  if (!bPlayer.canBend(this)) {
    return;
  }
  if (player.isSneaking()) {
    start();
  }
  Location targetLocation=GeneralMethods.getTargetedLocation(player,1);
  Block block=GeneralMethods.getTopBlock(targetLocation,1);
  if (isEarthbendable(block) && block.getWorld().equals(player.getWorld()) && block.getLocation().distance(player.getLocation()) <= 2) {
    earthGrabSelf();
    remove();
  }
}
Program: 133865
Project: 133865
Buggy source:
@Override public void progress(){
  getGround();
  bPlayer.addCooldown(this);
  if (groundBlock == null) {
    remove();
    return;
  }
  dir=dir.clone().normalize().multiply(1.5);
  dir.setY(0);
  double distance=loc.getY() - (double)groundBlock.getY();
  double dx=Math.abs(distance - 2.4);
  if (distance > 1.75) {
    dir.setY(-.50 * dx * dx);
  }
 else   if (distance < 1) {
    dir.setY(.50 * dx * dx);
  }
 else {
    dir.setY(0);
  }
  loc.add(dir);
  ParticleEffect.BLOCK_CRACK.display((ParticleEffect.ParticleData)new ParticleEffect.BlockData(blockType,blockByte),1F,0.1F,1F,0.1F,100,loc.add(0,-1,0),500);
  if (player.isDead() || !player.isOnline()) {
    remove();
    return;
  }
  if (!player.isSneaking()) {
    remove();
    return;
  }
  if (loc.distance(startLoc) >= selectRange) {
    remove();
    return;
  }
  for (  Entity e : GeneralMethods.getEntitiesAroundPoint(loc,2.5)) {
    if (e.getEntityId() != player.getEntityId() && e instanceof LivingEntity) {
      closestEntity=e;
      formDome();
      remove();
      return;
    }
  }
  if (random.nextInt(2) == 0) {
    playEarthbendingSound(loc);
  }
}

Fixed version (ground truth):
@Override public void progress(){
  getGround();
  bPlayer.addCooldown(this);
  if (groundBlock == null) {
    remove();
    return;
  }
  dir=player.getLocation().getDirection().clone().normalize().multiply(1.5);
  dir.setY(0);
  double distance=loc.getY() - (double)groundBlock.getY();
  double dx=Math.abs(distance - 2.4);
  if (distance > 1.75) {
    dir.setY(-.50 * dx * dx);
  }
 else   if (distance < 1) {
    dir.setY(.50 * dx * dx);
  }
 else {
    dir.setY(0);
  }
  loc.add(dir);
  ParticleEffect.BLOCK_CRACK.display((ParticleEffect.ParticleData)new ParticleEffect.BlockData(blockType,(byte)0),1F,0.1F,1F,0.1F,100,loc.add(0,-1,0),500);
  if (player.isDead() || !player.isOnline()) {
    remove();
    return;
  }
  if (!player.isSneaking()) {
    remove();
    return;
  }
  if (loc.getWorld().equals(startLoc.getWorld()) && loc.distance(startLoc) >= selectRange) {
    remove();
    return;
  }
  for (  Entity e : GeneralMethods.getEntitiesAroundPoint(loc,2.5)) {
    if (e.getEntityId() != player.getEntityId() && e instanceof LivingEntity) {
      closestEntity=e;
      formDome();
      remove();
      return;
    }
  }
  if (random.nextInt(2) == 0) {
    playEarthbendingSound(loc);
  }
}
Program: 133867
Project: 133867
Buggy source:
@Override public void execute(CommandSender sender,List<String> args){
  if (!hasPermission(sender) || !correctLength(sender,args.size(),1,2) || !isPlayer(sender)) {
    return;
  }
  CoreAbility coreAbil=CoreAbility.getAbility(args.get(0));
  if (coreAbil == null || coreAbil.isHiddenAbility() || !coreAbil.isEnabled()) {
    sender.sendMessage(ChatColor.RED + abilityDoesntExist.replace("String_Node_Str",args.get(0)));
    return;
  }
  if (args.size() == 1) {
    bind(sender,args.get(0),((Player)sender).getInventory().getHeldItemSlot() + 1);
  }
  if (args.size() == 2) {
    bind(sender,args.get(0),Integer.parseInt(args.get(1)));
  }
}

Fixed version (ground truth):
@Override public void execute(CommandSender sender,List<String> args){
  if (!hasPermission(sender) || !correctLength(sender,args.size(),1,2) || !isPlayer(sender)) {
    return;
  }
  CoreAbility coreAbil=CoreAbility.getAbility(args.get(0));
  if (coreAbil == null || coreAbil.isHiddenAbility() || !coreAbil.isEnabled()) {
    sender.sendMessage(ChatColor.RED + abilityDoesntExist.replace("String_Node_Str",args.get(0)));
    return;
  }
  if (args.size() == 1) {
    bind(sender,args.get(0),((Player)sender).getInventory().getHeldItemSlot() + 1);
  }
  if (args.size() == 2) {
    try {
      bind(sender,args.get(0),Integer.parseInt(args.get(1)));
    }
 catch (    NumberFormatException ex) {
      sender.sendMessage(ChatColor.RED + wrongNumber);
    }
  }
}
Program: 133868
Project: 133868
Buggy source:
private void freeze(){
  if (layer == 0) {
    return;
  }
 else   if (!bPlayer.canBendIgnoreBindsCooldowns(getAbility("String_Node_Str"))) {
    return;
  }
  List<Block> ice=GeneralMethods.getBlocksAroundPoint(location,layer);
  for (  Block block : ice) {
    if (isTransparent(player,block) && block.getType() != Material.ICE) {
      TempBlock tblock=new TempBlock(block,Material.ICE,(byte)0);
      FROZEN_BLOCKS.put(tblock,player);
      FROZEN_BLOCKS_DELAY.put(tblock,System.currentTimeMillis());
      playIcebendingSound(block.getLocation());
    }
  }
}

Fixed version (ground truth):
private void freeze(){
  if (layer == 0) {
    return;
  }
 else   if (!bPlayer.canBendIgnoreBindsCooldowns(getAbility("String_Node_Str"))) {
    return;
  }
  List<Block> ice=GeneralMethods.getBlocksAroundPoint(location,layer);
  for (  Block block : ice) {
    if (isTransparent(player,block) && block.getType() != Material.ICE) {
      TempBlock tblock=new TempBlock(block,Material.ICE,(byte)0);
      FROZEN_BLOCKS.put(tblock,player);
      FROZEN_BLOCKS_DELAY.put(tblock,System.currentTimeMillis() + (new Random().nextInt((500 + 500) + 1) - 500));
      playIcebendingSound(block.getLocation());
    }
  }
}
Program: 133870
Project: 133870
Buggy source:
public AddCommand(){
  super("String_Node_Str","String_Node_Str",ConfigManager.languageConfig.get().getString("String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  this.playerNotFound=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.invalidElement=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.addedOther=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.added=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.alreadyHasElementOther=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.alreadyHasElement=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.alreadyHasSubElementOther=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.alreadyHasSubElement=ConfigManager.languageConfig.get().getString("String_Node_Str");
}

Fixed version (ground truth):
public AddCommand(){
  super("String_Node_Str","String_Node_Str",ConfigManager.languageConfig.get().getString("String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  this.playerNotFound=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.invalidElement=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.addedOtherCFW=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.addedOtherAE=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.addedCFW=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.addedAE=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.alreadyHasElementOther=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.alreadyHasElement=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.alreadyHasSubElementOther=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.alreadyHasSubElement=ConfigManager.languageConfig.get().getString("String_Node_Str");
}
Program: 133872
Project: 133872
Buggy source:
public ChooseCommand(){
  super("String_Node_Str","String_Node_Str",ConfigManager.languageConfig.get().getString("String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  this.playerNotFound=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.invalidElement=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.chosen=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.chosenOther=ConfigManager.languageConfig.get().getString("String_Node_Str");
}

Fixed version (ground truth):
public ChooseCommand(){
  super("String_Node_Str","String_Node_Str",ConfigManager.languageConfig.get().getString("String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  this.playerNotFound=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.invalidElement=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.chosenCFW=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.chosenAE=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.chosenOtherCFW=ConfigManager.languageConfig.get().getString("String_Node_Str");
  this.chosenOtherAE=ConfigManager.languageConfig.get().getString("String_Node_Str");
}
Program: 133876
Project: 133876
Buggy source:
public FireJet(Player player){
  super(player);
  FireJet oldJet=getAbility(player,FireJet.class);
  if (oldJet != null) {
    oldJet.remove();
    return;
  }
 else   if (bPlayer.isOnCooldown(this)) {
    return;
  }
  if (hasAbility(player,AirSpout.class)) {
    AirSpout abil=getAbility(player,AirSpout.class);
    abil.remove();
  }
 else   if (hasAbility(player,SandSpout.class)) {
    SandSpout abil=getAbility(player,SandSpout.class);
    abil.remove();
  }
  this.avatarStateToggled=getConfig().getBoolean("String_Node_Str");
  this.duration=getConfig().getLong("String_Node_Str");
  this.speed=getConfig().getDouble("String_Node_Str");
  this.cooldown=getConfig().getLong("String_Node_Str");
  this.random=new Random();
  this.speed=getDayFactor(speed);
  Block block=player.getLocation().getBlock();
  if (BlazeArc.isIgnitable(player,block) || block.getType() == Material.AIR || bPlayer.isAvatarState()) {
    player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(speed));
    if (canFireGrief()) {
      createTempFire(block.getLocation());
    }
 else {
      block.setType(Material.FIRE);
    }
    new Flight(player);
    player.setAllowFlight(true);
    time=System.currentTimeMillis();
    start();
    bPlayer.addCooldown(this);
  }
}

Fixed version (ground truth):
public FireJet(Player player){
  super(player);
  FireJet oldJet=getAbility(player,FireJet.class);
  if (oldJet != null) {
    oldJet.remove();
    return;
  }
 else   if (bPlayer.isOnCooldown(this)) {
    return;
  }
  if (hasAbility(player,AirSpout.class)) {
    AirSpout abil=getAbility(player,AirSpout.class);
    abil.remove();
  }
 else   if (hasAbility(player,SandSpout.class)) {
    SandSpout abil=getAbility(player,SandSpout.class);
    abil.remove();
  }
  this.avatarStateToggled=getConfig().getBoolean("String_Node_Str");
  this.duration=getConfig().getLong("String_Node_Str");
  this.speed=getConfig().getDouble("String_Node_Str");
  this.cooldown=getConfig().getLong("String_Node_Str");
  this.random=new Random();
  this.speed=getDayFactor(speed);
  Block block=player.getLocation().getBlock();
  if (BlazeArc.isIgnitable(player,block) || block.getType() == Material.AIR || block.getType() == Material.STEP || block.getType() == Material.WOOD_STEP || bPlayer.isAvatarState()) {
    player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(speed));
    if (canFireGrief()) {
      if (block.getType() == Material.AIR) {
        createTempFire(block.getLocation());
      }
    }
 else     if (block.getType() == Material.AIR) {
      block.setType(Material.FIRE);
    }
    new Flight(player);
    player.setAllowFlight(true);
    time=System.currentTimeMillis();
    start();
    bPlayer.addCooldown(this);
  }
}
Program: 133877
Project: 133877
Buggy source:
private void pushWater(){
  if (bPlayer.hasElement(Element.AIR)) {
    radius=airRadius;
  }
 else {
    radius=waterRadius;
  }
  if (bPlayer.hasElement(Element.WATER) && isNight(player.getWorld())) {
    radius=WaterAbility.getNightFactor(waterRadius,player.getWorld());
  }
  if (airRadius > radius && bPlayer.hasElement(Element.AIR)) {
    radius=airRadius;
  }
  Location location=player.getLocation();
  for (  Block block : waterOrigins.keySet()) {
    if (block.getWorld() != location.getWorld()) {
      if (block.getType() == Material.AIR || isWater(block)) {
        waterOrigins.get(block).update(true);
      }
      waterOrigins.remove(block);
    }
 else     if (block.getLocation().distanceSquared(location) > radius * radius) {
      if (block.getType() == Material.AIR || isWater(block)) {
        waterOrigins.get(block).update(true);
      }
      waterOrigins.remove(block);
    }
  }
  for (  Block block : GeneralMethods.getBlocksAroundPoint(location,radius)) {
    if (waterOrigins.containsKey(block)) {
      continue;
    }
 else     if (!isWater(block)) {
      continue;
    }
 else     if (GeneralMethods.isRegionProtectedFromBuild(player,"String_Node_Str",block.getLocation())) {
      continue;
    }
 else     if (block.getType() == Material.STATIONARY_WATER || block.getType() == Material.WATER) {
      if (WaterManipulation.canBubbleWater(block)) {
        waterOrigins.put(block,block.getState());
        block.setType(Material.AIR);
      }
    }
  }
}

Fixed version (ground truth):
private void pushWater(){
  if (bPlayer.hasElement(Element.AIR)) {
    radius=airRadius;
  }
 else {
    radius=waterRadius;
  }
  if (bPlayer.hasElement(Element.WATER) && isNight(player.getWorld())) {
    radius=WaterAbility.getNightFactor(waterRadius,player.getWorld());
  }
  if (airRadius > radius && bPlayer.hasElement(Element.AIR)) {
    radius=airRadius;
  }
  Location location=player.getLocation();
  for (  Block block : waterOrigins.keySet()) {
    if (block.getWorld() != location.getWorld()) {
      if (block.getType() == Material.AIR || isWater(block)) {
        waterOrigins.get(block).update(true);
      }
      waterOrigins.remove(block);
    }
 else     if (block.getLocation().distanceSquared(location) > radius * radius) {
      if (block.getType() == Material.AIR || isWater(block)) {
        waterOrigins.get(block).update(true);
      }
      waterOrigins.remove(block);
    }
  }
  for (  Block block : GeneralMethods.getBlocksAroundPoint(location,radius)) {
    if (waterOrigins.containsKey(block)) {
      continue;
    }
 else     if (!isWater(block)) {
      continue;
    }
 else     if (GeneralMethods.isRegionProtectedFromBuild(player,"String_Node_Str",block.getLocation())) {
      continue;
    }
 else     if (block.getType() == Material.STATIONARY_WATER || block.getType() == Material.WATER) {
      if (WaterManipulation.canBubbleWater(block)) {
        waterOrigins.put(block,block.getState());
        block.setType(Material.AIR);
      }
    }
  }
  WaterAbility.removeWaterSpouts(location,radius,player);
}