Program: 133871
Project: 133871
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 + chosenOther.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",sub.getName() + sub.getType().getBender()));
    }
 else {
      target.sendMessage(color + chosen.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);
    for (    SubElement sub : Element.getAllSubElements()) {
      if (sub.getParentElement() == element && bPlayer.hasSubElementPermission(sub)) {
        bPlayer.addSubElement(sub);
      }
    }
    ChatColor color=element != null ? element.getColor() : ChatColor.WHITE;
    if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
      sender.sendMessage(color + chosenOther.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",element.getName() + element.getType().getBender()));
    }
 else {
      target.sendMessage(color + chosen.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);
    for (    SubElement sub : Element.getAllSubElements()) {
      if (sub.getParentElement() == element && 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());
}