Program: 10438
Project: 10438
Buggy source:
@EventHandler public void playerTags(ReplaceableTagEvent event){
  if (!event.matches("String_Node_Str"))   return;
  Player p=event.getPlayer();
  String type=event.getType() != null ? event.getType() : "String_Node_Str";
  String typeContext=event.getTypeContext() != null ? event.getTypeContext() : "String_Node_Str";
  String subType=event.getSubType() != null ? event.getSubType() : "String_Node_Str";
  String subTypeContext=event.getSubTypeContext() != null ? event.getSubTypeContext() : "String_Node_Str";
  String specifier=event.getSpecifier() != null ? event.getSpecifier() : "String_Node_Str";
  String specifierContext=event.getSpecifierContext() != null ? event.getSpecifierContext() : "String_Node_Str";
  if (type.equalsIgnoreCase("String_Node_Str")) {
    StringBuilder players=new StringBuilder();
    if (subType.equalsIgnoreCase("String_Node_Str")) {
      if (specifier.equalsIgnoreCase("String_Node_Str")) {
        for (        Player player : Bukkit.getOnlinePlayers()) {
          if (player.isOp()) {
            players.append(player.getName());
            players.append("String_Node_Str");
          }
        }
      }
 else {
        for (        Player player : Bukkit.getOnlinePlayers()) {
          players.append(player.getName());
          players.append("String_Node_Str");
        }
      }
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      StringBuilder onlinePlayers=new StringBuilder();
      for (      Player player : Bukkit.getOnlinePlayers()) {
        onlinePlayers.append(player.getName());
        onlinePlayers.append("String_Node_Str");
      }
      if (specifier.equalsIgnoreCase("String_Node_Str")) {
        for (        OfflinePlayer player : Bukkit.getOfflinePlayers()) {
          if (player.isOp() && !onlinePlayers.toString().contains(player.getName())) {
            players.append(player.getName());
            players.append("String_Node_Str");
          }
        }
      }
 else {
        for (        OfflinePlayer player : Bukkit.getOfflinePlayers()) {
          if (!onlinePlayers.toString().contains(player.getName())) {
            players.append(player.getName());
            players.append("String_Node_Str");
          }
        }
      }
    }
 else {
      for (      OfflinePlayer player : Bukkit.getOfflinePlayers()) {
        players.append(player.getName());
        players.append("String_Node_Str");
      }
    }
    event.setReplaced(players.toString().substring(0,players.length() - 1));
    return;
  }
  if (event.getPlayer() == null)   return;
  if (type.equalsIgnoreCase("String_Node_Str")) {
    if (event.hasTypeContext()) {
      if (aH.matchesInteger(event.getTypeContext())) {
        if (playerChatHistory.containsKey(event.getPlayer().getName())) {
          List<String> history=playerChatHistory.get(event.getPlayer().getName());
          if (history.size() < aH.getIntegerFrom(event.getTypeContext()))           event.setReplaced(history.get(history.size() - 1));
 else           event.setReplaced(history.get(aH.getIntegerFrom(event.getTypeContext()) - 1));
        }
      }
    }
 else {
      if (playerChatHistory.containsKey(event.getPlayer().getName())) {
        event.setReplaced(playerChatHistory.get(event.getPlayer().getName()).get(0));
      }
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    int range=100;
    if (aH.matchesInteger(typeContext))     range=aH.getIntegerFrom(typeContext);
    if (subType.equalsIgnoreCase("String_Node_Str")) {
      if (specifier.equalsIgnoreCase("String_Node_Str"))       event.setReplaced(String.valueOf(Utilities.getClosestNPC(p.getLocation(),range).getId()));
 else       event.setReplaced(String.valueOf(Utilities.getClosestNPC(p.getLocation(),range).getName()));
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getItemInHand().getAmount()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getItemInHand().getTypeId()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getItemInHand().getDurability()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getItemInHand().getData()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getItemInHand().getMaxStackSize()));
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      if (NBTItem.hasCustomNBT(p.getItemInHand(),"String_Node_Str"))       event.setReplaced(NBTItem.getCustomNBT(p.getItemInHand(),"String_Node_Str"));
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      String enchantments=null;
      if (specifier.equalsIgnoreCase("String_Node_Str"))       enchantments=NBTItem.getEnchantments(p.getItemInHand()).asDScriptListWithLevels();
 else       if (specifier.equalsIgnoreCase("String_Node_Str"))       enchantments=NBTItem.getEnchantments(p.getItemInHand()).asDScriptListLevelsOnly();
 else       enchantments=NBTItem.getEnchantments(p.getItemInHand()).asDScriptList();
      if (enchantments != null && enchantments.length() > 0)       event.setReplaced(enchantments);
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      if (p.getItemInHand().hasItemMeta()) {
        if (p.getItemInHand().getItemMeta().hasLore()) {
          event.setReplaced(new dList(p.getItemInHand().getItemMeta().getLore()).dScriptArgValue());
        }
      }
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getItemInHand().getItemMeta().getDisplayName());
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     if (specifier.equalsIgnoreCase("String_Node_Str")) {
      String itemName=p.getItemInHand().getType().name().toLowerCase().replace('_',' ');
      int itemQty=p.getItemInHand().getAmount();
      if (itemName.equalsIgnoreCase("String_Node_Str")) {
        event.setReplaced("String_Node_Str");
      }
 else       if (itemName.equalsIgnoreCase("String_Node_Str") || itemName.equalsIgnoreCase("String_Node_Str")) {
        event.setReplaced(itemName);
      }
 else       if (itemQty > 1) {
        if (itemName.equalsIgnoreCase("String_Node_Str"))         event.setReplaced("String_Node_Str");
 else         if (itemName.endsWith("String_Node_Str"))         event.setReplaced(itemName.substring(0,itemName.length() - 1) + "String_Node_Str");
 else         if (itemName.endsWith("String_Node_Str"))         event.setReplaced(itemName);
 else         event.setReplaced(itemName + "String_Node_Str");
      }
 else {
        if (itemName.equalsIgnoreCase("String_Node_Str"))         event.setReplaced("String_Node_Str");
 else         if (itemName.endsWith("String_Node_Str"))         event.setReplaced(itemName);
 else         if (itemName.startsWith("String_Node_Str") || itemName.startsWith("String_Node_Str") || itemName.startsWith("String_Node_Str")|| itemName.startsWith("String_Node_Str")|| itemName.startsWith("String_Node_Str"))         event.setReplaced("String_Node_Str" + itemName);
 else         event.setReplaced("String_Node_Str" + itemName);
      }
    }
 else     event.setReplaced(p.getItemInHand().getType().name());
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(p.getName());
    if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getDisplayName());
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getPlayerListName());
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(p.getLocation().getX() + "String_Node_Str" + p.getLocation().getY()+ "String_Node_Str"+ p.getLocation().getZ()+ "String_Node_Str"+ p.getWorld().getName());
    if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getLocation().getBlockX() + "String_Node_Str" + p.getLocation().getBlockY()+ "String_Node_Str"+ p.getLocation().getBlockZ()+ "String_Node_Str"+ p.getWorld().getName());
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced("String_Node_Str" + p.getLocation().getX() + "String_Node_Str"+ p.getLocation().getY()+ "String_Node_Str"+ p.getLocation().getZ()+ "String_Node_Str"+ p.getWorld().getName()+ "String_Node_Str");
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getLocation().getX()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getLocation().getY()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getLocation().getZ()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getWorld().getName());
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      int range=50;
      if (aH.matchesInteger(subTypeContext))       range=aH.getIntegerFrom(subTypeContext);
      event.setReplaced(new Location(p.getTargetBlock(null,range).getLocation()).dScriptArgValue());
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     if (specifier.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getLocation().add(0,-1,0).getBlock().getType().name().toLowerCase().replace('_',' '));
 else     event.setReplaced(p.getLocation().add(0,-1,0).getBlock().getType().name());
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getWorld().getSpawnLocation().getX() + "String_Node_Str" + p.getWorld().getSpawnLocation().getY()+ "String_Node_Str"+ p.getWorld().getSpawnLocation().getZ()+ "String_Node_Str"+ p.getWorld().getName());
 else     if (subType.equalsIgnoreCase("String_Node_Str") && p.getBedSpawnLocation() != null)     event.setReplaced(p.getBedSpawnLocation().getX() + "String_Node_Str" + p.getBedSpawnLocation().getY()+ "String_Node_Str"+ p.getBedSpawnLocation().getZ()+ "String_Node_Str"+ p.getWorld().getName());
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.getHealth()));
    if (subType.equalsIgnoreCase("String_Node_Str")) {
      int maxHealth=p.getMaxHealth();
      if (event.getType().split("String_Node_Str").length > 2)       maxHealth=Integer.valueOf(event.getType().split("String_Node_Str")[2]);
      if ((float)p.getHealth() / maxHealth < .10)       event.setReplaced("String_Node_Str");
 else       if ((float)p.getHealth() / maxHealth < .40)       event.setReplaced("String_Node_Str");
 else       if ((float)p.getHealth() / maxHealth < .75)       event.setReplaced("String_Node_Str");
 else       if ((float)p.getHealth() / maxHealth < 1)       event.setReplaced("String_Node_Str");
 else       event.setReplaced("String_Node_Str");
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      int maxHealth=p.getMaxHealth();
      if (event.getType().split("String_Node_Str").length > 2)       maxHealth=Integer.valueOf(event.getType().split("String_Node_Str")[2]);
      event.setReplaced(String.valueOf(((float)p.getHealth() / maxHealth) * 100));
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.getFoodLevel()));
    if (subType.equalsIgnoreCase("String_Node_Str")) {
      int maxFood=20;
      if (event.getType().split("String_Node_Str").length > 2)       maxFood=Integer.valueOf(event.getType().split("String_Node_Str")[2]);
      if ((float)p.getHealth() / maxFood < .10)       event.setReplaced("String_Node_Str");
 else       if ((float)p.getFoodLevel() / maxFood < .40)       event.setReplaced("String_Node_Str");
 else       if ((float)p.getFoodLevel() / maxFood < .75)       event.setReplaced("String_Node_Str");
 else       if ((float)p.getFoodLevel() / maxFood < 1)       event.setReplaced("String_Node_Str");
 else       event.setReplaced("String_Node_Str");
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      int maxFood=20;
      if (event.getType().split("String_Node_Str").length > 2)       maxFood=Integer.valueOf(event.getType().split("String_Node_Str")[2]);
      event.setReplaced(String.valueOf(((float)p.getFoodLevel() / maxFood) * 100));
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (Depends.economy != null) {
      event.setReplaced(String.valueOf(Depends.economy.getBalance(p.getName())));
      if (subType.equalsIgnoreCase("String_Node_Str"))       event.setReplaced(String.valueOf((int)Depends.economy.getBalance(p.getName())));
 else       if (subType.equalsIgnoreCase("String_Node_Str"))       if (specifier.equalsIgnoreCase("String_Node_Str"))       event.setReplaced(Depends.economy.currencyNameSingular());
 else       event.setReplaced(Depends.economy.currencyNamePlural());
    }
 else {
      dB.echoError("String_Node_Str");
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (Depends.permissions != null) {
      if (subType.equalsIgnoreCase("String_Node_Str"))       event.setReplaced(String.valueOf(Depends.permissions.has((World)null,p.getName(),typeContext)));
 else       event.setReplaced(String.valueOf(Depends.permissions.has(p,typeContext)));
    }
 else {
      dB.echoError("String_Node_Str");
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (Depends.permissions != null) {
      if (subType.equalsIgnoreCase("String_Node_Str"))       event.setReplaced(String.valueOf(Depends.permissions.playerInGroup((World)null,p.getName(),typeContext)));
 else       event.setReplaced(String.valueOf(Depends.permissions.playerInGroup(p,typeContext)));
    }
 else {
      dB.echoError("String_Node_Str");
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getGameMode().getValue()));
 else     event.setReplaced(String.valueOf(p.getGameMode().name()));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.isOp()));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.isBanned()));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.isOnline()));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.isFlying()));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.isSneaking()));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.getPlayerTime()));
    if (subType.equalsIgnoreCase("String_Node_Str")) {
      if (p.getPlayerTime() >= 23000)       event.setReplaced("String_Node_Str");
 else       if (p.getPlayerTime() >= 13500)       event.setReplaced("String_Node_Str");
 else       if (p.getPlayerTime() >= 12500)       event.setReplaced("String_Node_Str");
 else       event.setReplaced("String_Node_Str");
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (p.getWorld().hasStorm())     event.setReplaced("String_Node_Str");
 else     if (p.getPlayerTime() > 13500)     event.setReplaced("String_Node_Str");
 else     event.setReplaced("String_Node_Str");
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (subType.equalsIgnoreCase("String_Node_Str") && p.getInventory().getBoots() != null)     event.setReplaced(p.getInventory().getBoots().getType().name());
 else     if (subType.equalsIgnoreCase("String_Node_Str") && p.getInventory().getChestplate() != null)     event.setReplaced(p.getInventory().getChestplate().getType().name());
 else     if (subType.equalsIgnoreCase("String_Node_Str") && p.getInventory().getHelmet() != null)     event.setReplaced(p.getInventory().getHelmet().getType().name());
 else     if (subType.equalsIgnoreCase("String_Node_Str") && p.getInventory().getLeggings() != null)     event.setReplaced(p.getInventory().getLeggings().getType().name());
 else     event.setReplaced("String_Node_Str");
    if (specifier.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(event.getReplaced().toLowerCase().replace('_',' '));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (aH.matchesScript("String_Node_Str" + typeContext)) {
      int times=0;
      if (subType.equalsIgnoreCase("String_Node_Str")) {
        times=FinishCommand.getScriptCompletes(p.getName(),aH.getStringFrom(typeContext).toUpperCase());
      }
 else       if (subType.equalsIgnoreCase("String_Node_Str")) {
        times=FailCommand.getScriptFails(p.getName(),aH.getStringFrom(typeContext).toUpperCase());
      }
      if (times > 0)       event.setReplaced("String_Node_Str");
 else       event.setReplaced("String_Node_Str");
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (subType.equalsIgnoreCase("String_Node_Str")) {
      if (specifier.equalsIgnoreCase("String_Node_Str")) {
        for (        ItemStack itemstack : event.getPlayer().getInventory().getContents()) {
          if (itemstack != null && itemstack.getItemMeta().getDisplayName() != null) {
            if (itemstack.getItemMeta().getDisplayName().equalsIgnoreCase(specifierContext)) {
              event.setReplaced("String_Node_Str");
              return;
            }
          }
        }
        for (        ItemStack itemstack : event.getPlayer().getInventory().getArmorContents()) {
          if (itemstack.getType().name() != "String_Node_Str" && itemstack.getItemMeta().getDisplayName() != null) {
            if (itemstack.getItemMeta().getDisplayName().equalsIgnoreCase(specifierContext)) {
              event.setReplaced("String_Node_Str");
              return;
            }
          }
        }
        event.setReplaced("String_Node_Str");
      }
 else       if (aH.matchesItem("String_Node_Str" + subTypeContext)) {
        ItemStack item=aH.getItemFrom("String_Node_Str" + subTypeContext);
        if (specifier.equalsIgnoreCase("String_Node_Str") && (aH.matchesQuantity("String_Node_Str" + specifierContext))) {
          int qty=aH.getIntegerFrom(specifierContext);
          event.setReplaced(String.valueOf(event.getPlayer().getInventory().containsAtLeast(item,qty)));
        }
 else         event.setReplaced(String.valueOf(event.getPlayer().getInventory().containsAtLeast(item,1)));
      }
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      int qty=0;
      if (aH.matchesItem("String_Node_Str" + subTypeContext)) {
        ItemStack item=new ItemStack(aH.getItemFrom("String_Node_Str" + subTypeContext));
        qty=Utilities.countItems(item,event.getPlayer().getInventory());
        for (        ItemStack itemstack : event.getPlayer().getInventory().getArmorContents()) {
          if (itemstack.getType().name() != "String_Node_Str") {
            if (itemstack.isSimilar(item))             qty=qty + itemstack.getAmount();
          }
        }
      }
 else {
        qty=Utilities.countItems(event.getPlayer().getInventory());
        for (        ItemStack itemstack : event.getPlayer().getInventory().getArmorContents()) {
          if (itemstack.getType().name() != "String_Node_Str")           qty=qty + itemstack.getAmount();
        }
      }
      event.setReplaced(String.valueOf(qty));
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      int qty=0;
      for (      ItemStack itemstack : event.getPlayer().getInventory().getContents()) {
        if (itemstack != null)         qty++;
      }
      for (      ItemStack itemstack : event.getPlayer().getInventory().getArmorContents()) {
        if (itemstack.getType().name() != "String_Node_Str")         qty++;
      }
      event.setReplaced(String.valueOf(qty));
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(event.getPlayer().getExp() * 100));
    if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getExpToLevel()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getTotalExperience()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getLevel()));
  }
}

