Program: 58026
Project: 58026
Buggy source:
@Override public boolean execute(final PlotPlayer plr,final String... args){
  String world;
  int size_x=1;
  int size_z=1;
  String schematic="String_Node_Str";
  if (PlotSquared.getPlotWorlds().size() == 1) {
    world=PlotSquared.getPlotWorlds().iterator().next();
  }
 else {
    world=plr.getLocation().getWorld();
    if (!PlotSquared.isPlotWorld(world)) {
      MainUtil.sendMessage(plr,C.NOT_IN_PLOT_WORLD);
      return false;
    }
  }
  if (args.length > 0) {
    if (Permissions.hasPermission(plr,"String_Node_Str")) {
      try {
        final String[] split=args[0].split("String_Node_Str");
        size_x=Integer.parseInt(split[0]);
        size_z=Integer.parseInt(split[1]);
        if ((size_x < 1) || (size_z < 1)) {
          MainUtil.sendMessage(plr,"String_Node_Str");
        }
        if ((size_x > 4) || (size_z > 4)) {
          MainUtil.sendMessage(plr,"String_Node_Str");
        }
        if (args.length > 1) {
          schematic=args[1];
        }
      }
 catch (      final Exception e) {
        size_x=1;
        size_z=1;
        schematic=args[0];
      }
    }
 else {
      schematic=args[0];
    }
  }
  if ((size_x * size_z) > Settings.MAX_AUTO_SIZE) {
    MainUtil.sendMessage(plr,C.CANT_CLAIM_MORE_PLOTS_NUM,Settings.MAX_AUTO_SIZE + "String_Node_Str");
    return false;
  }
  final int currentPlots=Settings.GLOBAL_LIMIT ? MainUtil.getPlayerPlotCount(plr) : MainUtil.getPlayerPlotCount(world,plr);
  final int diff=currentPlots - MainUtil.getAllowedPlots(plr);
  if ((diff + (size_x * size_z)) > 0) {
    if (diff < 0) {
      MainUtil.sendMessage(plr,C.CANT_CLAIM_MORE_PLOTS_NUM,(-diff) + "String_Node_Str");
    }
 else {
      MainUtil.sendMessage(plr,C.CANT_CLAIM_MORE_PLOTS);
    }
    return false;
  }
  final PlotWorld pWorld=PlotSquared.getPlotWorld(world);
  if ((PlotSquared.economy != null) && pWorld.USE_ECONOMY) {
    double cost=pWorld.PLOT_PRICE;
    cost=(size_x * size_z) * cost;
    if (cost > 0d) {
      final Economy economy=PlotSquared.economy;
      if (economy.getBalance(plr.getName()) < cost) {
        sendMessage(plr,C.CANNOT_AFFORD_PLOT,"String_Node_Str" + cost);
        return true;
      }
      EconHandler.withdrawPlayer(plr,cost);
      sendMessage(plr,C.REMOVED_BALANCE,cost + "String_Node_Str");
    }
  }
  if (!schematic.equals("String_Node_Str")) {
    if (!pWorld.SCHEMATICS.contains(schematic.toLowerCase())) {
      sendMessage(plr,C.SCHEMATIC_INVALID,"String_Node_Str" + schematic);
      return true;
    }
    if (!Permissions.hasPermission(plr,"String_Node_Str" + schematic) && !plr.hasPermission("String_Node_Str")) {
      MainUtil.sendMessage(plr,C.NO_SCHEMATIC_PERMISSION,schematic);
      return true;
    }
  }
  final String worldname=world;
  final PlotWorld plotworld=PlotSquared.getPlotWorld(worldname);
  if (plotworld.TYPE == 2) {
    final Location loc=plr.getLocation();
    final Plot plot=MainUtil.getPlot(new Location(worldname,loc.getX(),loc.getY(),loc.getZ()));
    if (plot == null) {
      return sendMessage(plr,C.NOT_IN_PLOT);
    }
    final PlotCluster cluster=ClusterManager.getCluster(loc);
    if (cluster == null) {
      MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
      return false;
    }
    final PlotId bot=cluster.getP1();
    final PlotId top=cluster.getP2();
    final PlotId origin=new PlotId((bot.x + top.x) / 2,(bot.y + top.y) / 2);
    PlotId id=new PlotId(0,0);
    final int width=Math.max((top.x - bot.x) + 1,(top.y - bot.y) + 1);
    final int max=width * width;
    for (int i=0; i <= max; i++) {
      final PlotId currentId=new PlotId(origin.x + id.x,origin.y + id.y);
      final Plot current=MainUtil.getPlot(worldname,currentId);
      if (MainUtil.canClaim(plr,current) && (current.settings.isMerged() == false) && cluster.equals(ClusterManager.getCluster(current))) {
        Claim.claimPlot(plr,current,true,true);
        return true;
      }
      id=getNextPlot(id,1);
    }
    MainUtil.sendMessage(plr,C.NO_FREE_PLOTS);
    return false;
  }
  boolean br=false;
  if ((size_x == 1) && (size_z == 1)) {
    while (!br) {
      final Plot plot=MainUtil.getPlot(worldname,getLastPlot(worldname));
      if (MainUtil.canClaim(plr,plot)) {
        Claim.claimPlot(plr,plot,true,true);
        br=true;
      }
      MainUtil.lastPlot.put(worldname,getNextPlot(getLastPlot(worldname),1));
    }
  }
 else {
    boolean lastPlot=true;
    while (!br) {
      final PlotId start=getNextPlot(getLastPlot(worldname),1);
      MainUtil.lastPlot.put(worldname,start);
      if (lastPlot) {
      }
      if ((PlotSquared.getPlots(worldname).get(start) != null) && (PlotSquared.getPlots(worldname).get(start).owner != null)) {
        continue;
      }
 else {
        lastPlot=false;
      }
      final PlotId end=new PlotId((start.x + size_x) - 1,(start.y + size_z) - 1);
      if (MainUtil.canClaim(plr,worldname,start,end)) {
        for (int i=start.x; i <= end.x; i++) {
          for (int j=start.y; j <= end.y; j++) {
            final Plot plot=MainUtil.getPlot(worldname,new PlotId(i,j));
            final boolean teleport=((i == end.x) && (j == end.y));
            Claim.claimPlot(plr,plot,teleport,true);
          }
        }
        if (!MainUtil.mergePlots(worldname,MainUtil.getPlotSelectionIds(start,end),true)) {
          return false;
        }
        br=true;
      }
    }
  }
  MainUtil.lastPlot.put(worldname,new PlotId(0,0));
  return true;
}

