Program: 20634
Project: 20634
Buggy source:
public boolean onCommand(CommandSender sender,Command command,String commandLabel,String[] args){
  boolean validCommand=false;
  Player player;
  if (!(sender instanceof Player)) {
    sender.sendMessage("String_Node_Str");
    return true;
  }
 else {
    player=(Player)sender;
    if (args.length == 0) {
      return false;
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      if (args.length < 2) {
        sender.sendMessage("String_Node_Str");
        return false;
      }
      String gateName=args[1];
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        if (gates.gateName.containsKey(gateName)) {
          sender.sendMessage("String_Node_Str" + gateName + "String_Node_Str"+ gateName+ "String_Node_Str");
          return true;
        }
        getServer().getScheduler().runTaskLaterAsynchronously(this,new KGPlayerInTransit(player,playerListener.inTransit),10);
        Location newLocation=player.getLocation().clone();
        if (args.length == 2) {
          gates.add(gateName,newLocation);
        }
 else         if (args.length == 3) {
          gates.add(gateName,newLocation,args[2],"String_Node_Str");
        }
 else         if (args.length == 4) {
          gates.add(gateName,newLocation,args[2],args[3]);
        }
        sender.sendMessage("String_Node_Str" + gateName + "String_Node_Str");
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      validCommand=true;
      if (args.length < 2) {
        sender.sendMessage("String_Node_Str");
        return false;
      }
      String gateName=args[1];
      if (permit(player,"String_Node_Str")) {
        String newGateCommand="String_Node_Str";
        if (args.length >= 3) {
          StringBuilder sb=new StringBuilder();
          for (int i=2; i < args.length; i++) {
            if (i > 2) {
              sb.append("String_Node_Str");
            }
            sb.append(args[i]);
          }
          newGateCommand=sb.toString();
        }
 else         if (args.length < 2) {
          sender.sendMessage("String_Node_Str");
          sender.sendMessage("String_Node_Str");
          return false;
        }
        if (gates.gateName.containsKey(gateName)) {
          gates.gateName.get(gateName).setCommand(newGateCommand);
          gates.save();
          if (newGateCommand.isEmpty()) {
            player.sendMessage(gateName + "String_Node_Str");
          }
 else {
            player.sendMessage("String_Node_Str" + gateName + "String_Node_Str"+ newGateCommand);
          }
        }
 else {
          player.sendMessage(gateName + "String_Node_Str");
        }
      }
 else {
        player.sendMessage("String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      if (args.length < 2) {
        sender.sendMessage("String_Node_Str");
        return false;
      }
      String gateName=args[1];
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        if (gates.gateName.containsKey(gateName)) {
          getServer().getScheduler().runTaskLaterAsynchronously(this,new KGPlayerInTransit(player,playerListener.inTransit),10);
          Location newLocation=player.getLocation().clone();
          gates.move(gateName,newLocation);
          sender.sendMessage("String_Node_Str" + gateName + "String_Node_Str");
        }
 else {
          player.sendMessage(gateName + "String_Node_Str");
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      if (args.length < 2) {
        sender.sendMessage("String_Node_Str");
        return false;
      }
      String gateName=args[1];
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        gates.remove(gateName);
        sender.sendMessage("String_Node_Str" + gateName + "String_Node_Str");
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        String lookFor=null;
        int gateNum=gates.gates.size();
        int page=0;
        if (args.length == 2) {
          try {
            page=Integer.parseInt(args[1]);
          }
 catch (          NumberFormatException e) {
            lookFor=args[1];
          }
          if (page < 0)           page=0;
          if (page == 0) {
            player.sendMessage(ChatColor.GOLD + "String_Node_Str" + gateNum+ "String_Node_Str"+ plural(gateNum)+ "String_Node_Str"+ lookFor);
          }
 else {
            int gatePages=gateNum + (gateNum % gatesPerPage);
            int pages=(gatePages / gatesPerPage);
            player.sendMessage(ChatColor.GOLD + "String_Node_Str" + gateNum+ "String_Node_Str"+ plural(gateNum)+ "String_Node_Str"+ page+ "String_Node_Str"+ pages);
          }
        }
 else         if (args.length > 2) {
          player.sendMessage(ChatColor.RED + "String_Node_Str");
          return true;
        }
 else {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str" + gateNum+ "String_Node_Str"+ plural(gateNum));
        }
        ArrayList<String> gateList=new ArrayList<String>();
        for (        KGate gate : gates.gates) {
          String gateCommand=gate.getCommand();
          if (gateCommand.isEmpty()) {
            gateCommand="String_Node_Str";
          }
          if (lookFor != null && gate.getName().contains(lookFor)) {
            gateList.add(String.format("String_Node_Str",gate.getName().replace(lookFor,ChatColor.RED + lookFor + ChatColor.RESET),gate.getTargetName(),gateCommand));
          }
 else           if (lookFor != null && gate.getTargetName().contains(lookFor)) {
            gateList.add(String.format("String_Node_Str",gate.getName(),gate.getTargetName().replace(lookFor,ChatColor.RED + lookFor + ChatColor.RESET),gateCommand));
          }
 else           if (lookFor == null) {
            gateList.add(String.format("String_Node_Str",gate.getName(),gate.getTargetName(),command));
          }
        }
        Object[] sorted=gateList.toArray();
        Arrays.sort(sorted);
        if (page > 0) {
          int begin=(gatesPerPage * page) - gatesPerPage;
          int end=begin + gatesPerPage;
          if (sorted.length < begin + 1) {
            player.sendMessage(ChatColor.RED + "String_Node_Str" + page+ "String_Node_Str");
            return true;
          }
          if (end + 1 > sorted.length) {
            end=sorted.length - 1;
          }
          sorted=Arrays.copyOfRange(sorted,begin,end);
        }
        for (        Object gate : sorted) {
          if (gate instanceof String) {
            player.sendMessage((String)gate);
          }
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        loadConfig();
        int gatesLoaded=gates.load();
        int pages=(gatesLoaded + (gatesLoaded % gatesPerPage)) / gatesPerPage;
        player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        player.sendMessage(ChatColor.GOLD + "String_Node_Str" + gatesLoaded+ "String_Node_Str");
        player.sendMessage(ChatColor.GOLD + "String_Node_Str" + gatesPerPage+ "String_Node_Str"+ pages+ "String_Node_Str");
        player.sendMessage(ChatColor.GOLD + "String_Node_Str" + underblock.toString());
        if (defaultTarget.length() > 0) {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str" + defaultTarget+ "String_Node_Str");
        }
 else {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        }
        if (defaultCommand.length() > 0) {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str" + defaultCommand+ "String_Node_Str");
        }
 else {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        }
        if (this.fireEffect) {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        }
 else {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        }
        if (this.verbose) {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        }
 else {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        }
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      if (args.length < 2) {
        sender.sendMessage("String_Node_Str");
        return false;
      }
      String gateName=args[1];
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        if (gates.gateName.containsKey(gateName)) {
          Location destination=gates.gateName.get(gateName).getLocationForTeleport();
          getServer().getScheduler().runTaskLaterAsynchronously(this,new KGPlayerInTransit(player,playerListener.inTransit),20);
          getServer().getScheduler().scheduleSyncDelayedTask(this,new KGPlayerTeleport(player,null,destination,playerListener.frozen,this.fireEffect),1);
          player.teleport(destination);
        }
 else {
          player.sendMessage(gateName + "String_Node_Str");
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        if (ignored.contains(player)) {
          ignored.remove(player);
          playerListener.inTransit.put(player,System.currentTimeMillis());
          player.sendMessage(ChatColor.GREEN + "String_Node_Str");
        }
 else {
          ignored.add(player);
          playerListener.inTransit.put(player,System.currentTimeMillis() + 864000000);
          player.sendMessage(ChatColor.GREEN + "String_Node_Str");
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      if (args.length < 3) {
        sender.sendMessage("String_Node_Str");
        return false;
      }
      String gateFrom=args[1];
      String gateTo=args[2];
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        if (gates.gateName.containsKey(gateFrom)) {
          if (gates.gateName.containsKey(gateTo)) {
            gates.gateName.get(gateFrom).setTargetName(gateTo);
            gates.save();
            sender.sendMessage("String_Node_Str" + gateFrom + "String_Node_Str"+ gateTo+ "String_Node_Str");
          }
 else {
            sender.sendMessage("String_Node_Str" + gateFrom + "String_Node_Str"+ gateTo+ "String_Node_Str");
          }
        }
 else {
          sender.sendMessage("String_Node_Str" + gateFrom + "String_Node_Str"+ gateTo+ "String_Node_Str");
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
  }
  return validCommand;
}

Fixed version (ground truth):
public boolean onCommand(CommandSender sender,Command command,String commandLabel,String[] args){
  boolean validCommand=false;
  Player player;
  if (!(sender instanceof Player)) {
    sender.sendMessage("String_Node_Str");
    return true;
  }
 else {
    player=(Player)sender;
    if (args.length == 0) {
      return false;
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      if (args.length < 2) {
        sender.sendMessage("String_Node_Str");
        return false;
      }
      String gateName=args[1];
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        if (gates.gateName.containsKey(gateName)) {
          sender.sendMessage("String_Node_Str" + gateName + "String_Node_Str"+ gateName+ "String_Node_Str");
          return true;
        }
        getServer().getScheduler().runTaskLaterAsynchronously(this,new KGPlayerInTransit(player,playerListener.inTransit),10);
        Location newLocation=player.getLocation().clone();
        if (args.length == 2) {
          gates.add(gateName,newLocation);
        }
 else         if (args.length == 3) {
          gates.add(gateName,newLocation,args[2],"String_Node_Str");
        }
 else         if (args.length == 4) {
          gates.add(gateName,newLocation,args[2],args[3]);
        }
        sender.sendMessage("String_Node_Str" + gateName + "String_Node_Str");
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      validCommand=true;
      if (args.length < 2) {
        sender.sendMessage("String_Node_Str");
        return false;
      }
      String gateName=args[1];
      if (permit(player,"String_Node_Str")) {
        String newGateCommand="String_Node_Str";
        if (args.length >= 3) {
          StringBuilder sb=new StringBuilder();
          for (int i=2; i < args.length; i++) {
            if (i > 2) {
              sb.append("String_Node_Str");
            }
            sb.append(args[i]);
          }
          newGateCommand=sb.toString();
        }
 else         if (args.length < 2) {
          sender.sendMessage("String_Node_Str");
          sender.sendMessage("String_Node_Str");
          return false;
        }
        if (gates.gateName.containsKey(gateName)) {
          gates.gateName.get(gateName).setCommand(newGateCommand);
          gates.save();
          if (newGateCommand.isEmpty()) {
            player.sendMessage(gateName + "String_Node_Str");
          }
 else {
            player.sendMessage("String_Node_Str" + gateName + "String_Node_Str"+ newGateCommand);
          }
        }
 else {
          player.sendMessage(gateName + "String_Node_Str");
        }
      }
 else {
        player.sendMessage("String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      if (args.length < 2) {
        sender.sendMessage("String_Node_Str");
        return false;
      }
      String gateName=args[1];
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        if (gates.gateName.containsKey(gateName)) {
          getServer().getScheduler().runTaskLaterAsynchronously(this,new KGPlayerInTransit(player,playerListener.inTransit),10);
          Location newLocation=player.getLocation().clone();
          gates.move(gateName,newLocation);
          sender.sendMessage("String_Node_Str" + gateName + "String_Node_Str");
        }
 else {
          player.sendMessage(gateName + "String_Node_Str");
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      if (args.length < 2) {
        sender.sendMessage("String_Node_Str");
        return false;
      }
      String gateName=args[1];
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        gates.remove(gateName);
        sender.sendMessage("String_Node_Str" + gateName + "String_Node_Str");
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        String lookFor=null;
        int gateNum=gates.gates.size();
        int page=0;
        if (args.length == 2) {
          try {
            page=Integer.parseInt(args[1]);
          }
 catch (          NumberFormatException e) {
            lookFor=args[1];
          }
          if (page < 0)           page=0;
          if (page == 0) {
            player.sendMessage(ChatColor.GOLD + "String_Node_Str" + gateNum+ "String_Node_Str"+ plural(gateNum)+ "String_Node_Str"+ lookFor);
          }
 else {
            int gatePages=gateNum + (gateNum % gatesPerPage);
            int pages=(gatePages / gatesPerPage);
            player.sendMessage(ChatColor.GOLD + "String_Node_Str" + gateNum+ "String_Node_Str"+ plural(gateNum)+ "String_Node_Str"+ page+ "String_Node_Str"+ pages);
          }
        }
 else         if (args.length > 2) {
          player.sendMessage(ChatColor.RED + "String_Node_Str");
          return true;
        }
 else {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str" + gateNum+ "String_Node_Str"+ plural(gateNum));
        }
        ArrayList<String> gateList=new ArrayList<String>();
        for (        KGate gate : gates.gates) {
          String gateCommand=gate.getCommand();
          if (gateCommand.isEmpty()) {
            gateCommand="String_Node_Str";
          }
          if (lookFor != null && gate.getName().contains(lookFor)) {
            gateList.add(String.format("String_Node_Str",gate.getName().replace(lookFor,ChatColor.RED + lookFor + ChatColor.RESET),gate.getTargetName(),gateCommand));
          }
 else           if (lookFor != null && gate.getTargetName().contains(lookFor)) {
            gateList.add(String.format("String_Node_Str",gate.getName(),gate.getTargetName().replace(lookFor,ChatColor.RED + lookFor + ChatColor.RESET),gateCommand));
          }
 else           if (lookFor == null) {
            gateList.add(String.format("String_Node_Str",gate.getName(),gate.getTargetName(),gateCommand));
          }
        }
        Object[] sorted=gateList.toArray();
        Arrays.sort(sorted);
        if (page > 0) {
          int begin=(gatesPerPage * page) - gatesPerPage;
          int end=begin + gatesPerPage;
          if (sorted.length < begin + 1) {
            player.sendMessage(ChatColor.RED + "String_Node_Str" + page+ "String_Node_Str");
            return true;
          }
          if (end + 1 > sorted.length) {
            end=sorted.length - 1;
          }
          sorted=Arrays.copyOfRange(sorted,begin,end);
        }
        for (        Object gate : sorted) {
          if (gate instanceof String) {
            player.sendMessage((String)gate);
          }
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        loadConfig();
        int gatesLoaded=gates.load();
        int pages=(gatesLoaded + (gatesLoaded % gatesPerPage)) / gatesPerPage;
        player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        player.sendMessage(ChatColor.GOLD + "String_Node_Str" + gatesLoaded+ "String_Node_Str");
        player.sendMessage(ChatColor.GOLD + "String_Node_Str" + gatesPerPage+ "String_Node_Str"+ pages+ "String_Node_Str");
        player.sendMessage(ChatColor.GOLD + "String_Node_Str" + underblock.toString());
        if (defaultTarget.length() > 0) {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str" + defaultTarget+ "String_Node_Str");
        }
 else {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        }
        if (defaultCommand.length() > 0) {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str" + defaultCommand+ "String_Node_Str");
        }
 else {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        }
        if (this.fireEffect) {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        }
 else {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        }
        if (this.verbose) {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        }
 else {
          player.sendMessage(ChatColor.GOLD + "String_Node_Str");
        }
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      if (args.length < 2) {
        sender.sendMessage("String_Node_Str");
        return false;
      }
      String gateName=args[1];
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        if (gates.gateName.containsKey(gateName)) {
          Location destination=gates.gateName.get(gateName).getLocationForTeleport();
          getServer().getScheduler().runTaskLaterAsynchronously(this,new KGPlayerInTransit(player,playerListener.inTransit),20);
          getServer().getScheduler().scheduleSyncDelayedTask(this,new KGPlayerTeleport(player,null,destination,playerListener.frozen,this.fireEffect),1);
          player.teleport(destination);
        }
 else {
          player.sendMessage(gateName + "String_Node_Str");
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        if (ignored.contains(player)) {
          ignored.remove(player);
          playerListener.inTransit.put(player,System.currentTimeMillis());
          player.sendMessage(ChatColor.GREEN + "String_Node_Str");
        }
 else {
          ignored.add(player);
          playerListener.inTransit.put(player,System.currentTimeMillis() + 864000000);
          player.sendMessage(ChatColor.GREEN + "String_Node_Str");
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else     if (args[0].equalsIgnoreCase("String_Node_Str")) {
      if (args.length < 3) {
        sender.sendMessage("String_Node_Str");
        return false;
      }
      String gateFrom=args[1];
      String gateTo=args[2];
      validCommand=true;
      if (permit(player,"String_Node_Str")) {
        if (gates.gateName.containsKey(gateFrom)) {
          if (gates.gateName.containsKey(gateTo)) {
            gates.gateName.get(gateFrom).setTargetName(gateTo);
            gates.save();
            sender.sendMessage("String_Node_Str" + gateFrom + "String_Node_Str"+ gateTo+ "String_Node_Str");
          }
 else {
            sender.sendMessage("String_Node_Str" + gateFrom + "String_Node_Str"+ gateTo+ "String_Node_Str");
          }
        }
 else {
          sender.sendMessage("String_Node_Str" + gateFrom + "String_Node_Str"+ gateTo+ "String_Node_Str");
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
  }
  return validCommand;
}