Program: 57991
Project: 57991
Buggy source:
@Override public boolean onCommand(final CommandCaller caller,final String... args){
  final PlotPlayer plr=(PlotPlayer)caller.getSuperCaller();
  if (args.length == 0) {
    MainUtil.sendMessage(plr,C.CLUSTER_AVAILABLE_ARGS);
    return false;
  }
  final String sub=args[0].toLowerCase();
switch (sub) {
case "String_Node_Str":
case "String_Node_Str":
{
      if (!Permissions.hasPermission(plr,"String_Node_Str")) {
        MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
        return false;
      }
      if (args.length != 1) {
        MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
        return false;
      }
      final HashSet<PlotCluster> clusters=ClusterManager.getClusters(plr.getLocation().getWorld());
      MainUtil.sendMessage(plr,C.CLUSTER_LIST_HEADING,clusters.size() + "String_Node_Str");
      for (      final PlotCluster cluster : clusters) {
        final String name="String_Node_Str" + cluster.getName() + "String_Node_Str"+ cluster.toString();
        if (UUIDHandler.getUUID(plr).equals(cluster.owner)) {
          MainUtil.sendMessage(plr,C.CLUSTER_LIST_ELEMENT,"String_Node_Str" + name);
        }
 else         if (cluster.helpers.contains(UUIDHandler.getUUID(plr))) {
          MainUtil.sendMessage(plr,C.CLUSTER_LIST_ELEMENT,"String_Node_Str" + name);
        }
 else         if (cluster.invited.contains(UUIDHandler.getUUID(plr))) {
          MainUtil.sendMessage(plr,C.CLUSTER_LIST_ELEMENT,"String_Node_Str" + name);
        }
 else {
          MainUtil.sendMessage(plr,C.CLUSTER_LIST_ELEMENT,cluster.toString());
        }
      }
      return true;
    }
case "String_Node_Str":
case "String_Node_Str":
{
    if (!Permissions.hasPermission(plr,"String_Node_Str")) {
      MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
      return false;
    }
    if (args.length != 4) {
      final PlotId id=ClusterManager.estimatePlotId(plr.getLocation());
      MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
      MainUtil.sendMessage(plr,C.CLUSTER_CURRENT_PLOTID,"String_Node_Str" + id);
      return false;
    }
    PlotId pos1=MainUtil.parseId(args[2]);
    PlotId pos2=MainUtil.parseId(args[3]);
    if ((pos1 == null) || (pos2 == null)) {
      MainUtil.sendMessage(plr,C.NOT_VALID_PLOT_ID);
      return false;
    }
    final String name=args[1];
    for (    final PlotCluster cluster : ClusterManager.getClusters(plr.getLocation().getWorld())) {
      if (name.equals(cluster.getName())) {
        MainUtil.sendMessage(plr,C.ALIAS_IS_TAKEN);
        return false;
      }
    }
    final PlotClusterId id=new PlotClusterId(pos1,pos2);
    final HashSet<PlotCluster> intersects=ClusterManager.getIntersects(plr.getLocation().getWorld(),id);
    if ((intersects.size() > 0)) {
      MainUtil.sendMessage(plr,C.CLUSTER_INTERSECTION,intersects.size() + "String_Node_Str");
      return false;
    }
    if ((pos2.x < pos1.x) || (pos2.y < pos1.y)) {
      pos1=new PlotId(Math.min(pos1.x,pos2.x),Math.min(pos1.y,pos2.y));
      pos2=new PlotId(Math.max(pos1.x,pos2.x),Math.max(pos1.y,pos2.y));
    }
    final String world=plr.getLocation().getWorld();
    final PlotCluster cluster=new PlotCluster(world,pos1,pos2,UUIDHandler.getUUID(plr));
    cluster.settings.setAlias(name);
    DBFunc.createCluster(world,cluster);
    if (!ClusterManager.clusters.containsKey(world)) {
      ClusterManager.clusters.put(world,new HashSet<PlotCluster>());
    }
    ClusterManager.clusters.get(world).add(cluster);
    for (    final Plot plot : PS.get().getPlots(plr.getLocation().getWorld()).values()) {
      final PlotCluster current=ClusterManager.getCluster(plot);
      if (cluster.equals(current) && !cluster.isAdded(plot.owner)) {
        cluster.invited.add(plot.owner);
        DBFunc.setInvited(world,cluster,plot.owner);
      }
    }
    PlotWorld plotworld=PS.get().getPlotWorld(world);
    if (plotworld == null) {
      PS.get().config.createSection("String_Node_Str" + world);
      PS.get().loadWorld(world,null);
    }
 else {
      final String gen_string=PS.get().config.getString("String_Node_Str" + world + "String_Node_Str"+ "String_Node_Str");
      BukkitPlotGenerator generator;
      if (gen_string == null) {
        generator=new HybridGen(world);
      }
 else {
        ChunkGenerator chunkgen=(ChunkGenerator)PS.get().IMP.getGenerator(world,gen_string).generator;
        if (chunkgen instanceof BukkitPlotGenerator) {
          generator=(BukkitPlotGenerator)chunkgen;
        }
 else {
          MainUtil.sendMessage(plr,C.SETUP_INVALID_GENERATOR,StringMan.join(SetupUtils.generators.keySet(),"String_Node_Str"));
          return false;
        }
      }
      new AugmentedPopulator(world,generator,cluster,plotworld.TERRAIN == 2,plotworld.TERRAIN != 2);
    }
    MainUtil.sendMessage(plr,C.CLUSTER_ADDED);
    return true;
  }
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
  if (!Permissions.hasPermission(plr,"String_Node_Str")) {
    MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
    return false;
  }
  if ((args.length != 1) && (args.length != 2)) {
    MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
    return false;
  }
  PlotCluster cluster;
  if (args.length == 2) {
    cluster=ClusterManager.getCluster(plr.getLocation().getWorld(),args[1]);
    if (cluster == null) {
      MainUtil.sendMessage(plr,C.INVALID_CLUSTER,args[1]);
      return false;
    }
  }
 else {
    cluster=ClusterManager.getCluster(plr.getLocation());
    if (cluster == null) {
      MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
      return false;
    }
  }
  if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
    if (!Permissions.hasPermission(plr,"String_Node_Str")) {
      MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
      return false;
    }
  }
  final PlotWorld plotworld=PS.get().getPlotWorld(plr.getLocation().getWorld());
  if (plotworld.TYPE == 2) {
    final ArrayList<Plot> toRemove=new ArrayList<>();
    for (    final Plot plot : PS.get().getPlots(plr.getLocation().getWorld()).values()) {
      final PlotCluster other=ClusterManager.getCluster(plot);
      if (cluster.equals(other)) {
        toRemove.add(plot);
      }
    }
    for (    final Plot plot : toRemove) {
      plot.unclaim();
    }
  }
  DBFunc.delete(cluster);
  if (plotworld.TYPE == 2) {
    AugmentedPopulator.removePopulator(plr.getLocation().getWorld(),cluster);
  }
  ClusterManager.last=null;
  ClusterManager.clusters.get(cluster.world).remove(cluster);
  ClusterManager.regenCluster(cluster);
  MainUtil.sendMessage(plr,C.CLUSTER_DELETED);
  return true;
}
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
  MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
  return false;
}
if (args.length != 3) {
  MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
  return false;
}
final PlotId pos1=MainUtil.parseId(args[1]);
final PlotId pos2=MainUtil.parseId(args[2]);
if ((pos1 == null) || (pos2 == null)) {
  MainUtil.sendMessage(plr,C.NOT_VALID_PLOT_ID);
  return false;
}
final PlotCluster cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
  MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
  return false;
}
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
  if (!Permissions.hasPermission(plr,"String_Node_Str")) {
    MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
    return false;
  }
}
final PlotClusterId id=new PlotClusterId(pos1,pos2);
final HashSet<PlotCluster> intersects=ClusterManager.getIntersects(plr.getLocation().getWorld(),id);
if (intersects.size() > 1) {
  MainUtil.sendMessage(plr,C.CLUSTER_INTERSECTION,(intersects.size() - 1) + "String_Node_Str");
  return false;
}
DBFunc.resizeCluster(cluster,id);
MainUtil.sendMessage(plr,C.CLUSTER_RESIZED);
return true;
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if ((args.length != 1) && (args.length != 2)) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
PlotCluster cluster;
if (args.length == 2) {
cluster=ClusterManager.getCluster(plr.getLocation().getWorld(),args[1]);
if (cluster == null) {
  MainUtil.sendMessage(plr,C.INVALID_CLUSTER,args[1]);
  return false;
}
}
 else {
cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
  MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
  return false;
}
}
if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
  MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
  return false;
}
}
ClusterManager.regenCluster(cluster);
MainUtil.sendMessage(plr,C.CLUSTER_REGENERATED);
return true;
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if (args.length != 2) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
final PlotCluster cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
return false;
}
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
}
final UUID uuid=UUIDHandler.getUUID(args[1]);
if (uuid == null) {
MainUtil.sendMessage(plr,C.INVALID_PLAYER,args[2]);
return false;
}
if (!cluster.isAdded(uuid)) {
cluster.invited.add(uuid);
final String world=plr.getLocation().getWorld();
DBFunc.setInvited(world,cluster,uuid);
final PlotPlayer player=UUIDHandler.getPlayer(uuid);
if (player != null) {
MainUtil.sendMessage(player,C.CLUSTER_INVITED,cluster.getName());
}
}
MainUtil.sendMessage(plr,C.CLUSTER_ADDED_USER);
return true;
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if (args.length != 2) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
final PlotCluster cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
return false;
}
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
}
final UUID uuid=UUIDHandler.getUUID(args[1]);
if (uuid == null) {
MainUtil.sendMessage(plr,C.INVALID_PLAYER,args[1]);
return false;
}
if (uuid.equals(UUIDHandler.getUUID(plr)) || uuid.equals(cluster.owner) || !cluster.isAdded(uuid)) {
MainUtil.sendMessage(plr,C.CANNOT_KICK_PLAYER,cluster.getName());
return false;
}
if (cluster.helpers.contains(uuid)) {
cluster.helpers.remove(uuid);
DBFunc.removeHelper(cluster,uuid);
}
cluster.invited.remove(uuid);
DBFunc.removeInvited(cluster,uuid);
final PlotPlayer player=UUIDHandler.getPlayer(uuid);
if (player != null) {
MainUtil.sendMessage(player,C.CLUSTER_REMOVED,cluster.getName());
}
for (final Plot plot : new ArrayList<>(PS.get().getPlots(plr.getLocation().getWorld(),uuid))) {
final PlotCluster current=ClusterManager.getCluster(plot);
if ((current != null) && current.equals(cluster)) {
final String world=plr.getLocation().getWorld();
plot.unclaim();
}
}
MainUtil.sendMessage(plr,C.CLUSTER_KICKED_USER);
return true;
}
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if ((args.length != 1) && (args.length != 2)) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
PlotCluster cluster;
if (args.length == 2) {
cluster=ClusterManager.getCluster(plr.getLocation().getWorld(),args[1]);
if (cluster == null) {
MainUtil.sendMessage(plr,C.INVALID_CLUSTER,args[1]);
return false;
}
}
 else {
cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
return false;
}
}
final UUID uuid=UUIDHandler.getUUID(plr);
if (!cluster.isAdded(uuid)) {
MainUtil.sendMessage(plr,C.CLUSTER_NOT_ADDED);
return false;
}
if (uuid.equals(cluster.owner)) {
MainUtil.sendMessage(plr,C.CLUSTER_CANNOT_LEAVE);
return false;
}
if (cluster.helpers.contains(uuid)) {
cluster.helpers.remove(uuid);
DBFunc.removeHelper(cluster,uuid);
}
cluster.invited.remove(uuid);
DBFunc.removeInvited(cluster,uuid);
MainUtil.sendMessage(plr,C.CLUSTER_REMOVED,cluster.getName());
for (final Plot plot : new ArrayList<>(PS.get().getPlots(plr.getLocation().getWorld(),uuid))) {
final PlotCluster current=ClusterManager.getCluster(plot);
if ((current != null) && current.equals(cluster)) {
final String world=plr.getLocation().getWorld();
plot.unclaim();
}
}
return true;
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if (args.length != 3) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
final PlotCluster cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
return false;
}
final UUID uuid=UUIDHandler.getUUID(args[2]);
if (uuid == null) {
MainUtil.sendMessage(plr,C.INVALID_PLAYER,args[2]);
return false;
}
if (args[1].toLowerCase().equals("String_Node_Str")) {
cluster.helpers.add(uuid);
DBFunc.setHelper(cluster,uuid);
return MainUtil.sendMessage(plr,C.CLUSTER_ADDED_HELPER);
}
if (args[1].toLowerCase().equals("String_Node_Str")) {
cluster.helpers.remove(uuid);
DBFunc.removeHelper(cluster,uuid);
return MainUtil.sendMessage(plr,C.CLUSTER_REMOVED_HELPER);
}
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if (args.length != 2) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
final PlotCluster cluster=ClusterManager.getCluster(plr.getLocation().getWorld(),args[1]);
if (cluster == null) {
MainUtil.sendMessage(plr,C.INVALID_CLUSTER,args[1]);
return false;
}
final UUID uuid=UUIDHandler.getUUID(plr);
if (!cluster.isAdded(uuid)) {
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
}
plr.teleport(ClusterManager.getHome(cluster));
return MainUtil.sendMessage(plr,C.CLUSTER_TELEPORTING);
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if ((args.length != 1) && (args.length != 2)) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
PlotCluster cluster;
if (args.length == 2) {
cluster=ClusterManager.getCluster(plr.getLocation().getWorld(),args[1]);
if (cluster == null) {
MainUtil.sendMessage(plr,C.INVALID_CLUSTER,args[1]);
return false;
}
}
 else {
cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
return false;
}
}
final String id=cluster.toString();
String owner=UUIDHandler.getName(cluster.owner);
if (owner == null) {
owner="String_Node_Str";
}
final String name=cluster.getName();
final String size=((cluster.getP2().x - cluster.getP1().x) + 1) + "String_Node_Str" + ((cluster.getP2().y - cluster.getP1().y) + 1);
final String rights=cluster.isAdded(UUIDHandler.getUUID(plr)) + "String_Node_Str";
String message=C.CLUSTER_INFO.s();
message=message.replaceAll("String_Node_Str",id);
message=message.replaceAll("String_Node_Str",owner);
message=message.replaceAll("String_Node_Str",name);
message=message.replaceAll("String_Node_Str",size);
message=message.replaceAll("String_Node_Str",rights);
MainUtil.sendMessage(plr,message);
return true;
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if ((args.length != 1) && (args.length != 2)) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
final PlotCluster cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
return false;
}
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
}
final Location base=ClusterManager.getClusterBottom(cluster);
final Location relative=plr.getLocation().subtract(base.getX(),0,base.getZ());
final BlockLoc blockloc=new BlockLoc(relative.getX(),relative.getY(),relative.getZ());
cluster.settings.setPosition(blockloc);
DBFunc.setPosition(cluster,relative.getX() + "String_Node_Str" + relative.getY()+ "String_Node_Str"+ relative.getZ());
return MainUtil.sendMessage(plr,C.POSITION_SET);
}
}
MainUtil.sendMessage(plr,C.CLUSTER_AVAILABLE_ARGS);
return false;
}

