Program: 133915
Project: 133915
Buggy source:
/** 
 * Updates all of the player's sources.
 * @param player the player performing the bending.
 * @param clickType either {@link ClickType}.SHIFT_DOWN or ClickType.LEFT_CLICK
 */
public static void update(Player player,ClickType clickType){
  BendingPlayer bPlayer=BendingPlayer.getBendingPlayer(player);
  if (bPlayer == null) {
    return;
  }
  CoreAbility coreAbil=bPlayer.getBoundAbility();
  if (coreAbil == null) {
    return;
  }
  if (coreAbil instanceof WaterAbility) {
    Block waterBlock=WaterAbility.getWaterSourceBlock(player,MAX_RANGE,true);
    if (waterBlock != null) {
      putSource(player,waterBlock,BlockSourceType.WATER,clickType);
      if (WaterAbility.isPlant(waterBlock)) {
        putSource(player,waterBlock,BlockSourceType.PLANT,clickType);
      }
      if (WaterAbility.isIce(waterBlock)) {
        putSource(player,waterBlock,BlockSourceType.ICE,clickType);
      }
    }
  }
 else   if (coreAbil instanceof EarthAbility) {
    Block earthBlock=EarthAbility.getEarthSourceBlock(player,null,MAX_RANGE);
    if (earthBlock != null) {
      putSource(player,earthBlock,BlockSourceType.EARTH,clickType);
      if (EarthAbility.isMetal(earthBlock)) {
        putSource(player,earthBlock,BlockSourceType.METAL,clickType);
      }
    }
    Block lavaBlock=EarthAbility.getLavaSourceBlock(player,MAX_RANGE);
    double earthDist=earthBlock != null ? earthBlock.getLocation().distanceSquared(player.getLocation()) : Double.MAX_VALUE;
    double lavaDist=lavaBlock != null ? lavaBlock.getLocation().distanceSquared(player.getLocation()) : Double.MAX_VALUE;
    if (lavaBlock != null && lavaDist <= earthDist) {
      putSource(player,null,BlockSourceType.EARTH,clickType);
      putSource(player,lavaBlock,BlockSourceType.LAVA,clickType);
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates all of the player's sources.
 * @param player the player performing the bending.
 * @param clickType either {@link ClickType}.SHIFT_DOWN or ClickType.LEFT_CLICK
 */
public static void update(Player player,ClickType clickType){
  BendingPlayer bPlayer=BendingPlayer.getBendingPlayer(player);
  if (bPlayer == null) {
    return;
  }
  CoreAbility coreAbil=bPlayer.getBoundAbility();
  if (coreAbil == null) {
    return;
  }
  if (coreAbil instanceof WaterAbility) {
    Block waterBlock=WaterAbility.getWaterSourceBlock(player,MAX_RANGE,true);
    if (waterBlock != null) {
      putSource(player,waterBlock,BlockSourceType.WATER,clickType);
      if (WaterAbility.isPlant(waterBlock)) {
        putSource(player,waterBlock,BlockSourceType.PLANT,clickType);
      }
      if (WaterAbility.isIce(waterBlock)) {
        putSource(player,waterBlock,BlockSourceType.ICE,clickType);
      }
      if (WaterAbility.isSnow(waterBlock)) {
        putSource(player,waterBlock,BlockSourceType.SNOW,clickType);
      }
    }
  }
 else   if (coreAbil instanceof EarthAbility) {
    Block earthBlock=EarthAbility.getEarthSourceBlock(player,null,MAX_RANGE);
    if (earthBlock != null) {
      putSource(player,earthBlock,BlockSourceType.EARTH,clickType);
      if (EarthAbility.isMetal(earthBlock)) {
        putSource(player,earthBlock,BlockSourceType.METAL,clickType);
      }
    }
    Block lavaBlock=EarthAbility.getLavaSourceBlock(player,MAX_RANGE);
    double earthDist=earthBlock != null ? earthBlock.getLocation().distanceSquared(player.getLocation()) : Double.MAX_VALUE;
    double lavaDist=lavaBlock != null ? lavaBlock.getLocation().distanceSquared(player.getLocation()) : Double.MAX_VALUE;
    if (lavaBlock != null && lavaDist <= earthDist) {
      putSource(player,null,BlockSourceType.EARTH,clickType);
      putSource(player,lavaBlock,BlockSourceType.LAVA,clickType);
    }
  }
}