Fixed version (ground truth):
@Override public boolean execute(final PlotPlayer plr,final String... args){
  String world;
  int size_x=1;
  int size_z=1;
  String schematic="String_Node_Str";
  if (PlotSquared.getPlotWorlds().size() == 1) {
    world=PlotSquared.getPlotWorlds().iterator().next();
  }
 else {
    world=plr.getLocation().getWorld();
    if (!PlotSquared.isPlotWorld(world)) {
      MainUtil.sendMessage(plr,C.NOT_IN_PLOT_WORLD);
      return false;
    }
  }
  if (args.length > 0) {
    if (Permissions.hasPermission(plr,"String_Node_Str")) {
      try {
        final String[] split=args[0].split("String_Node_Str");
        size_x=Integer.parseInt(split[0]);
        size_z=Integer.parseInt(split[1]);
        if ((size_x < 1) || (size_z < 1)) {
          MainUtil.sendMessage(plr,"String_Node_Str");
        }
        if ((size_x > 4) || (size_z > 4)) {
          MainUtil.sendMessage(plr,"String_Node_Str");
        }
        if (args.length > 1) {
          schematic=args[1];
        }
      }
 catch (      final Exception e) {
        size_x=1;
        size_z=1;
        schematic=args[0];
      }
    }
 else {
      schematic=args[0];
    }
  }
  if ((size_x * size_z) > Settings.MAX_AUTO_SIZE) {
    MainUtil.sendMessage(plr,C.CANT_CLAIM_MORE_PLOTS_NUM,Settings.MAX_AUTO_SIZE + "String_Node_Str");
    return false;
  }
  final int currentPlots=Settings.GLOBAL_LIMIT ? MainUtil.getPlayerPlotCount(plr) : MainUtil.getPlayerPlotCount(world,plr);
  final int diff=currentPlots - MainUtil.getAllowedPlots(plr);
  if ((diff + (size_x * size_z)) > 0) {
    if (diff < 0) {
      MainUtil.sendMessage(plr,C.CANT_CLAIM_MORE_PLOTS_NUM,(-diff) + "String_Node_Str");
    }
 else {
      MainUtil.sendMessage(plr,C.CANT_CLAIM_MORE_PLOTS);
    }
    return false;
  }
  final PlotWorld pWorld=PlotSquared.getPlotWorld(world);
  if ((EconHandler.manager != null) && pWorld.USE_ECONOMY) {
    double cost=pWorld.PLOT_PRICE;
    cost=(size_x * size_z) * cost;
    if (cost > 0d) {
      if (EconHandler.manager.getMoney(plr) < cost) {
        sendMessage(plr,C.CANNOT_AFFORD_PLOT,"String_Node_Str" + cost);
        return true;
      }
      EconHandler.manager.withdrawMoney(plr,cost);
      sendMessage(plr,C.REMOVED_BALANCE,cost + "String_Node_Str");
    }
  }
  if (!schematic.equals("String_Node_Str")) {
    if (!pWorld.SCHEMATICS.contains(schematic.toLowerCase())) {
      sendMessage(plr,C.SCHEMATIC_INVALID,"String_Node_Str" + schematic);
      return true;
    }
    if (!Permissions.hasPermission(plr,"String_Node_Str" + schematic) && !plr.hasPermission("String_Node_Str")) {
      MainUtil.sendMessage(plr,C.NO_SCHEMATIC_PERMISSION,schematic);
      return true;
    }
  }
  final String worldname=world;
  final PlotWorld plotworld=PlotSquared.getPlotWorld(worldname);
  if (plotworld.TYPE == 2) {
    final Location loc=plr.getLocation();
    final Plot plot=MainUtil.getPlot(new Location(worldname,loc.getX(),loc.getY(),loc.getZ()));
    if (plot == null) {
      return sendMessage(plr,C.NOT_IN_PLOT);
    }
    final PlotCluster cluster=ClusterManager.getCluster(loc);
    if (cluster == null) {
      MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
      return false;
    }
    final PlotId bot=cluster.getP1();
    final PlotId top=cluster.getP2();
    final PlotId origin=new PlotId((bot.x + top.x) / 2,(bot.y + top.y) / 2);
    PlotId id=new PlotId(0,0);
    final int width=Math.max((top.x - bot.x) + 1,(top.y - bot.y) + 1);
    final int max=width * width;
    for (int i=0; i <= max; i++) {
      final PlotId currentId=new PlotId(origin.x + id.x,origin.y + id.y);
      final Plot current=MainUtil.getPlot(worldname,currentId);
      if (MainUtil.canClaim(plr,current) && (current.settings.isMerged() == false) && cluster.equals(ClusterManager.getCluster(current))) {
        Claim.claimPlot(plr,current,true,true);
        return true;
      }
      id=getNextPlot(id,1);
    }
    MainUtil.sendMessage(plr,C.NO_FREE_PLOTS);
    return false;
  }
  boolean br=false;
  if ((size_x == 1) && (size_z == 1)) {
    while (!br) {
      final Plot plot=MainUtil.getPlot(worldname,getLastPlot(worldname));
      if (MainUtil.canClaim(plr,plot)) {
        Claim.claimPlot(plr,plot,true,true);
        br=true;
      }
      MainUtil.lastPlot.put(worldname,getNextPlot(getLastPlot(worldname),1));
    }
  }
 else {
    boolean lastPlot=true;
    while (!br) {
      final PlotId start=getNextPlot(getLastPlot(worldname),1);
      MainUtil.lastPlot.put(worldname,start);
      if (lastPlot) {
      }
      if ((PlotSquared.getPlots(worldname).get(start) != null) && (PlotSquared.getPlots(worldname).get(start).owner != null)) {
        continue;
      }
 else {
        lastPlot=false;
      }
      final PlotId end=new PlotId((start.x + size_x) - 1,(start.y + size_z) - 1);
      if (MainUtil.canClaim(plr,worldname,start,end)) {
        for (int i=start.x; i <= end.x; i++) {
          for (int j=start.y; j <= end.y; j++) {
            final Plot plot=MainUtil.getPlot(worldname,new PlotId(i,j));
            final boolean teleport=((i == end.x) && (j == end.y));
            Claim.claimPlot(plr,plot,teleport,true);
          }
        }
        if (!MainUtil.mergePlots(worldname,MainUtil.getPlotSelectionIds(start,end),true)) {
          return false;
        }
        br=true;
      }
    }
  }
  MainUtil.lastPlot.put(worldname,new PlotId(0,0));
  return true;
}