Fixed version (ground truth):
@Override public boolean onCommand(final CommandCaller caller,final String... args){
  final PlotPlayer plr=(PlotPlayer)caller.getSuperCaller();
  if (args.length == 0) {
    MainUtil.sendMessage(plr,C.CLUSTER_AVAILABLE_ARGS);
    return false;
  }
  final String sub=args[0].toLowerCase();
switch (sub) {
case "String_Node_Str":
case "String_Node_Str":
{
      if (!Permissions.hasPermission(plr,"String_Node_Str")) {
        MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
        return false;
      }
      if (args.length != 1) {
        MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
        return false;
      }
      final HashSet<PlotCluster> clusters=ClusterManager.getClusters(plr.getLocation().getWorld());
      MainUtil.sendMessage(plr,C.CLUSTER_LIST_HEADING,clusters.size() + "String_Node_Str");
      for (      final PlotCluster cluster : clusters) {
        final String name="String_Node_Str" + cluster.getName() + "String_Node_Str"+ cluster.toString();
        if (UUIDHandler.getUUID(plr).equals(cluster.owner)) {
          MainUtil.sendMessage(plr,C.CLUSTER_LIST_ELEMENT,"String_Node_Str" + name);
        }
 else         if (cluster.helpers.contains(UUIDHandler.getUUID(plr))) {
          MainUtil.sendMessage(plr,C.CLUSTER_LIST_ELEMENT,"String_Node_Str" + name);
        }
 else         if (cluster.invited.contains(UUIDHandler.getUUID(plr))) {
          MainUtil.sendMessage(plr,C.CLUSTER_LIST_ELEMENT,"String_Node_Str" + name);
        }
 else {
          MainUtil.sendMessage(plr,C.CLUSTER_LIST_ELEMENT,cluster.toString());
        }
      }
      return true;
    }
case "String_Node_Str":
case "String_Node_Str":
{
    if (!Permissions.hasPermission(plr,"String_Node_Str")) {
      MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
      return false;
    }
    if (args.length != 4) {
      final PlotId id=ClusterManager.estimatePlotId(plr.getLocation());
      MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
      MainUtil.sendMessage(plr,C.CLUSTER_CURRENT_PLOTID,"String_Node_Str" + id);
      return false;
    }
    PlotId pos1=MainUtil.parseId(args[2]);
    PlotId pos2=MainUtil.parseId(args[3]);
    if ((pos1 == null) || (pos2 == null)) {
      MainUtil.sendMessage(plr,C.NOT_VALID_PLOT_ID);
      return false;
    }
    final String name=args[1];
    for (    final PlotCluster cluster : ClusterManager.getClusters(plr.getLocation().getWorld())) {
      if (name.equals(cluster.getName())) {
        MainUtil.sendMessage(plr,C.ALIAS_IS_TAKEN);
        return false;
      }
    }
    final PlotClusterId id=new PlotClusterId(pos1,pos2);
    final HashSet<PlotCluster> intersects=ClusterManager.getIntersects(plr.getLocation().getWorld(),id);
    if ((intersects.size() > 0)) {
      MainUtil.sendMessage(plr,C.CLUSTER_INTERSECTION,intersects.size() + "String_Node_Str");
      return false;
    }
    if ((pos2.x < pos1.x) || (pos2.y < pos1.y)) {
      pos1=new PlotId(Math.min(pos1.x,pos2.x),Math.min(pos1.y,pos2.y));
      pos2=new PlotId(Math.max(pos1.x,pos2.x),Math.max(pos1.y,pos2.y));
    }
    final String world=plr.getLocation().getWorld();
    final PlotCluster cluster=new PlotCluster(world,pos1,pos2,UUIDHandler.getUUID(plr));
    cluster.settings.setAlias(name);
    DBFunc.createCluster(world,cluster);
    if (!ClusterManager.clusters.containsKey(world)) {
      ClusterManager.clusters.put(world,new HashSet<PlotCluster>());
    }
    ClusterManager.clusters.get(world).add(cluster);
    for (    final Plot plot : PS.get().getPlots(plr.getLocation().getWorld()).values()) {
      final PlotCluster current=ClusterManager.getCluster(plot);
      if (cluster.equals(current) && !cluster.isAdded(plot.owner)) {
        cluster.invited.add(plot.owner);
        DBFunc.setInvited(world,cluster,plot.owner);
      }
    }
    PlotWorld plotworld=PS.get().getPlotWorld(world);
    if (plotworld == null) {
      PS.get().config.createSection("String_Node_Str" + world);
      PS.get().loadWorld(world,null);
    }
 else {
      final String gen_string=PS.get().config.getString("String_Node_Str" + world + "String_Node_Str"+ "String_Node_Str");
      BukkitPlotGenerator generator;
      if (gen_string == null) {
        generator=new HybridGen(world);
      }
 else {
        ChunkGenerator chunkgen=(ChunkGenerator)PS.get().IMP.getGenerator(world,gen_string).generator;
        if (chunkgen instanceof BukkitPlotGenerator) {
          generator=(BukkitPlotGenerator)chunkgen;
        }
 else {
          MainUtil.sendMessage(plr,C.SETUP_INVALID_GENERATOR,StringMan.join(SetupUtils.generators.keySet(),"String_Node_Str"));
          return false;
        }
      }
      new AugmentedPopulator(world,generator,cluster,plotworld.TERRAIN == 2,plotworld.TERRAIN != 2);
    }
    MainUtil.sendMessage(plr,C.CLUSTER_ADDED);
    return true;
  }
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
  if (!Permissions.hasPermission(plr,"String_Node_Str")) {
    MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
    return false;
  }
  if ((args.length != 1) && (args.length != 2)) {
    MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
    return false;
  }
  PlotCluster cluster;
  if (args.length == 2) {
    cluster=ClusterManager.getCluster(plr.getLocation().getWorld(),args[1]);
    if (cluster == null) {
      MainUtil.sendMessage(plr,C.INVALID_CLUSTER,args[1]);
      return false;
    }
  }
 else {
    cluster=ClusterManager.getCluster(plr.getLocation());
    if (cluster == null) {
      MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
      return false;
    }
  }
  if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
    if (!Permissions.hasPermission(plr,"String_Node_Str")) {
      MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
      return false;
    }
  }
  final PlotWorld plotworld=PS.get().getPlotWorld(plr.getLocation().getWorld());
  if (plotworld.TYPE == 2) {
    final ArrayList<Plot> toRemove=new ArrayList<>();
    for (    final Plot plot : PS.get().getPlots(plr.getLocation().getWorld()).values()) {
      final PlotCluster other=ClusterManager.getCluster(plot);
      if (cluster.equals(other)) {
        toRemove.add(plot);
      }
    }
    for (    final Plot plot : toRemove) {
      plot.unclaim();
    }
  }
  DBFunc.delete(cluster);
  if (plotworld.TYPE == 2) {
    AugmentedPopulator.removePopulator(plr.getLocation().getWorld(),cluster);
  }
  ClusterManager.last=null;
  ClusterManager.clusters.get(cluster.world).remove(cluster);
  ClusterManager.regenCluster(cluster);
  MainUtil.sendMessage(plr,C.CLUSTER_DELETED);
  return true;
}
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
  MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
  return false;
}
if (args.length != 3) {
  MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
  return false;
}
final PlotId pos1=MainUtil.parseId(args[1]);
final PlotId pos2=MainUtil.parseId(args[2]);
if ((pos1 == null) || (pos2 == null)) {
  MainUtil.sendMessage(plr,C.NOT_VALID_PLOT_ID);
  return false;
}
final PlotCluster cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
  MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
  return false;
}
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
  if (!Permissions.hasPermission(plr,"String_Node_Str")) {
    MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
    return false;
  }
}
final PlotClusterId id=new PlotClusterId(pos1,pos2);
final HashSet<PlotCluster> intersects=ClusterManager.getIntersects(plr.getLocation().getWorld(),id);
if (intersects.size() > 1) {
  MainUtil.sendMessage(plr,C.CLUSTER_INTERSECTION,(intersects.size() - 1) + "String_Node_Str");
  return false;
}
DBFunc.resizeCluster(cluster,id);
MainUtil.sendMessage(plr,C.CLUSTER_RESIZED);
return true;
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if ((args.length != 1) && (args.length != 2)) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
PlotCluster cluster;
if (args.length == 2) {
cluster=ClusterManager.getCluster(plr.getLocation().getWorld(),args[1]);
if (cluster == null) {
  MainUtil.sendMessage(plr,C.INVALID_CLUSTER,args[1]);
  return false;
}
}
 else {
cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
  MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
  return false;
}
}
if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
  MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
  return false;
}
}
ClusterManager.regenCluster(cluster);
MainUtil.sendMessage(plr,C.CLUSTER_REGENERATED);
return true;
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if (args.length != 2) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
final PlotCluster cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
return false;
}
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
}
final UUID uuid=UUIDHandler.getUUID(args[1],null);
if (uuid == null) {
MainUtil.sendMessage(plr,C.INVALID_PLAYER,args[2]);
return false;
}
if (!cluster.isAdded(uuid)) {
cluster.invited.add(uuid);
final String world=plr.getLocation().getWorld();
DBFunc.setInvited(world,cluster,uuid);
final PlotPlayer player=UUIDHandler.getPlayer(uuid);
if (player != null) {
MainUtil.sendMessage(player,C.CLUSTER_INVITED,cluster.getName());
}
}
MainUtil.sendMessage(plr,C.CLUSTER_ADDED_USER);
return true;
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if (args.length != 2) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
final PlotCluster cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
return false;
}
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
}
final UUID uuid=UUIDHandler.getUUID(args[1],null);
if (uuid == null) {
MainUtil.sendMessage(plr,C.INVALID_PLAYER,args[1]);
return false;
}
if (uuid.equals(UUIDHandler.getUUID(plr)) || uuid.equals(cluster.owner) || !cluster.isAdded(uuid)) {
MainUtil.sendMessage(plr,C.CANNOT_KICK_PLAYER,cluster.getName());
return false;
}
if (cluster.helpers.contains(uuid)) {
cluster.helpers.remove(uuid);
DBFunc.removeHelper(cluster,uuid);
}
cluster.invited.remove(uuid);
DBFunc.removeInvited(cluster,uuid);
final PlotPlayer player=UUIDHandler.getPlayer(uuid);
if (player != null) {
MainUtil.sendMessage(player,C.CLUSTER_REMOVED,cluster.getName());
}
for (final Plot plot : new ArrayList<>(PS.get().getPlots(plr.getLocation().getWorld(),uuid))) {
final PlotCluster current=ClusterManager.getCluster(plot);
if ((current != null) && current.equals(cluster)) {
final String world=plr.getLocation().getWorld();
plot.unclaim();
}
}
MainUtil.sendMessage(plr,C.CLUSTER_KICKED_USER);
return true;
}
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if ((args.length != 1) && (args.length != 2)) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
PlotCluster cluster;
if (args.length == 2) {
cluster=ClusterManager.getCluster(plr.getLocation().getWorld(),args[1]);
if (cluster == null) {
MainUtil.sendMessage(plr,C.INVALID_CLUSTER,args[1]);
return false;
}
}
 else {
cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
return false;
}
}
final UUID uuid=UUIDHandler.getUUID(plr);
if (!cluster.isAdded(uuid)) {
MainUtil.sendMessage(plr,C.CLUSTER_NOT_ADDED);
return false;
}
if (uuid.equals(cluster.owner)) {
MainUtil.sendMessage(plr,C.CLUSTER_CANNOT_LEAVE);
return false;
}
if (cluster.helpers.contains(uuid)) {
cluster.helpers.remove(uuid);
DBFunc.removeHelper(cluster,uuid);
}
cluster.invited.remove(uuid);
DBFunc.removeInvited(cluster,uuid);
MainUtil.sendMessage(plr,C.CLUSTER_REMOVED,cluster.getName());
for (final Plot plot : new ArrayList<>(PS.get().getPlots(plr.getLocation().getWorld(),uuid))) {
final PlotCluster current=ClusterManager.getCluster(plot);
if ((current != null) && current.equals(cluster)) {
final String world=plr.getLocation().getWorld();
plot.unclaim();
}
}
return true;
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if (args.length != 3) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
final PlotCluster cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
return false;
}
final UUID uuid=UUIDHandler.getUUID(args[2],null);
if (uuid == null) {
MainUtil.sendMessage(plr,C.INVALID_PLAYER,args[2]);
return false;
}
if (args[1].toLowerCase().equals("String_Node_Str")) {
cluster.helpers.add(uuid);
DBFunc.setHelper(cluster,uuid);
return MainUtil.sendMessage(plr,C.CLUSTER_ADDED_HELPER);
}
if (args[1].toLowerCase().equals("String_Node_Str")) {
cluster.helpers.remove(uuid);
DBFunc.removeHelper(cluster,uuid);
return MainUtil.sendMessage(plr,C.CLUSTER_REMOVED_HELPER);
}
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if (args.length != 2) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
final PlotCluster cluster=ClusterManager.getCluster(plr.getLocation().getWorld(),args[1]);
if (cluster == null) {
MainUtil.sendMessage(plr,C.INVALID_CLUSTER,args[1]);
return false;
}
final UUID uuid=UUIDHandler.getUUID(plr);
if (!cluster.isAdded(uuid)) {
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
}
plr.teleport(ClusterManager.getHome(cluster));
return MainUtil.sendMessage(plr,C.CLUSTER_TELEPORTING);
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if ((args.length != 1) && (args.length != 2)) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
PlotCluster cluster;
if (args.length == 2) {
cluster=ClusterManager.getCluster(plr.getLocation().getWorld(),args[1]);
if (cluster == null) {
MainUtil.sendMessage(plr,C.INVALID_CLUSTER,args[1]);
return false;
}
}
 else {
cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
return false;
}
}
final String id=cluster.toString();
String owner=UUIDHandler.getName(cluster.owner);
if (owner == null) {
owner="String_Node_Str";
}
final String name=cluster.getName();
final String size=((cluster.getP2().x - cluster.getP1().x) + 1) + "String_Node_Str" + ((cluster.getP2().y - cluster.getP1().y) + 1);
final String rights=cluster.isAdded(UUIDHandler.getUUID(plr)) + "String_Node_Str";
String message=C.CLUSTER_INFO.s();
message=message.replaceAll("String_Node_Str",id);
message=message.replaceAll("String_Node_Str",owner);
message=message.replaceAll("String_Node_Str",name);
message=message.replaceAll("String_Node_Str",size);
message=message.replaceAll("String_Node_Str",rights);
MainUtil.sendMessage(plr,message);
return true;
}
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
{
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
if ((args.length != 1) && (args.length != 2)) {
MainUtil.sendMessage(plr,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
final PlotCluster cluster=ClusterManager.getCluster(plr.getLocation());
if (cluster == null) {
MainUtil.sendMessage(plr,C.NOT_IN_CLUSTER);
return false;
}
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!Permissions.hasPermission(plr,"String_Node_Str")) {
MainUtil.sendMessage(plr,C.NO_PERMISSION,"String_Node_Str");
return false;
}
}
final Location base=ClusterManager.getClusterBottom(cluster);
final Location relative=plr.getLocation().subtract(base.getX(),0,base.getZ());
final BlockLoc blockloc=new BlockLoc(relative.getX(),relative.getY(),relative.getZ());
cluster.settings.setPosition(blockloc);
DBFunc.setPosition(cluster,relative.getX() + "String_Node_Str" + relative.getY()+ "String_Node_Str"+ relative.getZ());
return MainUtil.sendMessage(plr,C.POSITION_SET);
}
}
MainUtil.sendMessage(plr,C.CLUSTER_AVAILABLE_ARGS);
return false;
}