Fixed version (ground truth):
@EventHandler public void playerTags(ReplaceableTagEvent event){
  if (!event.matches("String_Node_Str"))   return;
  Player p=event.getPlayer();
  String type=event.getType() != null ? event.getType() : "String_Node_Str";
  String typeContext=event.getTypeContext() != null ? event.getTypeContext() : "String_Node_Str";
  String subType=event.getSubType() != null ? event.getSubType() : "String_Node_Str";
  String subTypeContext=event.getSubTypeContext() != null ? event.getSubTypeContext() : "String_Node_Str";
  String specifier=event.getSpecifier() != null ? event.getSpecifier() : "String_Node_Str";
  String specifierContext=event.getSpecifierContext() != null ? event.getSpecifierContext() : "String_Node_Str";
  if (type.equalsIgnoreCase("String_Node_Str")) {
    StringBuilder players=new StringBuilder();
    if (subType.equalsIgnoreCase("String_Node_Str")) {
      if (specifier.equalsIgnoreCase("String_Node_Str")) {
        for (        Player player : Bukkit.getOnlinePlayers()) {
          if (player.isOp()) {
            players.append(player.getName());
            players.append("String_Node_Str");
          }
        }
      }
 else {
        for (        Player player : Bukkit.getOnlinePlayers()) {
          players.append(player.getName());
          players.append("String_Node_Str");
        }
      }
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      StringBuilder onlinePlayers=new StringBuilder();
      for (      Player player : Bukkit.getOnlinePlayers()) {
        onlinePlayers.append(player.getName());
        onlinePlayers.append("String_Node_Str");
      }
      if (specifier.equalsIgnoreCase("String_Node_Str")) {
        for (        OfflinePlayer player : Bukkit.getOfflinePlayers()) {
          if (player.isOp() && !onlinePlayers.toString().contains(player.getName())) {
            players.append(player.getName());
            players.append("String_Node_Str");
          }
        }
      }
 else {
        for (        OfflinePlayer player : Bukkit.getOfflinePlayers()) {
          if (!onlinePlayers.toString().contains(player.getName())) {
            players.append(player.getName());
            players.append("String_Node_Str");
          }
        }
      }
    }
 else {
      for (      OfflinePlayer player : Bukkit.getOfflinePlayers()) {
        players.append(player.getName());
        players.append("String_Node_Str");
      }
    }
    event.setReplaced(players.toString().substring(0,players.length() - 1));
    return;
  }
  if (event.getPlayer() == null)   return;
  if (type.equalsIgnoreCase("String_Node_Str")) {
    if (event.hasTypeContext()) {
      if (aH.matchesInteger(event.getTypeContext())) {
        if (playerChatHistory.containsKey(event.getPlayer().getName())) {
          List<String> history=playerChatHistory.get(event.getPlayer().getName());
          if (history.size() < aH.getIntegerFrom(event.getTypeContext()))           event.setReplaced(history.get(history.size() - 1));
 else           event.setReplaced(history.get(aH.getIntegerFrom(event.getTypeContext()) - 1));
        }
      }
    }
 else {
      if (playerChatHistory.containsKey(event.getPlayer().getName())) {
        event.setReplaced(playerChatHistory.get(event.getPlayer().getName()).get(0));
      }
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    int range=100;
    if (aH.matchesInteger(typeContext))     range=aH.getIntegerFrom(typeContext);
    if (subType.equalsIgnoreCase("String_Node_Str")) {
      if (specifier.equalsIgnoreCase("String_Node_Str"))       event.setReplaced(String.valueOf(Utilities.getClosestNPC(p.getLocation(),range).getId()));
 else       event.setReplaced(String.valueOf(Utilities.getClosestNPC(p.getLocation(),range).getName()));
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getItemInHand().getAmount()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getItemInHand().getTypeId()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getItemInHand().getDurability()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getItemInHand().getData()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getItemInHand().getMaxStackSize()));
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      if (NBTItem.hasCustomNBT(p.getItemInHand(),"String_Node_Str"))       event.setReplaced(NBTItem.getCustomNBT(p.getItemInHand(),"String_Node_Str"));
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      String enchantments=null;
      if (specifier.equalsIgnoreCase("String_Node_Str"))       enchantments=NBTItem.getEnchantments(p.getItemInHand()).asDScriptListWithLevels();
 else       if (specifier.equalsIgnoreCase("String_Node_Str"))       enchantments=NBTItem.getEnchantments(p.getItemInHand()).asDScriptListLevelsOnly();
 else       enchantments=NBTItem.getEnchantments(p.getItemInHand()).asDScriptList();
      if (enchantments != null && enchantments.length() > 0)       event.setReplaced(enchantments);
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      if (p.getItemInHand().hasItemMeta()) {
        if (p.getItemInHand().getItemMeta().hasLore()) {
          event.setReplaced(new dList(p.getItemInHand().getItemMeta().getLore()).dScriptArgValue());
        }
      }
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getItemInHand().getItemMeta().getDisplayName());
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     if (specifier.equalsIgnoreCase("String_Node_Str")) {
      String itemName=p.getItemInHand().getType().name().toLowerCase().replace('_',' ');
      int itemQty=p.getItemInHand().getAmount();
      if (itemName.equalsIgnoreCase("String_Node_Str")) {
        event.setReplaced("String_Node_Str");
      }
 else       if (itemName.equalsIgnoreCase("String_Node_Str") || itemName.equalsIgnoreCase("String_Node_Str")) {
        event.setReplaced(itemName);
      }
 else       if (itemQty > 1) {
        if (itemName.equalsIgnoreCase("String_Node_Str"))         event.setReplaced("String_Node_Str");
 else         if (itemName.endsWith("String_Node_Str"))         event.setReplaced(itemName.substring(0,itemName.length() - 1) + "String_Node_Str");
 else         if (itemName.endsWith("String_Node_Str"))         event.setReplaced(itemName);
 else         event.setReplaced(itemName + "String_Node_Str");
      }
 else {
        if (itemName.equalsIgnoreCase("String_Node_Str"))         event.setReplaced("String_Node_Str");
 else         if (itemName.endsWith("String_Node_Str"))         event.setReplaced(itemName);
 else         if (itemName.startsWith("String_Node_Str") || itemName.startsWith("String_Node_Str") || itemName.startsWith("String_Node_Str")|| itemName.startsWith("String_Node_Str")|| itemName.startsWith("String_Node_Str"))         event.setReplaced("String_Node_Str" + itemName);
 else         event.setReplaced("String_Node_Str" + itemName);
      }
    }
 else     event.setReplaced(p.getItemInHand().getType().name());
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(p.getName());
    if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getDisplayName());
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getPlayerListName());
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(p.getLocation().getX() + "String_Node_Str" + p.getLocation().getY()+ "String_Node_Str"+ p.getLocation().getZ()+ "String_Node_Str"+ p.getWorld().getName());
    if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getLocation().getBlockX() + "String_Node_Str" + p.getLocation().getBlockY()+ "String_Node_Str"+ p.getLocation().getBlockZ()+ "String_Node_Str"+ p.getWorld().getName());
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced("String_Node_Str" + p.getLocation().getX() + "String_Node_Str"+ p.getLocation().getY()+ "String_Node_Str"+ p.getLocation().getZ()+ "String_Node_Str"+ p.getWorld().getName()+ "String_Node_Str");
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getLocation().getX()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getLocation().getY()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getLocation().getZ()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getWorld().getName());
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      int range=50;
      if (aH.matchesInteger(subTypeContext))       range=aH.getIntegerFrom(subTypeContext);
      event.setReplaced(new Location(p.getTargetBlock(null,range).getLocation()).dScriptArgValue());
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     if (specifier.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getLocation().add(0,-1,0).getBlock().getType().name().toLowerCase().replace('_',' '));
 else     event.setReplaced(p.getLocation().add(0,-1,0).getBlock().getType().name());
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(p.getWorld().getSpawnLocation().getX() + "String_Node_Str" + p.getWorld().getSpawnLocation().getY()+ "String_Node_Str"+ p.getWorld().getSpawnLocation().getZ()+ "String_Node_Str"+ p.getWorld().getName());
 else     if (subType.equalsIgnoreCase("String_Node_Str") && p.getBedSpawnLocation() != null)     event.setReplaced(p.getBedSpawnLocation().getX() + "String_Node_Str" + p.getBedSpawnLocation().getY()+ "String_Node_Str"+ p.getBedSpawnLocation().getZ()+ "String_Node_Str"+ p.getWorld().getName());
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.getHealth()));
    if (subType.equalsIgnoreCase("String_Node_Str")) {
      int maxHealth=p.getMaxHealth();
      if (event.getType().split("String_Node_Str").length > 2)       maxHealth=Integer.valueOf(event.getType().split("String_Node_Str")[2]);
      if ((float)p.getHealth() / maxHealth < .10)       event.setReplaced("String_Node_Str");
 else       if ((float)p.getHealth() / maxHealth < .40)       event.setReplaced("String_Node_Str");
 else       if ((float)p.getHealth() / maxHealth < .75)       event.setReplaced("String_Node_Str");
 else       if ((float)p.getHealth() / maxHealth < 1)       event.setReplaced("String_Node_Str");
 else       event.setReplaced("String_Node_Str");
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      int maxHealth=p.getMaxHealth();
      if (event.getType().split("String_Node_Str").length > 2)       maxHealth=Integer.valueOf(event.getType().split("String_Node_Str")[2]);
      event.setReplaced(String.valueOf(((float)p.getHealth() / maxHealth) * 100));
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.getFoodLevel()));
    if (subType.equalsIgnoreCase("String_Node_Str")) {
      int maxFood=20;
      if (event.getType().split("String_Node_Str").length > 2)       maxFood=Integer.valueOf(event.getType().split("String_Node_Str")[2]);
      if ((float)p.getHealth() / maxFood < .10)       event.setReplaced("String_Node_Str");
 else       if ((float)p.getFoodLevel() / maxFood < .40)       event.setReplaced("String_Node_Str");
 else       if ((float)p.getFoodLevel() / maxFood < .75)       event.setReplaced("String_Node_Str");
 else       if ((float)p.getFoodLevel() / maxFood < 1)       event.setReplaced("String_Node_Str");
 else       event.setReplaced("String_Node_Str");
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      int maxFood=20;
      if (event.getType().split("String_Node_Str").length > 2)       maxFood=Integer.valueOf(event.getType().split("String_Node_Str")[2]);
      event.setReplaced(String.valueOf(((float)p.getFoodLevel() / maxFood) * 100));
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (Depends.economy != null) {
      event.setReplaced(String.valueOf(Depends.economy.getBalance(p.getName())));
      if (subType.equalsIgnoreCase("String_Node_Str"))       event.setReplaced(String.valueOf((int)Depends.economy.getBalance(p.getName())));
 else       if (subType.equalsIgnoreCase("String_Node_Str"))       if (specifier.equalsIgnoreCase("String_Node_Str"))       event.setReplaced(Depends.economy.currencyNameSingular());
 else       event.setReplaced(Depends.economy.currencyNamePlural());
    }
 else {
      dB.echoError("String_Node_Str");
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (Depends.permissions != null) {
      if (subType.equalsIgnoreCase("String_Node_Str"))       event.setReplaced(String.valueOf(Depends.permissions.has((World)null,p.getName(),typeContext)));
 else       event.setReplaced(String.valueOf(Depends.permissions.has(p,typeContext)));
    }
 else {
      dB.echoError("String_Node_Str");
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (Depends.permissions != null) {
      if (subType.equalsIgnoreCase("String_Node_Str"))       event.setReplaced(String.valueOf(Depends.permissions.playerInGroup((World)null,p.getName(),typeContext)));
 else       event.setReplaced(String.valueOf(Depends.permissions.playerInGroup(p,typeContext)));
    }
 else {
      dB.echoError("String_Node_Str");
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getGameMode().getValue()));
 else     event.setReplaced(String.valueOf(p.getGameMode().name()));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.isOp()));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.isBanned()));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.isOnline()));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.isFlying()));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.isSneaking()));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(p.getPlayerTime()));
    if (subType.equalsIgnoreCase("String_Node_Str")) {
      if (p.getPlayerTime() >= 23000)       event.setReplaced("String_Node_Str");
 else       if (p.getPlayerTime() >= 13500)       event.setReplaced("String_Node_Str");
 else       if (p.getPlayerTime() >= 12500)       event.setReplaced("String_Node_Str");
 else       event.setReplaced("String_Node_Str");
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (p.getWorld().hasStorm())     event.setReplaced("String_Node_Str");
 else     if (p.getPlayerTime() > 13500)     event.setReplaced("String_Node_Str");
 else     event.setReplaced("String_Node_Str");
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (subType.equalsIgnoreCase("String_Node_Str") && p.getInventory().getBoots() != null)     event.setReplaced(p.getInventory().getBoots().getType().name());
 else     if (subType.equalsIgnoreCase("String_Node_Str") && p.getInventory().getChestplate() != null)     event.setReplaced(p.getInventory().getChestplate().getType().name());
 else     if (subType.equalsIgnoreCase("String_Node_Str") && p.getInventory().getHelmet() != null)     event.setReplaced(p.getInventory().getHelmet().getType().name());
 else     if (subType.equalsIgnoreCase("String_Node_Str") && p.getInventory().getLeggings() != null)     event.setReplaced(p.getInventory().getLeggings().getType().name());
 else     event.setReplaced("String_Node_Str");
    if (specifier.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(event.getReplaced().toLowerCase().replace('_',' '));
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (aH.matchesScript("String_Node_Str" + typeContext)) {
      int times=0;
      if (subType.equalsIgnoreCase("String_Node_Str")) {
        times=FinishCommand.getScriptCompletes(p.getName(),aH.getStringFrom(typeContext).toUpperCase());
      }
 else       if (subType.equalsIgnoreCase("String_Node_Str")) {
        times=FailCommand.getScriptFails(p.getName(),aH.getStringFrom(typeContext).toUpperCase());
      }
      if (times > 0)       event.setReplaced("String_Node_Str");
 else       event.setReplaced("String_Node_Str");
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    if (subType.equalsIgnoreCase("String_Node_Str")) {
      if (specifier.equalsIgnoreCase("String_Node_Str")) {
        for (        ItemStack itemstack : event.getPlayer().getInventory().getContents()) {
          if (itemstack != null && itemstack.getItemMeta().getDisplayName() != null) {
            if (itemstack.getItemMeta().getDisplayName().equalsIgnoreCase(specifierContext)) {
              event.setReplaced("String_Node_Str");
              return;
            }
          }
        }
        for (        ItemStack itemstack : event.getPlayer().getInventory().getArmorContents()) {
          if (itemstack.getType().name() != "String_Node_Str" && itemstack.getItemMeta().getDisplayName() != null) {
            if (itemstack.getItemMeta().getDisplayName().equalsIgnoreCase(specifierContext)) {
              event.setReplaced("String_Node_Str");
              return;
            }
          }
        }
        event.setReplaced("String_Node_Str");
      }
 else       if (aH.matchesItem("String_Node_Str" + subTypeContext)) {
        ItemStack item=aH.getItemFrom("String_Node_Str" + subTypeContext).getItemStack();
        if (specifier.equalsIgnoreCase("String_Node_Str") && (aH.matchesQuantity("String_Node_Str" + specifierContext))) {
          int qty=aH.getIntegerFrom(specifierContext);
          event.setReplaced(String.valueOf(event.getPlayer().getInventory().containsAtLeast(item,qty)));
        }
 else         event.setReplaced(String.valueOf(event.getPlayer().getInventory().containsAtLeast(item,1)));
      }
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      int qty=0;
      if (aH.matchesItem("String_Node_Str" + subTypeContext)) {
        ItemStack item=new ItemStack(aH.getItemFrom("String_Node_Str" + subTypeContext).getItemStack());
        qty=Utilities.countItems(item,event.getPlayer().getInventory());
        for (        ItemStack itemstack : event.getPlayer().getInventory().getArmorContents()) {
          if (itemstack.getType().name() != "String_Node_Str") {
            if (itemstack.isSimilar(item))             qty=qty + itemstack.getAmount();
          }
        }
      }
 else {
        qty=Utilities.countItems(event.getPlayer().getInventory());
        for (        ItemStack itemstack : event.getPlayer().getInventory().getArmorContents()) {
          if (itemstack.getType().name() != "String_Node_Str")           qty=qty + itemstack.getAmount();
        }
      }
      event.setReplaced(String.valueOf(qty));
    }
 else     if (subType.equalsIgnoreCase("String_Node_Str")) {
      int qty=0;
      for (      ItemStack itemstack : event.getPlayer().getInventory().getContents()) {
        if (itemstack != null)         qty++;
      }
      for (      ItemStack itemstack : event.getPlayer().getInventory().getArmorContents()) {
        if (itemstack.getType().name() != "String_Node_Str")         qty++;
      }
      event.setReplaced(String.valueOf(qty));
    }
  }
 else   if (type.equalsIgnoreCase("String_Node_Str")) {
    event.setReplaced(String.valueOf(event.getPlayer().getExp() * 100));
    if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getExpToLevel()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getTotalExperience()));
 else     if (subType.equalsIgnoreCase("String_Node_Str"))     event.setReplaced(String.valueOf(p.getLevel()));
  }
}