Program: 133805
Project: 133805
Buggy source:
/** 
 * Adds the ability to bend the given element to the specified Player.
 * @param sender The CommandSender who issued the command
 * @param target The Player to add the element to
 * @param element The element to add to the Player
 */
private void add(CommandSender sender,Player target,Element element){
  BendingPlayer bPlayer=BendingPlayer.getBendingPlayer(target);
  if (bPlayer == null) {
    return;
  }
  if (element instanceof SubElement) {
    SubElement sub=(SubElement)element;
    bPlayer.addSubElement(sub);
    ChatColor color=sub != null ? sub.getColor() : ChatColor.WHITE;
    if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
      sender.sendMessage(color + chosenOtherCFW.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",sub.getName() + sub.getType().getBender()));
    }
 else {
      target.sendMessage(color + chosenCFW.replace("String_Node_Str",sub.getName() + sub.getType().getBender()));
    }
    GeneralMethods.saveSubElements(bPlayer);
    Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender,target,sub,com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.CHOOSE));
  }
 else {
    bPlayer.addElement(element);
    bPlayer.getSubElements().clear();
    for (    SubElement sub : Element.getAllSubElements()) {
      if (bPlayer.hasElement(sub.getParentElement()) && bPlayer.hasSubElementPermission(sub)) {
        bPlayer.addSubElement(sub);
      }
    }
    ChatColor color=element != null ? element.getColor() : ChatColor.WHITE;
    if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
      if (element != Element.AIR && element != Element.EARTH)       sender.sendMessage(color + chosenOtherCFW.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",element.getName() + element.getType().getBender()));
 else       sender.sendMessage(color + chosenOtherAE.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",element.getName() + element.getType().getBender()));
    }
 else {
      if (element != Element.AIR && element != Element.EARTH)       target.sendMessage(color + chosenCFW.replace("String_Node_Str",element.getName() + element.getType().getBender()));
 else       target.sendMessage(color + chosenAE.replace("String_Node_Str",element.getName() + element.getType().getBender()));
    }
    GeneralMethods.saveElements(bPlayer);
    GeneralMethods.saveSubElements(bPlayer);
    Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender,target,element,Result.CHOOSE));
  }
  GeneralMethods.removeUnusableAbilities(target.getName());
}

Fixed version (ground truth):
/** 
 * Adds the ability to bend the given element to the specified Player.
 * @param sender The CommandSender who issued the command
 * @param target The Player to add the element to
 * @param element The element to add to the Player
 */
private void add(CommandSender sender,Player target,Element element){
  BendingPlayer bPlayer=BendingPlayer.getBendingPlayer(target);
  if (bPlayer == null) {
    return;
  }
  if (element instanceof SubElement) {
    SubElement sub=(SubElement)element;
    bPlayer.addSubElement(sub);
    ChatColor color=sub != null ? sub.getColor() : ChatColor.WHITE;
    if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
      sender.sendMessage(color + chosenOtherCFW.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",sub.getName() + sub.getType().getBender()));
    }
 else {
      target.sendMessage(color + chosenCFW.replace("String_Node_Str",sub.getName() + sub.getType().getBender()));
    }
    GeneralMethods.saveSubElements(bPlayer);
    Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender,target,sub,com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.CHOOSE));
  }
 else {
    bPlayer.setElement(element);
    bPlayer.getSubElements().clear();
    for (    SubElement sub : Element.getAllSubElements()) {
      if (bPlayer.hasElement(sub.getParentElement()) && bPlayer.hasSubElementPermission(sub)) {
        bPlayer.addSubElement(sub);
      }
    }
    ChatColor color=element != null ? element.getColor() : ChatColor.WHITE;
    if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
      if (element != Element.AIR && element != Element.EARTH)       sender.sendMessage(color + chosenOtherCFW.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",element.getName() + element.getType().getBender()));
 else       sender.sendMessage(color + chosenOtherAE.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",element.getName() + element.getType().getBender()));
    }
 else {
      if (element != Element.AIR && element != Element.EARTH)       target.sendMessage(color + chosenCFW.replace("String_Node_Str",element.getName() + element.getType().getBender()));
 else       target.sendMessage(color + chosenAE.replace("String_Node_Str",element.getName() + element.getType().getBender()));
    }
    GeneralMethods.saveElements(bPlayer);
    GeneralMethods.saveSubElements(bPlayer);
    Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender,target,element,Result.CHOOSE));
  }
  GeneralMethods.removeUnusableAbilities(target.getName());
}