Program: 10333
Project: 10333
Buggy source:
/** 
 * Gets the InteractScript from a NPC Denizen for a Player and returns the appropriate ScriptContainer. Returns null if no script found.
 * @param npc  the NPC involved
 * @param player  the Player involved
 * @param trigger  the class of the trigger being used
 * @return  the highest priority InteractScriptContainer that meets requirements, if any.
 */
public static InteractScriptContainer getInteractScript(dNPC npc,dPlayer player,Class<? extends AbstractTrigger> trigger){
  if (npc == null || player == null || trigger == null)   return null;
  AssignmentScriptContainer assignmentScript=npc.getAssignmentTrait().getAssignment();
  if (assignmentScript == null)   return null;
  List<String> assignedScripts=new ArrayList<String>();
  if (assignmentScript.contains("String_Node_Str"))   assignedScripts=assignmentScript.getStringList("String_Node_Str");
  if (assignedScripts.isEmpty())   return null;
  dB.log(dB.DebugElement.Header + "String_Node_Str" + npc.getName()+ "String_Node_Str"+ player.getName());
  List<PriorityPair> interactableScripts=new ArrayList<PriorityPair>();
  for (  String entry : assignedScripts) {
    entry=entry.toUpperCase();
    String name=null;
    Integer priority;
    if (Character.isDigit(entry.charAt(0))) {
      try {
        priority=Integer.valueOf(entry.split("String_Node_Str",2)[0]);
        name=entry.split("String_Node_Str",2)[1].replace("String_Node_Str","String_Node_Str");
      }
 catch (      Exception e) {
        dB.echoError("String_Node_Str" + entry + "String_Node_Str");
        continue;
      }
    }
 else {
      dB.echoError("String_Node_Str" + name + "String_Node_Str");
      name=entry;
      entry="String_Node_Str" + entry;
      priority=0;
    }
    try {
      InteractScriptContainer interactScript=ScriptRegistry.getScriptContainerAs(name,InteractScriptContainer.class);
      if (interactScript != null) {
        if (interactScript.checkBaseRequirements(player,npc)) {
          dB.echoApproval("String_Node_Str" + entry + "String_Node_Str");
          if (interactScript.checkCooldown(player))           interactableScripts.add(new PriorityPair(priority,entry.split("String_Node_Str",2)[1]));
 else           dB.log(ChatColor.GOLD + "String_Node_Str");
        }
 else {
          dB.log("String_Node_Str" + entry + "String_Node_Str");
        }
      }
 else {
        dB.log("String_Node_Str" + entry + "String_Node_Str");
      }
    }
 catch (    Exception e) {
      dB.echoError(ChatColor.RED + "String_Node_Str" + entry+ "String_Node_Str");
      dB.echoError(e);
    }
    dB.log(dB.DebugElement.Spacer,null);
  }
  if (interactableScripts.size() == 1) {
    String script=interactableScripts.get(0).getName();
    dB.echoApproval("String_Node_Str" + script + "String_Node_Str");
    dB.log(dB.DebugElement.Footer.toString());
    return ScriptRegistry.getScriptContainerAs(script.replace("String_Node_Str","String_Node_Str"),InteractScriptContainer.class);
  }
 else   if (interactableScripts.isEmpty()) {
    dB.log(ChatColor.YELLOW + "String_Node_Str" + ChatColor.WHITE+ "String_Node_Str");
    dB.log(dB.DebugElement.Footer.toString());
    return null;
  }
 else   Collections.sort(interactableScripts);
  for (int a=interactableScripts.size() - 1; a >= 0; a--) {
    InteractScriptContainer interactScript=ScriptRegistry.getScriptContainerAs(interactableScripts.get(a).name.replace("String_Node_Str","String_Node_Str"),InteractScriptContainer.class);
    dB.log("String_Node_Str" + interactableScripts.get(a).getName() + "String_Node_Str");
    if (interactableScripts.get(a).getName().startsWith("String_Node_Str")) {
      if (interactScript.containsTriggerInStep(getCurrentStep(player,interactScript.getName()),trigger)) {
        dB.log("String_Node_Str");
        dB.echoApproval("String_Node_Str" + interactScript.getName() + "String_Node_Str");
        dB.log(dB.DebugElement.Footer.toString());
        return interactScript;
      }
 else       dB.log("String_Node_Str");
    }
 else {
      dB.log("String_Node_Str");
      dB.echoApproval("String_Node_Str" + interactScript.getName() + "String_Node_Str");
      dB.log("String_Node_Str" + getCurrentStep(player,interactScript.getName()));
      dB.log(dB.DebugElement.Footer.toString());
      return interactScript;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the InteractScript from a NPC Denizen for a Player and returns the appropriate ScriptContainer. Returns null if no script found.
 * @param npc  the NPC involved
 * @param player  the Player involved
 * @param trigger  the class of the trigger being used
 * @return  the highest priority InteractScriptContainer that meets requirements, if any.
 */
public static InteractScriptContainer getInteractScript(dNPC npc,dPlayer player,Class<? extends AbstractTrigger> trigger){
  if (npc == null || player == null || trigger == null)   return null;
  AssignmentScriptContainer assignmentScript=npc.getAssignmentTrait().getAssignment();
  if (assignmentScript == null)   return null;
  List<String> assignedScripts=new ArrayList<String>();
  if (assignmentScript.contains("String_Node_Str"))   assignedScripts=assignmentScript.getStringList("String_Node_Str");
  if (assignedScripts.isEmpty())   return null;
  dB.log(dB.DebugElement.Header,"String_Node_Str" + npc.getName() + "String_Node_Str"+ player.getName());
  List<PriorityPair> interactableScripts=new ArrayList<PriorityPair>();
  for (  String entry : assignedScripts) {
    entry=entry.toUpperCase();
    String name=null;
    Integer priority;
    if (Character.isDigit(entry.charAt(0))) {
      try {
        priority=Integer.valueOf(entry.split("String_Node_Str",2)[0]);
        name=entry.split("String_Node_Str",2)[1].replace("String_Node_Str","String_Node_Str");
      }
 catch (      Exception e) {
        dB.echoError("String_Node_Str" + entry + "String_Node_Str");
        continue;
      }
    }
 else {
      dB.echoError("String_Node_Str" + name + "String_Node_Str");
      name=entry;
      entry="String_Node_Str" + entry;
      priority=0;
    }
    try {
      InteractScriptContainer interactScript=ScriptRegistry.getScriptContainerAs(name,InteractScriptContainer.class);
      if (interactScript != null) {
        if (interactScript.checkBaseRequirements(player,npc)) {
          dB.echoApproval("String_Node_Str" + entry + "String_Node_Str");
          if (interactScript.checkCooldown(player))           interactableScripts.add(new PriorityPair(priority,entry.split("String_Node_Str",2)[1]));
 else           dB.log(ChatColor.GOLD + "String_Node_Str");
        }
 else {
          dB.log("String_Node_Str" + entry + "String_Node_Str");
        }
      }
 else {
        dB.log("String_Node_Str" + entry + "String_Node_Str");
      }
    }
 catch (    Exception e) {
      dB.echoError(ChatColor.RED + "String_Node_Str" + entry+ "String_Node_Str");
      dB.echoError(e);
    }
    dB.log(dB.DebugElement.Spacer,null);
  }
  if (interactableScripts.size() == 1) {
    String script=interactableScripts.get(0).getName();
    dB.echoApproval("String_Node_Str" + script + "String_Node_Str");
    dB.log(dB.DebugElement.Footer,"String_Node_Str");
    return ScriptRegistry.getScriptContainerAs(script.replace("String_Node_Str","String_Node_Str"),InteractScriptContainer.class);
  }
 else   if (interactableScripts.isEmpty()) {
    dB.log(ChatColor.YELLOW + "String_Node_Str" + ChatColor.WHITE+ "String_Node_Str");
    dB.log(dB.DebugElement.Footer,"String_Node_Str");
    return null;
  }
 else   Collections.sort(interactableScripts);
  for (int a=interactableScripts.size() - 1; a >= 0; a--) {
    InteractScriptContainer interactScript=ScriptRegistry.getScriptContainerAs(interactableScripts.get(a).name.replace("String_Node_Str","String_Node_Str"),InteractScriptContainer.class);
    dB.log("String_Node_Str" + interactableScripts.get(a).getName() + "String_Node_Str");
    if (interactableScripts.get(a).getName().startsWith("String_Node_Str")) {
      if (interactScript.containsTriggerInStep(getCurrentStep(player,interactScript.getName()),trigger)) {
        dB.log("String_Node_Str");
        dB.echoApproval("String_Node_Str" + interactScript.getName() + "String_Node_Str");
        dB.log(dB.DebugElement.Footer,"String_Node_Str");
        return interactScript;
      }
 else       dB.log("String_Node_Str");
    }
 else {
      dB.log("String_Node_Str");
      dB.echoApproval("String_Node_Str" + interactScript.getName() + "String_Node_Str");
      dB.log("String_Node_Str" + getCurrentStep(player,interactScript.getName()));
      dB.log(dB.DebugElement.Footer,"String_Node_Str");
      return interactScript;
    }
  }
  return null;
}