Program: 133869
Project: 133869
Buggy source:
/** 
 * Adds the ability to bend an element to a player.
 * @param sender The CommandSender who issued the add command
 * @param target The player to add the element to
 * @param element The element to add
 */
private void add(CommandSender sender,Player target,String element){
  Element e=Element.fromString(element);
  if (e == null) {
    e=SubElement.fromString(element);
  }
  BendingPlayer bPlayer=BendingPlayer.getBendingPlayer(target);
  if (bPlayer == null) {
    GeneralMethods.createBendingPlayer(target.getUniqueId(),target.getName());
    bPlayer=BendingPlayer.getBendingPlayer(target);
  }
  if (bPlayer.isPermaRemoved()) {
    sender.sendMessage(ChatColor.RED + ConfigManager.languageConfig.get().getString("String_Node_Str"));
    return;
  }
  if (Arrays.asList(Element.getAllElements()).contains(e)) {
    if (bPlayer.hasElement(e)) {
      if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
        sender.sendMessage(ChatColor.RED + alreadyHasElementOther.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + ChatColor.RED));
      }
 else {
        sender.sendMessage(ChatColor.RED + alreadyHasElement);
      }
      return;
    }
    bPlayer.addElement(e);
    for (    SubElement sub : Element.getAllSubElements()) {
      if (sub.getParentElement() == e && bPlayer.hasSubElementPermission(sub)) {
        bPlayer.addSubElement(sub);
      }
    }
    ChatColor color=e.getColor();
    if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
      sender.sendMessage(color + addedOther.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",e.getName() + e.getType().getBender()));
      target.sendMessage(color + added.replace("String_Node_Str",e.getName() + e.getType().getBender()));
    }
 else {
      target.sendMessage(color + added.replace("String_Node_Str",e.getName() + e.getType().getBender()));
    }
    GeneralMethods.saveElements(bPlayer);
    GeneralMethods.saveSubElements(bPlayer);
    Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender,target,e,Result.ADD));
    return;
  }
 else   if (Arrays.asList(Element.getAllSubElements()).contains(e)) {
    SubElement sub=(SubElement)e;
    if (bPlayer.hasSubElement(sub)) {
      if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
        sender.sendMessage(ChatColor.RED + alreadyHasSubElementOther.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + ChatColor.RED));
      }
 else {
        sender.sendMessage(ChatColor.RED + alreadyHasSubElement);
      }
      return;
    }
    bPlayer.addSubElement(sub);
    ChatColor color=e.getColor();
    if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
      sender.sendMessage(color + addedOther.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",sub.getName() + sub.getType().getBender()));
    }
 else {
      target.sendMessage(color + added.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.ADD));
    return;
  }
 else {
    sender.sendMessage(ChatColor.RED + invalidElement);
  }
}

Fixed version (ground truth):
/** 
 * Adds the ability to bend an element to a player.
 * @param sender The CommandSender who issued the add command
 * @param target The player to add the element to
 * @param element The element to add
 */
private void add(CommandSender sender,Player target,String element){
  Element e=Element.fromString(element);
  if (e == null) {
    e=SubElement.fromString(element);
  }
  BendingPlayer bPlayer=BendingPlayer.getBendingPlayer(target);
  if (bPlayer == null) {
    GeneralMethods.createBendingPlayer(target.getUniqueId(),target.getName());
    bPlayer=BendingPlayer.getBendingPlayer(target);
  }
  if (bPlayer.isPermaRemoved()) {
    sender.sendMessage(ChatColor.RED + ConfigManager.languageConfig.get().getString("String_Node_Str"));
    return;
  }
  if (Arrays.asList(Element.getAllElements()).contains(e)) {
    if (bPlayer.hasElement(e)) {
      if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
        sender.sendMessage(ChatColor.RED + alreadyHasElementOther.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + ChatColor.RED));
      }
 else {
        sender.sendMessage(ChatColor.RED + alreadyHasElement);
      }
      return;
    }
    bPlayer.addElement(e);
    for (    SubElement sub : Element.getAllSubElements()) {
      if (sub.getParentElement() == e && bPlayer.hasSubElementPermission(sub)) {
        bPlayer.addSubElement(sub);
      }
    }
    ChatColor color=e.getColor();
    if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
      if (e != Element.AIR && e != Element.EARTH) {
        sender.sendMessage(color + addedOtherCFW.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",e.getName() + e.getType().getBender()));
        target.sendMessage(color + addedCFW.replace("String_Node_Str",e.getName() + e.getType().getBender()));
      }
 else {
        sender.sendMessage(color + addedOtherAE.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",e.getName() + e.getType().getBender()));
        target.sendMessage(color + addedAE.replace("String_Node_Str",e.getName() + e.getType().getBender()));
      }
    }
 else {
      if (e != Element.AIR && e != Element.EARTH)       target.sendMessage(color + addedCFW.replace("String_Node_Str",e.getName() + e.getType().getBender()));
 else       target.sendMessage(color + addedAE.replace("String_Node_Str",e.getName() + e.getType().getBender()));
    }
    GeneralMethods.saveElements(bPlayer);
    GeneralMethods.saveSubElements(bPlayer);
    Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender,target,e,Result.ADD));
    return;
  }
 else   if (Arrays.asList(Element.getAllSubElements()).contains(e)) {
    SubElement sub=(SubElement)e;
    if (bPlayer.hasSubElement(sub)) {
      if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
        sender.sendMessage(ChatColor.RED + alreadyHasSubElementOther.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + ChatColor.RED));
      }
 else {
        sender.sendMessage(ChatColor.RED + alreadyHasSubElement);
      }
      return;
    }
    bPlayer.addSubElement(sub);
    ChatColor color=e.getColor();
    if (!(sender instanceof Player) || !((Player)sender).equals(target)) {
      if (e != Element.AIR && e != Element.EARTH)       sender.sendMessage(color + addedOtherCFW.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",sub.getName() + sub.getType().getBender()));
 else       sender.sendMessage(color + addedOtherAE.replace("String_Node_Str",ChatColor.DARK_AQUA + target.getName() + color).replace("String_Node_Str",sub.getName() + sub.getType().getBender()));
    }
 else {
      if (e != Element.AIR && e != Element.EARTH)       target.sendMessage(color + addedCFW.replace("String_Node_Str",sub.getName() + sub.getType().getBender()));
 else       target.sendMessage(color + addedAE.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.ADD));
    return;
  }
 else {
    sender.sendMessage(ChatColor.RED + invalidElement);
  }
}