This commit is contained in:
boy0001 2015-02-21 22:24:46 +11:00
parent 83f7aa544d
commit cf1ebdb6c8
48 changed files with 422 additions and 422 deletions

View File

@ -34,6 +34,7 @@ import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotCluster; import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.ClusterManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
@ -77,31 +78,30 @@ public class Auto extends SubCommand {
// TODO auto claim a mega plot with schematic // TODO auto claim a mega plot with schematic
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
World world; String world;
int size_x = 1; int size_x = 1;
int size_z = 1; int size_z = 1;
String schematic = ""; String schematic = "";
if (PlotSquared.getPlotWorlds().size() == 1) { if (PlotSquared.getPlotWorlds().size() == 1) {
world = Bukkit.getWorld(PlotSquared.getPlotWorlds().iterator().next()); world = PlotSquared.getPlotWorlds().iterator().next();
} else { } else {
if (PlotSquared.isPlotWorld(plr.getWorld().getName())) { world = plr.getLocation().getWorld();
world = plr.getWorld(); if (!PlotSquared.isPlotWorld(world)) {
} else { MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false; return false;
} }
} }
if (args.length > 0) { if (args.length > 0) {
if (BukkitMain.hasPermission(plr, "plots.auto.mega")) { if (Permissions.hasPermission(plr, "plots.auto.mega")) {
try { try {
final String[] split = args[0].split(","); final String[] split = args[0].split(",");
size_x = Integer.parseInt(split[0]); size_x = Integer.parseInt(split[0]);
size_z = Integer.parseInt(split[1]); size_z = Integer.parseInt(split[1]);
if ((size_x < 1) || (size_z < 1)) { if ((size_x < 1) || (size_z < 1)) {
BukkitPlayerFunctions.sendMessage(plr, "&cError: size<=0"); MainUtil.sendMessage(plr, "&cError: size<=0");
} }
if ((size_x > 4) || (size_z > 4)) { if ((size_x > 4) || (size_z > 4)) {
BukkitPlayerFunctions.sendMessage(plr, "&cError: size>4"); MainUtil.sendMessage(plr, "&cError: size>4");
} }
if (args.length > 1) { if (args.length > 1) {
schematic = args[1]; schematic = args[1];
@ -121,15 +121,15 @@ public class Auto extends SubCommand {
} }
} }
if ((size_x * size_z) > Settings.MAX_AUTO_SIZE) { if ((size_x * size_z) > Settings.MAX_AUTO_SIZE) {
BukkitPlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.MAX_AUTO_SIZE + ""); MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.MAX_AUTO_SIZE + "");
return false; return false;
} }
final int diff = BukkitPlayerFunctions.getPlayerPlotCount(world, plr) - BukkitPlayerFunctions.getAllowedPlots(plr); final int diff = BukkitPlayerFunctions.getPlayerPlotCount(world, plr) - BukkitPlayerFunctions.getAllowedPlots(plr);
if ((diff + (size_x * size_z)) > 0) { if ((diff + (size_x * size_z)) > 0) {
if (diff < 0) { if (diff < 0) {
BukkitPlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, (-diff) + ""); MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, (-diff) + "");
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
} }
return false; return false;
} }
@ -153,8 +153,8 @@ public class Auto extends SubCommand {
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic); sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
return true; return true;
} }
if (!BukkitMain.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) { if (!Permissions.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic); MainUtil.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
return true; return true;
} }
// } // }
@ -170,7 +170,7 @@ public class Auto extends SubCommand {
final PlotCluster cluster = ClusterManager.getCluster(loc); final PlotCluster cluster = ClusterManager.getCluster(loc);
// Must be standing in a cluster // Must be standing in a cluster
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER);
return false; return false;
} }
final PlotId bot = cluster.getP1(); final PlotId bot = cluster.getP1();
@ -190,7 +190,7 @@ public class Auto extends SubCommand {
id = getNextPlot(id, 1); id = getNextPlot(id, 1);
} }
// no free plots // no free plots
BukkitPlayerFunctions.sendMessage(plr, C.NO_FREE_PLOTS); MainUtil.sendMessage(plr, C.NO_FREE_PLOTS);
return false; return false;
} }
boolean br = false; boolean br = false;

View File

@ -19,7 +19,7 @@ public class Ban extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 1) { if (args.length < 1) {
return BukkitPlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage); return MainUtil.sendMessage(plr, "&cUsage: &c" + this.usage);
} }
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);

View File

@ -108,7 +108,7 @@ public class Buy extends SubCommand {
} }
plot.owner = UUIDHandler.getUUID(plr); plot.owner = UUIDHandler.getUUID(plr);
DBFunc.setOwner(plot, plot.owner); DBFunc.setOwner(plot, plot.owner);
BukkitPlayerFunctions.sendMessage(plr, C.CLAIMED); MainUtil.sendMessage(plr, C.CLAIMED);
return true; return true;
} }
} }

View File

@ -115,7 +115,7 @@ public class Claim extends SubCommand {
if (!world.SCHEMATICS.contains(schematic.toLowerCase())) { if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic); return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
} }
if (!BukkitMain.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) { if (!Permissions.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) {
return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic); return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
} }
} }

View File

@ -71,7 +71,7 @@ public class Clear extends SubCommand {
if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
return sendMessage(plr, C.UNLINK_REQUIRED); return sendMessage(plr, C.UNLINK_REQUIRED);
} }
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.clear")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) {
return sendMessage(plr, C.NO_PLOT_PERMS); return sendMessage(plr, C.NO_PLOT_PERMS);
} }
assert plot != null; assert plot != null;

View File

@ -42,7 +42,7 @@ public class Clipboard extends SubCommand {
final int total = selection.getBlocks().length; final int total = selection.getBlocks().length;
String message = C.CLIPBOARD_INFO.s(); String message = C.CLIPBOARD_INFO.s();
message = message.replace("%id", plotId.toString()).replace("%width", width + "").replace("%total", total + ""); message = message.replace("%id", plotId.toString()).replace("%width", width + "").replace("%total", total + "");
BukkitPlayerFunctions.sendMessage(plr, message); MainUtil.sendMessage(plr, message);
return true; return true;
} }
} }

View File

@ -55,62 +55,62 @@ public class Cluster extends SubCommand {
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome // list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
if (args.length == 0) { if (args.length == 0) {
// return arguments // return arguments
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_AVAILABLE_ARGS); MainUtil.sendMessage(plr, C.CLUSTER_AVAILABLE_ARGS);
return false; return false;
} }
final String sub = args[0].toLowerCase(); final String sub = args[0].toLowerCase();
switch (sub) { switch (sub) {
case "l": case "l":
case "list": { case "list": {
if (!BukkitMain.hasPermission(plr, "plots.cluster.list")) { if (!Permissions.hasPermission(plr, "plots.cluster.list")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.list"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.list");
return false; return false;
} }
if (args.length != 1) { if (args.length != 1) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster list"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster list");
return false; return false;
} }
final HashSet<PlotCluster> clusters = ClusterManager.getClusters(plr.getWorld()); final HashSet<PlotCluster> clusters = ClusterManager.getClusters(plr.getWorld());
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_HEADING, clusters.size() + ""); MainUtil.sendMessage(plr, C.CLUSTER_LIST_HEADING, clusters.size() + "");
for (final PlotCluster cluster : clusters) { for (final PlotCluster cluster : clusters) {
// Ignore unmanaged clusters // Ignore unmanaged clusters
final String name = "'" + cluster.getName() + "' : " + cluster.toString(); final String name = "'" + cluster.getName() + "' : " + cluster.toString();
if (UUIDHandler.getUUID(plr).equals(cluster.owner)) { if (UUIDHandler.getUUID(plr).equals(cluster.owner)) {
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&a" + name); MainUtil.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&a" + name);
} else if (cluster.helpers.contains(UUIDHandler.getUUID(plr))) { } else if (cluster.helpers.contains(UUIDHandler.getUUID(plr))) {
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&3" + name); MainUtil.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&3" + name);
} else if (cluster.invited.contains(UUIDHandler.getUUID(plr))) { } else if (cluster.invited.contains(UUIDHandler.getUUID(plr))) {
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&9" + name); MainUtil.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&9" + name);
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, cluster.toString()); MainUtil.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, cluster.toString());
} }
} }
return true; return true;
} }
case "c": case "c":
case "create": { case "create": {
if (!BukkitMain.hasPermission(plr, "plots.cluster.create")) { if (!Permissions.hasPermission(plr, "plots.cluster.create")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.create"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.create");
return false; return false;
} }
if (args.length != 4) { if (args.length != 4) {
final PlotId id = ClusterManager.estimatePlotId(plr.getLocation()); final PlotId id = ClusterManager.estimatePlotId(plr.getLocation());
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster create <name> <id-bot> <id-top>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster create <name> <id-bot> <id-top>");
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_CURRENT_PLOTID, "" + id); MainUtil.sendMessage(plr, C.CLUSTER_CURRENT_PLOTID, "" + id);
return false; return false;
} }
// check pos1 / pos2 // check pos1 / pos2
final PlotId pos1 = MainUtil.parseId(args[2]); final PlotId pos1 = MainUtil.parseId(args[2]);
final PlotId pos2 = MainUtil.parseId(args[3]); final PlotId pos2 = MainUtil.parseId(args[3]);
if ((pos1 == null) || (pos2 == null)) { if ((pos1 == null) || (pos2 == null)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
return false; return false;
} }
// check if name is taken // check if name is taken
final String name = args[1]; final String name = args[1];
for (final PlotCluster cluster : ClusterManager.getClusters(plr.getWorld())) { for (final PlotCluster cluster : ClusterManager.getClusters(plr.getWorld())) {
if (name.equals(cluster.getName())) { if (name.equals(cluster.getName())) {
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN); MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
return false; return false;
} }
} }
@ -118,7 +118,7 @@ public class Cluster extends SubCommand {
final PlotClusterId id = new PlotClusterId(pos1, pos2); final PlotClusterId id = new PlotClusterId(pos1, pos2);
final HashSet<PlotCluster> intersects = ClusterManager.getIntersects(plr.getWorld().getName(), id); final HashSet<PlotCluster> intersects = ClusterManager.getIntersects(plr.getWorld().getName(), id);
if ((intersects.size() > 0) || (pos2.x < pos1.x) || (pos2.y < pos1.y)) { if ((intersects.size() > 0) || (pos2.x < pos1.x) || (pos2.y < pos1.y)) {
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_INTERSECTION, intersects.size() + ""); MainUtil.sendMessage(plr, C.CLUSTER_INTERSECTION, intersects.size() + "");
return false; return false;
} }
// create cluster // create cluster
@ -142,37 +142,37 @@ public class Cluster extends SubCommand {
PlotSquared.config.createSection("worlds." + world); PlotSquared.config.createSection("worlds." + world);
PlotSquared.loadWorld(plr.getWorld()); PlotSquared.loadWorld(plr.getWorld());
} }
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED); MainUtil.sendMessage(plr, C.CLUSTER_ADDED);
return true; return true;
} }
case "disband": case "disband":
case "del": case "del":
case "delete": { case "delete": {
if (!BukkitMain.hasPermission(plr, "plots.cluster.delete")) { if (!Permissions.hasPermission(plr, "plots.cluster.delete")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete");
return false; return false;
} }
if ((args.length != 1) && (args.length != 2)) { if ((args.length != 1) && (args.length != 2)) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster delete [name]"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster delete [name]");
return false; return false;
} }
PlotCluster cluster; PlotCluster cluster;
if (args.length == 2) { if (args.length == 2) {
cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]); cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); MainUtil.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
return false; return false;
} }
} else { } else {
cluster = ClusterManager.getCluster(plr.getLocation()); cluster = ClusterManager.getCluster(plr.getLocation());
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER);
return false; return false;
} }
} }
if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) { if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
if (!BukkitMain.hasPermission(plr, "plots.cluster.delete.other")) { if (!Permissions.hasPermission(plr, "plots.cluster.delete.other")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete.other"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete.other");
return false; return false;
} }
} }
@ -205,35 +205,35 @@ public class Cluster extends SubCommand {
ClusterManager.last = null; ClusterManager.last = null;
ClusterManager.clusters.get(cluster.world).remove(cluster); ClusterManager.clusters.get(cluster.world).remove(cluster);
ClusterManager.regenCluster(cluster); ClusterManager.regenCluster(cluster);
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_DELETED); MainUtil.sendMessage(plr, C.CLUSTER_DELETED);
return true; return true;
} }
case "res": case "res":
case "resize": { case "resize": {
if (!BukkitMain.hasPermission(plr, "plots.cluster.resize")) { if (!Permissions.hasPermission(plr, "plots.cluster.resize")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize");
return false; return false;
} }
if (args.length != 3) { if (args.length != 3) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster resize <pos1> <pos2>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster resize <pos1> <pos2>");
return false; return false;
} }
// check pos1 / pos2 // check pos1 / pos2
final PlotId pos1 = MainUtil.parseId(args[1]); final PlotId pos1 = MainUtil.parseId(args[1]);
final PlotId pos2 = MainUtil.parseId(args[2]); final PlotId pos2 = MainUtil.parseId(args[2]);
if ((pos1 == null) || (pos2 == null)) { if ((pos1 == null) || (pos2 == null)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
return false; return false;
} }
// check if in cluster // check if in cluster
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation()); final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER);
return false; return false;
} }
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) { if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!BukkitMain.hasPermission(plr, "plots.cluster.resize.other")) { if (!Permissions.hasPermission(plr, "plots.cluster.resize.other")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize.other"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize.other");
return false; return false;
} }
} }
@ -241,76 +241,76 @@ public class Cluster extends SubCommand {
final PlotClusterId id = new PlotClusterId(pos1, pos2); final PlotClusterId id = new PlotClusterId(pos1, pos2);
final HashSet<PlotCluster> intersects = ClusterManager.getIntersects(plr.getWorld().getName(), id); final HashSet<PlotCluster> intersects = ClusterManager.getIntersects(plr.getWorld().getName(), id);
if (intersects.size() > 1) { if (intersects.size() > 1) {
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_INTERSECTION, (intersects.size() - 1) + ""); MainUtil.sendMessage(plr, C.CLUSTER_INTERSECTION, (intersects.size() - 1) + "");
return false; return false;
} }
// resize cluster // resize cluster
DBFunc.resizeCluster(cluster, id); DBFunc.resizeCluster(cluster, id);
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_RESIZED); MainUtil.sendMessage(plr, C.CLUSTER_RESIZED);
return true; return true;
} }
case "reg": case "reg":
case "regenerate": case "regenerate":
case "regen": { case "regen": {
if (!BukkitMain.hasPermission(plr, "plots.cluster.delete")) { if (!Permissions.hasPermission(plr, "plots.cluster.delete")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen");
return false; return false;
} }
if ((args.length != 1) && (args.length != 2)) { if ((args.length != 1) && (args.length != 2)) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster regen [name]"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster regen [name]");
return false; return false;
} }
PlotCluster cluster; PlotCluster cluster;
if (args.length == 2) { if (args.length == 2) {
cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]); cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); MainUtil.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
return false; return false;
} }
} else { } else {
cluster = ClusterManager.getCluster(plr.getLocation()); cluster = ClusterManager.getCluster(plr.getLocation());
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER);
return false; return false;
} }
} }
if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) { if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
if (!BukkitMain.hasPermission(plr, "plots.cluster.regen.other")) { if (!Permissions.hasPermission(plr, "plots.cluster.regen.other")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen.other"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen.other");
return false; return false;
} }
} }
ClusterManager.regenCluster(cluster); ClusterManager.regenCluster(cluster);
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_REGENERATED); MainUtil.sendMessage(plr, C.CLUSTER_REGENERATED);
return true; return true;
} }
case "add": case "add":
case "inv": case "inv":
case "invite": { case "invite": {
if (!BukkitMain.hasPermission(plr, "plots.cluster.invite")) { if (!Permissions.hasPermission(plr, "plots.cluster.invite")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite");
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster invite <player>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster invite <player>");
return false; return false;
} }
// check if in cluster // check if in cluster
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation()); final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER);
return false; return false;
} }
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) { if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!BukkitMain.hasPermission(plr, "plots.cluster.invite.other")) { if (!Permissions.hasPermission(plr, "plots.cluster.invite.other")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite.other"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite.other");
return false; return false;
} }
} }
// check uuid // check uuid
final UUID uuid = UUIDHandler.getUUID(args[1]); final UUID uuid = UUIDHandler.getUUID(args[1]);
if (uuid == null) { if (uuid == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[1]);
return false; return false;
} }
if (!cluster.hasRights(uuid)) { if (!cluster.hasRights(uuid)) {
@ -323,40 +323,40 @@ public class Cluster extends SubCommand {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.CLUSTER_INVITED, cluster.getName()); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.CLUSTER_INVITED, cluster.getName());
} }
} }
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED_USER); MainUtil.sendMessage(plr, C.CLUSTER_ADDED_USER);
return true; return true;
} }
case "k": case "k":
case "remove": case "remove":
case "kick": { case "kick": {
if (!BukkitMain.hasPermission(plr, "plots.cluster.kick")) { if (!Permissions.hasPermission(plr, "plots.cluster.kick")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick");
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster kick <player>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster kick <player>");
return false; return false;
} }
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation()); final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER);
return false; return false;
} }
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) { if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!BukkitMain.hasPermission(plr, "plots.cluster.kick.other")) { if (!Permissions.hasPermission(plr, "plots.cluster.kick.other")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick.other"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick.other");
return false; return false;
} }
} }
// check uuid // check uuid
final UUID uuid = UUIDHandler.getUUID(args[1]); final UUID uuid = UUIDHandler.getUUID(args[1]);
if (uuid == null) { if (uuid == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[1]);
return false; return false;
} }
// Can't kick if the player is yourself, the owner, or not added to the cluster // Can't kick if the player is yourself, the owner, or not added to the cluster
if (uuid.equals(UUIDHandler.getUUID(plr)) || uuid.equals(cluster.owner) || !cluster.hasRights(uuid)) { if (uuid.equals(UUIDHandler.getUUID(plr)) || uuid.equals(cluster.owner) || !cluster.hasRights(uuid)) {
BukkitPlayerFunctions.sendMessage(plr, C.CANNOT_KICK_PLAYER, cluster.getName()); MainUtil.sendMessage(plr, C.CANNOT_KICK_PLAYER, cluster.getName());
return false; return false;
} }
if (cluster.helpers.contains(uuid)) { if (cluster.helpers.contains(uuid)) {
@ -376,40 +376,40 @@ public class Cluster extends SubCommand {
DBFunc.delete(world, plot); DBFunc.delete(world, plot);
} }
} }
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_KICKED_USER); MainUtil.sendMessage(plr, C.CLUSTER_KICKED_USER);
return true; return true;
} }
case "quit": case "quit":
case "leave": { case "leave": {
if (!BukkitMain.hasPermission(plr, "plots.cluster.leave")) { if (!Permissions.hasPermission(plr, "plots.cluster.leave")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.leave"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.leave");
return false; return false;
} }
if ((args.length != 1) && (args.length != 2)) { if ((args.length != 1) && (args.length != 2)) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster leave [name]"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster leave [name]");
return false; return false;
} }
PlotCluster cluster; PlotCluster cluster;
if (args.length == 2) { if (args.length == 2) {
cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]); cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); MainUtil.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
return false; return false;
} }
} else { } else {
cluster = ClusterManager.getCluster(plr.getLocation()); cluster = ClusterManager.getCluster(plr.getLocation());
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER);
return false; return false;
} }
} }
final UUID uuid = UUIDHandler.getUUID(plr); final UUID uuid = UUIDHandler.getUUID(plr);
if (!cluster.hasRights(uuid)) { if (!cluster.hasRights(uuid)) {
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_NOT_ADDED); MainUtil.sendMessage(plr, C.CLUSTER_NOT_ADDED);
return false; return false;
} }
if (uuid.equals(cluster.owner)) { if (uuid.equals(cluster.owner)) {
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_CANNOT_LEAVE); MainUtil.sendMessage(plr, C.CLUSTER_CANNOT_LEAVE);
return false; return false;
} }
if (cluster.helpers.contains(uuid)) { if (cluster.helpers.contains(uuid)) {
@ -418,7 +418,7 @@ public class Cluster extends SubCommand {
} }
cluster.invited.remove(uuid); cluster.invited.remove(uuid);
DBFunc.removeInvited(cluster, uuid); DBFunc.removeInvited(cluster, uuid);
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_REMOVED, cluster.getName()); MainUtil.sendMessage(plr, C.CLUSTER_REMOVED, cluster.getName());
for (final Plot plot : PlotSquared.getPlots(plr.getWorld(), uuid)) { for (final Plot plot : PlotSquared.getPlots(plr.getWorld(), uuid)) {
final PlotCluster current = ClusterManager.getCluster(plot); final PlotCluster current = ClusterManager.getCluster(plot);
if ((current != null) && current.equals(cluster)) { if ((current != null) && current.equals(cluster)) {
@ -431,84 +431,84 @@ public class Cluster extends SubCommand {
case "admin": case "admin":
case "helper": case "helper":
case "helpers": { case "helpers": {
if (!BukkitMain.hasPermission(plr, "plots.cluster.helpers")) { if (!Permissions.hasPermission(plr, "plots.cluster.helpers")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.helpers"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.helpers");
return false; return false;
} }
if (args.length != 3) { if (args.length != 3) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers <add|remove> <player>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers <add|remove> <player>");
return false; return false;
} }
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation()); final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER);
return false; return false;
} }
final UUID uuid = UUIDHandler.getUUID(args[2]); final UUID uuid = UUIDHandler.getUUID(args[2]);
if (uuid == null) { if (uuid == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[1]);
return false; return false;
} }
if (args[1].toLowerCase().equals("add")) { if (args[1].toLowerCase().equals("add")) {
cluster.helpers.add(uuid); cluster.helpers.add(uuid);
return BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED_HELPER); return MainUtil.sendMessage(plr, C.CLUSTER_ADDED_HELPER);
} }
if (args[1].toLowerCase().equals("remove")) { if (args[1].toLowerCase().equals("remove")) {
cluster.helpers.remove(uuid); cluster.helpers.remove(uuid);
return BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_REMOVED_HELPER); return MainUtil.sendMessage(plr, C.CLUSTER_REMOVED_HELPER);
} }
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers <add|remove> <player>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers <add|remove> <player>");
return false; return false;
} }
case "spawn": case "spawn":
case "home": case "home":
case "tp": { case "tp": {
if (!BukkitMain.hasPermission(plr, "plots.cluster.tp")) { if (!Permissions.hasPermission(plr, "plots.cluster.tp")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp");
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster tp <name>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster tp <name>");
return false; return false;
} }
final PlotCluster cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]); final PlotCluster cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); MainUtil.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
return false; return false;
} }
final UUID uuid = UUIDHandler.getUUID(plr); final UUID uuid = UUIDHandler.getUUID(plr);
if (!cluster.hasRights(uuid)) { if (!cluster.hasRights(uuid)) {
if (!BukkitMain.hasPermission(plr, "plots.cluster.tp.other")) { if (!Permissions.hasPermission(plr, "plots.cluster.tp.other")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp.other"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp.other");
return false; return false;
} }
} }
plr.teleport(ClusterManager.getHome(cluster)); plr.teleport(ClusterManager.getHome(cluster));
return BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_TELEPORTING); return MainUtil.sendMessage(plr, C.CLUSTER_TELEPORTING);
} }
case "i": case "i":
case "info": case "info":
case "show": case "show":
case "information": { case "information": {
if (!BukkitMain.hasPermission(plr, "plots.cluster.info")) { if (!Permissions.hasPermission(plr, "plots.cluster.info")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.info"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.info");
return false; return false;
} }
if ((args.length != 1) && (args.length != 2)) { if ((args.length != 1) && (args.length != 2)) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster info [name]"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster info [name]");
return false; return false;
} }
PlotCluster cluster; PlotCluster cluster;
if (args.length == 2) { if (args.length == 2) {
cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]); cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); MainUtil.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
return false; return false;
} }
} else { } else {
cluster = ClusterManager.getCluster(plr.getLocation()); cluster = ClusterManager.getCluster(plr.getLocation());
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER);
return false; return false;
} }
} }
@ -526,28 +526,28 @@ public class Cluster extends SubCommand {
message = message.replaceAll("%name%", name); message = message.replaceAll("%name%", name);
message = message.replaceAll("%size%", size); message = message.replaceAll("%size%", size);
message = message.replaceAll("%rights%", rights); message = message.replaceAll("%rights%", rights);
BukkitPlayerFunctions.sendMessage(plr, message); MainUtil.sendMessage(plr, message);
return true; return true;
} }
case "sh": case "sh":
case "setspawn": case "setspawn":
case "sethome": { case "sethome": {
if (!BukkitMain.hasPermission(plr, "plots.cluster.sethome")) { if (!Permissions.hasPermission(plr, "plots.cluster.sethome")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome");
return false; return false;
} }
if ((args.length != 1) && (args.length != 2)) { if ((args.length != 1) && (args.length != 2)) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster sethome"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster sethome");
return false; return false;
} }
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation()); final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
if (cluster == null) { if (cluster == null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER);
return false; return false;
} }
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) { if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
if (!BukkitMain.hasPermission(plr, "plots.cluster.sethome.other")) { if (!Permissions.hasPermission(plr, "plots.cluster.sethome.other")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome.other"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome.other");
return false; return false;
} }
} }
@ -557,10 +557,10 @@ public class Cluster extends SubCommand {
final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ()); final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
cluster.settings.setPosition(blockloc); cluster.settings.setPosition(blockloc);
DBFunc.setPosition(cluster, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ()); DBFunc.setPosition(cluster, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ());
return BukkitPlayerFunctions.sendMessage(plr, C.POSITION_SET); return MainUtil.sendMessage(plr, C.POSITION_SET);
} }
} }
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_AVAILABLE_ARGS); MainUtil.sendMessage(plr, C.CLUSTER_AVAILABLE_ARGS);
return false; return false;
} }
} }

View File

@ -49,7 +49,7 @@ public class Comment extends SubCommand {
} }
final List<String> recipients = Arrays.asList("admin", "owner", "helper", "trusted", "everyone"); final List<String> recipients = Arrays.asList("admin", "owner", "helper", "trusted", "everyone");
if ((args.length > 1) && recipients.contains(args[0].toLowerCase())) { if ((args.length > 1) && recipients.contains(args[0].toLowerCase())) {
if (BukkitMain.hasPermission(plr, "plots.comment." + args[0].toLowerCase())) { if (Permissions.hasPermission(plr, "plots.comment." + args[0].toLowerCase())) {
final String text = StringUtils.join(Arrays.copyOfRange(args, 1, args.length), " "); final String text = StringUtils.join(Arrays.copyOfRange(args, 1, args.length), " ");
final PlotComment comment = new PlotComment(text, plr.getName(), recipients.indexOf(args[0].toLowerCase())); final PlotComment comment = new PlotComment(text, plr.getName(), recipients.indexOf(args[0].toLowerCase()));
plot.settings.addComment(comment); plot.settings.addComment(comment);

View File

@ -48,35 +48,35 @@ public class Condense extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (plr != null) { if (plr != null) {
BukkitPlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE)); MainUtil.sendMessage(plr, (C.NOT_CONSOLE));
return false; return false;
} }
if ((args.length != 2) && (args.length != 3)) { if ((args.length != 2) && (args.length != 3)) {
BukkitPlayerFunctions.sendMessage(plr, "/plot condense <world> <start|stop|info> [radius]"); MainUtil.sendMessage(plr, "/plot condense <world> <start|stop|info> [radius]");
return false; return false;
} }
final String worldname = args[0]; final String worldname = args[0];
final World world = Bukkit.getWorld(worldname); final World world = Bukkit.getWorld(worldname);
if ((world == null) || !PlotSquared.isPlotWorld(worldname)) { if ((world == null) || !PlotSquared.isPlotWorld(worldname)) {
BukkitPlayerFunctions.sendMessage(plr, "INVALID WORLD"); MainUtil.sendMessage(plr, "INVALID WORLD");
return false; return false;
} }
switch (args[1].toLowerCase()) { switch (args[1].toLowerCase()) {
case "start": { case "start": {
if (args.length == 2) { if (args.length == 2) {
BukkitPlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " start <radius>"); MainUtil.sendMessage(plr, "/plot condense " + worldname + " start <radius>");
return false; return false;
} }
if (TASK) { if (TASK) {
BukkitPlayerFunctions.sendMessage(plr, "TASK ALREADY STARTED"); MainUtil.sendMessage(plr, "TASK ALREADY STARTED");
return false; return false;
} }
if (args.length == 2) { if (args.length == 2) {
BukkitPlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " start <radius>"); MainUtil.sendMessage(plr, "/plot condense " + worldname + " start <radius>");
return false; return false;
} }
if (!StringUtils.isNumeric(args[2])) { if (!StringUtils.isNumeric(args[2])) {
BukkitPlayerFunctions.sendMessage(plr, "INVALID RADIUS"); MainUtil.sendMessage(plr, "INVALID RADIUS");
return false; return false;
} }
final int radius = Integer.parseInt(args[2]); final int radius = Integer.parseInt(args[2]);
@ -84,7 +84,7 @@ public class Condense extends SubCommand {
final int size = plots.size(); final int size = plots.size();
final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1); final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1);
if (radius < minimum_radius) { if (radius < minimum_radius) {
BukkitPlayerFunctions.sendMessage(plr, "RADIUS TOO SMALL"); MainUtil.sendMessage(plr, "RADIUS TOO SMALL");
return false; return false;
} }
final List<PlotId> to_move = new ArrayList<>(getPlots(plots, radius)); final List<PlotId> to_move = new ArrayList<>(getPlots(plots, radius));
@ -143,25 +143,25 @@ public class Condense extends SubCommand {
} }
}); });
TASK = true; TASK = true;
BukkitPlayerFunctions.sendMessage(plr, "TASK STARTED..."); MainUtil.sendMessage(plr, "TASK STARTED...");
return true; return true;
} }
case "stop": { case "stop": {
if (!TASK) { if (!TASK) {
BukkitPlayerFunctions.sendMessage(plr, "TASK ALREADY STOPPED"); MainUtil.sendMessage(plr, "TASK ALREADY STOPPED");
return false; return false;
} }
TASK = false; TASK = false;
BukkitPlayerFunctions.sendMessage(plr, "TASK STOPPED"); MainUtil.sendMessage(plr, "TASK STOPPED");
return true; return true;
} }
case "info": { case "info": {
if (args.length == 2) { if (args.length == 2) {
BukkitPlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " info <radius>"); MainUtil.sendMessage(plr, "/plot condense " + worldname + " info <radius>");
return false; return false;
} }
if (!StringUtils.isNumeric(args[2])) { if (!StringUtils.isNumeric(args[2])) {
BukkitPlayerFunctions.sendMessage(plr, "INVALID RADIUS"); MainUtil.sendMessage(plr, "INVALID RADIUS");
return false; return false;
} }
final int radius = Integer.parseInt(args[2]); final int radius = Integer.parseInt(args[2]);
@ -169,23 +169,23 @@ public class Condense extends SubCommand {
final int size = plots.size(); final int size = plots.size();
final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1); final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1);
if (radius < minimum_radius) { if (radius < minimum_radius) {
BukkitPlayerFunctions.sendMessage(plr, "RADIUS TOO SMALL"); MainUtil.sendMessage(plr, "RADIUS TOO SMALL");
return false; return false;
} }
final int max_move = getPlots(plots, minimum_radius).size(); final int max_move = getPlots(plots, minimum_radius).size();
final int user_move = getPlots(plots, radius).size(); final int user_move = getPlots(plots, radius).size();
BukkitPlayerFunctions.sendMessage(plr, "=== DEFAULT EVAL ==="); MainUtil.sendMessage(plr, "=== DEFAULT EVAL ===");
BukkitPlayerFunctions.sendMessage(plr, "MINIMUM RADIUS: " + minimum_radius); MainUtil.sendMessage(plr, "MINIMUM RADIUS: " + minimum_radius);
BukkitPlayerFunctions.sendMessage(plr, "MAXIMUM MOVES: " + max_move); MainUtil.sendMessage(plr, "MAXIMUM MOVES: " + max_move);
BukkitPlayerFunctions.sendMessage(plr, "=== INPUT EVAL ==="); MainUtil.sendMessage(plr, "=== INPUT EVAL ===");
BukkitPlayerFunctions.sendMessage(plr, "INPUT RADIUS: " + radius); MainUtil.sendMessage(plr, "INPUT RADIUS: " + radius);
BukkitPlayerFunctions.sendMessage(plr, "ESTIMATED MOVES: " + user_move); MainUtil.sendMessage(plr, "ESTIMATED MOVES: " + user_move);
BukkitPlayerFunctions.sendMessage(plr, "ESTIMATED TIME: " + "No idea, times will drastically change based on the system performance and load"); MainUtil.sendMessage(plr, "ESTIMATED TIME: " + "No idea, times will drastically change based on the system performance and load");
BukkitPlayerFunctions.sendMessage(plr, "&e - Radius is measured in plot width"); MainUtil.sendMessage(plr, "&e - Radius is measured in plot width");
return true; return true;
} }
} }
BukkitPlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " <start|stop|info> [radius]"); MainUtil.sendMessage(plr, "/plot condense " + worldname + " <start|stop|info> [radius]");
return false; return false;
} }

View File

@ -37,17 +37,17 @@ public class Copy extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return false; return false;
} }
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.copy")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.copy")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }
assert plot != null; assert plot != null;
if (plot.settings.isMerged()) { if (plot.settings.isMerged()) {
BukkitPlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED); MainUtil.sendMessage(plr, C.UNLINK_REQUIRED);
return false; return false;
} }
final int size = (MainUtil.getPlotTopLocAbs(plr.getWorld(), plot.getId()).getBlockX() - MainUtil.getPlotBottomLocAbs(plr.getWorld(), plot.getId()).getBlockX()); final int size = (MainUtil.getPlotTopLocAbs(plr.getWorld(), plot.getId()).getBlockX() - MainUtil.getPlotBottomLocAbs(plr.getWorld(), plot.getId()).getBlockX());

View File

@ -19,7 +19,7 @@ public class DEOP extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 1) { if (args.length < 1) {
return BukkitPlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage); return MainUtil.sendMessage(plr, "&cUsage: &c" + this.usage);
} }
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);

View File

@ -36,7 +36,7 @@ public class Database extends SubCommand {
} else { } else {
final Player p = UUIDHandler.uuidWrapper.getPlayer(uuid); final Player p = UUIDHandler.uuidWrapper.getPlayer(uuid);
if ((p != null) && p.isOnline()) { if ((p != null) && p.isOnline()) {
return BukkitPlayerFunctions.sendMessage(p, msg); return MainUtil.sendMessage(p, msg);
} else { } else {
return sendMessageU(null, msg); return sendMessageU(null, msg);
} }

View File

@ -43,7 +43,7 @@ public class Debug extends SubCommand {
for (final C c : C.values()) { for (final C c : C.values()) {
msg.append(c.s()).append("\n"); msg.append(c.s()).append("\n");
} }
BukkitPlayerFunctions.sendMessage(plr, msg.toString()); MainUtil.sendMessage(plr, msg.toString());
return true; return true;
} }
StringBuilder information; StringBuilder information;
@ -84,7 +84,7 @@ public class Debug extends SubCommand {
information.append(getLine(line, "View all captions", "/plot debug msg")); information.append(getLine(line, "View all captions", "/plot debug msg"));
} }
{ {
BukkitPlayerFunctions.sendMessage(plr, information.toString()); MainUtil.sendMessage(plr, information.toString());
} }
return true; return true;
} }

View File

@ -76,11 +76,11 @@ public class DebugClaimTest extends SubCommand {
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (plr == null) { if (plr == null) {
if (args.length < 3) { if (args.length < 3) {
return !BukkitPlayerFunctions.sendMessage(null, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. \n\n&cMissing world arg /plot debugclaimtest {world} {PlotId min} {PlotId max}"); return !MainUtil.sendMessage(null, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. \n\n&cMissing world arg /plot debugclaimtest {world} {PlotId min} {PlotId max}");
} }
final World world = Bukkit.getWorld(args[0]); final World world = Bukkit.getWorld(args[0]);
if ((world == null) || !PlotSquared.isPlotWorld(world)) { if ((world == null) || !PlotSquared.isPlotWorld(world)) {
return !BukkitPlayerFunctions.sendMessage(null, "&cInvalid plot world!"); return !MainUtil.sendMessage(null, "&cInvalid plot world!");
} }
PlotId min, max; PlotId min, max;
try { try {
@ -89,10 +89,10 @@ public class DebugClaimTest extends SubCommand {
min = new PlotId(Integer.parseInt(split1[0]), Integer.parseInt(split1[1])); min = new PlotId(Integer.parseInt(split1[0]), Integer.parseInt(split1[1]));
max = new PlotId(Integer.parseInt(split2[0]), Integer.parseInt(split2[1])); max = new PlotId(Integer.parseInt(split2[0]), Integer.parseInt(split2[1]));
} catch (final Exception e) { } catch (final Exception e) {
return !BukkitPlayerFunctions.sendMessage(null, "&cInvalid min/max values. &7The values are to Plot IDs in the format &cX;Y &7where X,Y are the plot coords\nThe conversion will only check the plots in the selected area."); return !MainUtil.sendMessage(null, "&cInvalid min/max values. &7The values are to Plot IDs in the format &cX;Y &7where X,Y are the plot coords\nThe conversion will only check the plots in the selected area.");
} }
BukkitPlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Beginning sign to plot conversion. This may take a while..."); MainUtil.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Beginning sign to plot conversion. This may take a while...");
BukkitPlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)"); MainUtil.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)");
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
final PlotWorld plotworld = PlotSquared.getPlotWorld(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final ArrayList<Plot> plots = new ArrayList<>(); final ArrayList<Plot> plots = new ArrayList<>();
@ -100,7 +100,7 @@ public class DebugClaimTest extends SubCommand {
final Plot plot = MainUtil.getPlot(world, id); final Plot plot = MainUtil.getPlot(world, id);
final boolean contains = PlotSquared.getPlots(world).containsKey(plot.id); final boolean contains = PlotSquared.getPlots(world).containsKey(plot.id);
if (contains) { if (contains) {
BukkitPlayerFunctions.sendMessage(null, " - &cDB Already contains: " + plot.id); MainUtil.sendMessage(null, " - &cDB Already contains: " + plot.id);
continue; continue;
} }
final Location loc = manager.getSignLoc(world, plotworld, plot); final Location loc = manager.getSignLoc(world, plotworld, plot);
@ -132,30 +132,30 @@ public class DebugClaimTest extends SubCommand {
uuid = UUIDHandler.getUUID(line); uuid = UUIDHandler.getUUID(line);
} }
if (uuid != null) { if (uuid != null) {
BukkitPlayerFunctions.sendMessage(null, " - &aFound plot: " + plot.id + " : " + line); MainUtil.sendMessage(null, " - &aFound plot: " + plot.id + " : " + line);
plot.owner = uuid; plot.owner = uuid;
plot.hasChanged = true; plot.hasChanged = true;
plots.add(plot); plots.add(plot);
} else { } else {
BukkitPlayerFunctions.sendMessage(null, " - &cInvalid playername: " + plot.id + " : " + line); MainUtil.sendMessage(null, " - &cInvalid playername: " + plot.id + " : " + line);
} }
} }
} }
} }
} }
if (plots.size() > 0) { if (plots.size() > 0) {
BukkitPlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Updating '" + plots.size() + "' plots!"); MainUtil.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Updating '" + plots.size() + "' plots!");
DBFunc.createPlots(plots); DBFunc.createPlots(plots);
DBFunc.createAllSettingsAndHelpers(plots); DBFunc.createAllSettingsAndHelpers(plots);
for (final Plot plot : plots) { for (final Plot plot : plots) {
PlotSquared.updatePlot(plot); PlotSquared.updatePlot(plot);
} }
BukkitPlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Complete!"); MainUtil.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Complete!");
} else { } else {
BukkitPlayerFunctions.sendMessage(null, "No plots were found for the given search."); MainUtil.sendMessage(null, "No plots were found for the given search.");
} }
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, "&6This command can only be executed by console as it has been deemed unsafe if abused."); MainUtil.sendMessage(plr, "&6This command can only be executed by console as it has been deemed unsafe if abused.");
} }
return true; return true;
} }

View File

@ -64,7 +64,7 @@ public class DebugClear extends SubCommand {
final Location pos1 = MainUtil.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1); final Location pos1 = MainUtil.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1);
final Location pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id); final Location pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id);
if (MainUtil.runners.containsKey(plot)) { if (MainUtil.runners.containsKey(plot)) {
BukkitPlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER); MainUtil.sendMessage(null, C.WAIT_FOR_TIMER);
return false; return false;
} }
MainUtil.runners.put(plot, 1); MainUtil.runners.put(plot, 1);
@ -89,7 +89,7 @@ public class DebugClear extends SubCommand {
if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
return sendMessage(plr, C.UNLINK_REQUIRED); return sendMessage(plr, C.UNLINK_REQUIRED);
} }
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.debugclear")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.debugclear")) {
return sendMessage(plr, C.NO_PLOT_PERMS); return sendMessage(plr, C.NO_PLOT_PERMS);
} }
assert plot != null; assert plot != null;
@ -97,7 +97,7 @@ public class DebugClear extends SubCommand {
final Location pos1 = MainUtil.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1); final Location pos1 = MainUtil.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1);
final Location pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id); final Location pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id);
if (MainUtil.runners.containsKey(plot)) { if (MainUtil.runners.containsKey(plot)) {
BukkitPlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER); MainUtil.sendMessage(null, C.WAIT_FOR_TIMER);
return false; return false;
} }
MainUtil.runners.put(plot, 1); MainUtil.runners.put(plot, 1);
@ -105,7 +105,7 @@ public class DebugClear extends SubCommand {
@Override @Override
public void run() { public void run() {
MainUtil.runners.remove(plot); MainUtil.runners.remove(plot);
BukkitPlayerFunctions.sendMessage(plr, "&aDone!"); MainUtil.sendMessage(plr, "&aDone!");
} }
}); });
// sign // sign

View File

@ -59,77 +59,77 @@ public class DebugExec extends SubCommand {
if (ExpireManager.task != -1) { if (ExpireManager.task != -1) {
Bukkit.getScheduler().cancelTask(ExpireManager.task); Bukkit.getScheduler().cancelTask(ExpireManager.task);
} else { } else {
return BukkitPlayerFunctions.sendMessage(null, "Task already halted"); return MainUtil.sendMessage(null, "Task already halted");
} }
ExpireManager.task = -1; ExpireManager.task = -1;
return BukkitPlayerFunctions.sendMessage(null, "Cancelled task."); return MainUtil.sendMessage(null, "Cancelled task.");
} }
case "start-expire": { case "start-expire": {
if (ExpireManager.task == -1) { if (ExpireManager.task == -1) {
ExpireManager.runTask(); ExpireManager.runTask();
} else { } else {
return BukkitPlayerFunctions.sendMessage(null, "Plot expiry task already started"); return MainUtil.sendMessage(null, "Plot expiry task already started");
} }
return BukkitPlayerFunctions.sendMessage(null, "Started plot expiry task"); return MainUtil.sendMessage(null, "Started plot expiry task");
} }
case "update-expired": { case "update-expired": {
if (args.length > 1) { if (args.length > 1) {
final World world = Bukkit.getWorld(args[1]); final World world = Bukkit.getWorld(args[1]);
if (world == null) { if (world == null) {
return BukkitPlayerFunctions.sendMessage(null, "Invalid world: " + args[1]); return MainUtil.sendMessage(null, "Invalid world: " + args[1]);
} }
BukkitPlayerFunctions.sendMessage(null, "Updating expired plot list"); MainUtil.sendMessage(null, "Updating expired plot list");
ExpireManager.updateExpired(args[1]); ExpireManager.updateExpired(args[1]);
return true; return true;
} }
return BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec update-expired <world>"); return MainUtil.sendMessage(null, "Use /plot debugexec update-expired <world>");
} }
case "show-expired": { case "show-expired": {
if (args.length > 1) { if (args.length > 1) {
final World world = Bukkit.getWorld(args[1]); final World world = Bukkit.getWorld(args[1]);
if ((world == null) || !ExpireManager.expiredPlots.containsKey(args[1])) { if ((world == null) || !ExpireManager.expiredPlots.containsKey(args[1])) {
return BukkitPlayerFunctions.sendMessage(null, "Invalid world: " + args[1]); return MainUtil.sendMessage(null, "Invalid world: " + args[1]);
} }
BukkitPlayerFunctions.sendMessage(null, "Expired plots (" + ExpireManager.expiredPlots.get(args[1]).size() + "):"); MainUtil.sendMessage(null, "Expired plots (" + ExpireManager.expiredPlots.get(args[1]).size() + "):");
for (final Entry<Plot, Long> entry : ExpireManager.expiredPlots.get(args[1]).entrySet()) { for (final Entry<Plot, Long> entry : ExpireManager.expiredPlots.get(args[1]).entrySet()) {
final Plot plot = entry.getKey(); final Plot plot = entry.getKey();
final Long stamp = entry.getValue(); final Long stamp = entry.getValue();
BukkitPlayerFunctions.sendMessage(null, " - " + plot.world + ";" + plot.id.x + ";" + plot.id.y + ";" + UUIDHandler.getName(plot.owner) + " : " + stamp); MainUtil.sendMessage(null, " - " + plot.world + ";" + plot.id.x + ";" + plot.id.y + ";" + UUIDHandler.getName(plot.owner) + " : " + stamp);
} }
return true; return true;
} }
return BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec show-expired <world>"); return MainUtil.sendMessage(null, "Use /plot debugexec show-expired <world>");
} }
case "seen": { case "seen": {
if (args.length != 2) { if (args.length != 2) {
return BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec seen <player>"); return MainUtil.sendMessage(null, "Use /plot debugexec seen <player>");
} }
final UUID uuid = UUIDHandler.getUUID(args[1]); final UUID uuid = UUIDHandler.getUUID(args[1]);
if (uuid == null) { if (uuid == null) {
return BukkitPlayerFunctions.sendMessage(null, "player not found: " + args[1]); return MainUtil.sendMessage(null, "player not found: " + args[1]);
} }
final OfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid); final OfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
if ((op == null) || !op.hasPlayedBefore()) { if ((op == null) || !op.hasPlayedBefore()) {
return BukkitPlayerFunctions.sendMessage(null, "player hasn't connected before: " + args[1]); return MainUtil.sendMessage(null, "player hasn't connected before: " + args[1]);
} }
final Timestamp stamp = new Timestamp(op.getLastPlayed()); final Timestamp stamp = new Timestamp(op.getLastPlayed());
final Date date = new Date(stamp.getTime()); final Date date = new Date(stamp.getTime());
BukkitPlayerFunctions.sendMessage(null, "PLAYER: " + args[1]); MainUtil.sendMessage(null, "PLAYER: " + args[1]);
BukkitPlayerFunctions.sendMessage(null, "UUID: " + uuid); MainUtil.sendMessage(null, "UUID: " + uuid);
BukkitPlayerFunctions.sendMessage(null, "Object: " + date.toGMTString()); MainUtil.sendMessage(null, "Object: " + date.toGMTString());
BukkitPlayerFunctions.sendMessage(null, "GMT: " + date.toGMTString()); MainUtil.sendMessage(null, "GMT: " + date.toGMTString());
BukkitPlayerFunctions.sendMessage(null, "Local: " + date.toLocaleString()); MainUtil.sendMessage(null, "Local: " + date.toLocaleString());
return true; return true;
} }
case "trim-check": { case "trim-check": {
if (args.length != 2) { if (args.length != 2) {
BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec trim-check <world>"); MainUtil.sendMessage(null, "Use /plot debugexec trim-check <world>");
BukkitPlayerFunctions.sendMessage(null, "&7 - Generates a list of regions to trim"); MainUtil.sendMessage(null, "&7 - Generates a list of regions to trim");
return BukkitPlayerFunctions.sendMessage(null, "&7 - Run after plot expiry has run"); return MainUtil.sendMessage(null, "&7 - Run after plot expiry has run");
} }
final World world = Bukkit.getWorld(args[1]); final World world = Bukkit.getWorld(args[1]);
if ((world == null) || !PlotSquared.isPlotWorld(args[1])) { if ((world == null) || !PlotSquared.isPlotWorld(args[1])) {
return BukkitPlayerFunctions.sendMessage(null, "Invalid world: " + args[1]); return MainUtil.sendMessage(null, "Invalid world: " + args[1]);
} }
final ArrayList<ChunkLoc> empty = new ArrayList<>(); final ArrayList<ChunkLoc> empty = new ArrayList<>();
final boolean result = Trim.getTrimRegions(empty, world, new Runnable() { final boolean result = Trim.getTrimRegions(empty, world, new Runnable() {
@ -160,7 +160,7 @@ public class DebugExec extends SubCommand {
} }
}); });
if (!result) { if (!result) {
BukkitPlayerFunctions.sendMessage(null, "Trim task already started!"); MainUtil.sendMessage(null, "Trim task already started!");
} }
return result; return result;
} }

View File

@ -44,19 +44,19 @@ public class DebugFixFlags extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (plr != null) { if (plr != null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_CONSOLE); MainUtil.sendMessage(plr, C.NOT_CONSOLE);
return false; return false;
} }
if (args.length != 1) { if (args.length != 1) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot debugfixflags <world>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot debugfixflags <world>");
return false; return false;
} }
final World world = Bukkit.getWorld(args[0]); final World world = Bukkit.getWorld(args[0]);
if ((world == null) || !PlotSquared.isPlotWorld(world)) { if ((world == null) || !PlotSquared.isPlotWorld(world)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]); MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]);
return false; return false;
} }
BukkitPlayerFunctions.sendMessage(plr, "&8--- &6Starting task &8 ---"); MainUtil.sendMessage(plr, "&8--- &6Starting task &8 ---");
for (final Plot plot : PlotSquared.getPlots(world).values()) { for (final Plot plot : PlotSquared.getPlots(world).values()) {
final Set<Flag> flags = plot.settings.flags; final Set<Flag> flags = plot.settings.flags;
final ArrayList<Flag> toRemove = new ArrayList<Flag>(); final ArrayList<Flag> toRemove = new ArrayList<Flag>();
@ -73,7 +73,7 @@ public class DebugFixFlags extends SubCommand {
DBFunc.setFlags(plot.world, plot, plot.settings.flags); DBFunc.setFlags(plot.world, plot, plot.settings.flags);
} }
} }
BukkitPlayerFunctions.sendMessage(plr, "&aDone!"); MainUtil.sendMessage(plr, "&aDone!");
return true; return true;
} }
} }

View File

@ -49,7 +49,7 @@ public class DebugLoadTest extends SubCommand {
PlotSquared.log("&3===END OF STACKTRACE==="); PlotSquared.log("&3===END OF STACKTRACE===");
} }
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, "&6This command can only be executed by console as it has been deemed unsafe if abused.."); MainUtil.sendMessage(plr, "&6This command can only be executed by console as it has been deemed unsafe if abused..");
} }
return true; return true;
} }

View File

@ -45,7 +45,7 @@ public class DebugSaveTest extends SubCommand {
DBFunc.createPlots(plots); DBFunc.createPlots(plots);
DBFunc.createAllSettingsAndHelpers(plots); DBFunc.createAllSettingsAndHelpers(plots);
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, "This debug command can only be executed by console as it has been deemed unsafe if abused"); MainUtil.sendMessage(plr, "This debug command can only be executed by console as it has been deemed unsafe if abused");
} }
return true; return true;
} }

View File

@ -47,7 +47,7 @@ public class Delete extends SubCommand {
if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
return !sendMessage(plr, C.UNLINK_REQUIRED); return !sendMessage(plr, C.UNLINK_REQUIRED);
} }
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.uuidWrapper.getUUID(plr)))) && !BukkitMain.hasPermission(plr, "plots.admin.command.delete")) { if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.uuidWrapper.getUUID(plr)))) && !Permissions.hasPermission(plr, "plots.admin.command.delete")) {
return !sendMessage(plr, C.NO_PLOT_PERMS); return !sendMessage(plr, C.NO_PLOT_PERMS);
} }
assert plot != null; assert plot != null;
@ -65,7 +65,7 @@ public class Delete extends SubCommand {
plot.clear(plr, true); plot.clear(plr, true);
DBFunc.delete(plr.getWorld().getName(), plot); DBFunc.delete(plr.getWorld().getName(), plot);
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, "Plot deletion has been denied."); MainUtil.sendMessage(plr, "Plot deletion has been denied.");
} }
return true; return true;
} }

View File

@ -42,20 +42,20 @@ public class Denied extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 2) { if (args.length < 2) {
BukkitPlayerFunctions.sendMessage(plr, C.DENIED_NEED_ARGUMENT); MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
return true; return true;
} }
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return true; return true;
} }
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if ((plot == null) || !plot.hasOwner()) { if ((plot == null) || !plot.hasOwner()) {
BukkitPlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !BukkitMain.hasPermission(plr, "plots.admin.command.denied")) { if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !Permissions.hasPermission(plr, "plots.admin.command.denied")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }
if (args[0].equalsIgnoreCase("add")) { if (args[0].equalsIgnoreCase("add")) {
@ -66,12 +66,12 @@ public class Denied extends SubCommand {
uuid = UUIDHandler.getUUID(args[1]); uuid = UUIDHandler.getUUID(args[1]);
} }
if (uuid == null) { if (uuid == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[1]);
return false; return false;
} }
if (!plot.denied.contains(uuid)) { if (!plot.denied.contains(uuid)) {
if (plot.owner.equals(uuid)) { if (plot.owner.equals(uuid)) {
BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); MainUtil.sendMessage(plr, C.ALREADY_OWNER);
return false; return false;
} }
if (plot.trusted.contains(uuid)) { if (plot.trusted.contains(uuid)) {
@ -87,7 +87,7 @@ public class Denied extends SubCommand {
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true); final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_ADDED); MainUtil.sendMessage(plr, C.ALREADY_ADDED);
return false; return false;
} }
final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid); final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid);
@ -98,18 +98,18 @@ public class Denied extends SubCommand {
player.teleport(player.getWorld().getSpawnLocation()); player.teleport(player.getWorld().getSpawnLocation());
} }
} }
BukkitPlayerFunctions.sendMessage(plr, C.DENIED_ADDED); MainUtil.sendMessage(plr, C.DENIED_ADDED);
return true; return true;
} else if (args[0].equalsIgnoreCase("remove")) { } else if (args[0].equalsIgnoreCase("remove")) {
if (args[1].equalsIgnoreCase("*")) { if (args[1].equalsIgnoreCase("*")) {
final UUID uuid = DBFunc.everyone; final UUID uuid = DBFunc.everyone;
if (!plot.denied.contains(uuid)) { if (!plot.denied.contains(uuid)) {
BukkitPlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED); MainUtil.sendMessage(plr, C.WAS_NOT_ADDED);
return true; return true;
} }
plot.removeDenied(uuid); plot.removeDenied(uuid);
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid); DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
BukkitPlayerFunctions.sendMessage(plr, C.DENIED_REMOVED); MainUtil.sendMessage(plr, C.DENIED_REMOVED);
return true; return true;
} }
final UUID uuid = UUIDHandler.getUUID(args[1]); final UUID uuid = UUIDHandler.getUUID(args[1]);
@ -117,9 +117,9 @@ public class Denied extends SubCommand {
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid); DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false); final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
BukkitPlayerFunctions.sendMessage(plr, C.DENIED_REMOVED); MainUtil.sendMessage(plr, C.DENIED_REMOVED);
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.DENIED_NEED_ARGUMENT); MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
return true; return true;
} }
return true; return true;

View File

@ -41,20 +41,20 @@ public class Helpers extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 2) { if (args.length < 2) {
BukkitPlayerFunctions.sendMessage(plr, C.HELPER_NEED_ARGUMENT); MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
return true; return true;
} }
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return true; return true;
} }
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if ((plot == null) || !plot.hasOwner()) { if ((plot == null) || !plot.hasOwner()) {
BukkitPlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !BukkitMain.hasPermission(plr, "plots.admin.command.helpers")) { if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !Permissions.hasPermission(plr, "plots.admin.command.helpers")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }
if (args[0].equalsIgnoreCase("add")) { if (args[0].equalsIgnoreCase("add")) {
@ -65,12 +65,12 @@ public class Helpers extends SubCommand {
uuid = UUIDHandler.getUUID(args[1]); uuid = UUIDHandler.getUUID(args[1]);
} }
if (uuid == null) { if (uuid == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[1]);
return false; return false;
} }
if (!plot.helpers.contains(uuid)) { if (!plot.helpers.contains(uuid)) {
if (plot.owner.equals(uuid)) { if (plot.owner.equals(uuid)) {
BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); MainUtil.sendMessage(plr, C.ALREADY_OWNER);
return false; return false;
} }
if (plot.trusted.contains(uuid)) { if (plot.trusted.contains(uuid)) {
@ -86,21 +86,21 @@ public class Helpers extends SubCommand {
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true); final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_ADDED); MainUtil.sendMessage(plr, C.ALREADY_ADDED);
return false; return false;
} }
BukkitPlayerFunctions.sendMessage(plr, C.HELPER_ADDED); MainUtil.sendMessage(plr, C.HELPER_ADDED);
return true; return true;
} else if (args[0].equalsIgnoreCase("remove")) { } else if (args[0].equalsIgnoreCase("remove")) {
if (args[1].equalsIgnoreCase("*")) { if (args[1].equalsIgnoreCase("*")) {
final UUID uuid = DBFunc.everyone; final UUID uuid = DBFunc.everyone;
if (!plot.helpers.contains(uuid)) { if (!plot.helpers.contains(uuid)) {
BukkitPlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED); MainUtil.sendMessage(plr, C.WAS_NOT_ADDED);
return true; return true;
} }
plot.removeHelper(uuid); plot.removeHelper(uuid);
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid); DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
BukkitPlayerFunctions.sendMessage(plr, C.HELPER_REMOVED); MainUtil.sendMessage(plr, C.HELPER_REMOVED);
return true; return true;
} }
final UUID uuid = UUIDHandler.getUUID(args[1]); final UUID uuid = UUIDHandler.getUUID(args[1]);
@ -108,9 +108,9 @@ public class Helpers extends SubCommand {
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid); DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false); final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
BukkitPlayerFunctions.sendMessage(plr, C.HELPER_REMOVED); MainUtil.sendMessage(plr, C.HELPER_REMOVED);
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.HELPER_NEED_ARGUMENT); MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
return true; return true;
} }
return true; return true;

View File

@ -67,20 +67,20 @@ public class Home extends SubCommand {
return true; return true;
} }
} }
BukkitPlayerFunctions.sendMessage(plr, C.NOT_YOUR_PLOT); MainUtil.sendMessage(plr, C.NOT_YOUR_PLOT);
return false; return false;
} }
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER); MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER);
return true; return true;
} }
if ((id > (plots.length)) || (id < 1)) { if ((id > (plots.length)) || (id < 1)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER); MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER);
return false; return false;
} }
teleportPlayer(plr, plots[id - 1]); teleportPlayer(plr, plots[id - 1]);
return true; return true;
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOTS); MainUtil.sendMessage(plr, C.NO_PLOTS);
return true; return true;
} }
} }

View File

@ -51,17 +51,17 @@ public class Inbox extends SubCommand {
} }
} }
if (!BukkitPlayerFunctions.isInPlot(plr) && !report) { if (!BukkitPlayerFunctions.isInPlot(plr) && !report) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return false; return false;
} }
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if ((plot != null) && !plot.hasOwner()) { if ((plot != null) && !plot.hasOwner()) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return false; return false;
} }
Integer tier; Integer tier;
final UUID uuid = UUIDHandler.getUUID(plr); final UUID uuid = UUIDHandler.getUUID(plr);
if (BukkitMain.hasPermission(plr, "plots.comment.admin")) { if (Permissions.hasPermission(plr, "plots.comment.admin")) {
tier = 0; tier = 0;
} else if ((plot != null) && plot.owner.equals(uuid)) { } else if ((plot != null) && plot.owner.equals(uuid)) {
tier = 1; tier = 1;
@ -80,7 +80,7 @@ public class Inbox extends SubCommand {
if (tier <= 0) { if (tier <= 0) {
tier = 0; tier = 0;
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin");
return false; return false;
} }
break; break;
@ -88,7 +88,7 @@ public class Inbox extends SubCommand {
if (tier <= 1) { if (tier <= 1) {
tier = 1; tier = 1;
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.owner"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.owner");
return false; return false;
} }
break; break;
@ -96,7 +96,7 @@ public class Inbox extends SubCommand {
if (tier <= 2) { if (tier <= 2) {
tier = 2; tier = 2;
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.helper"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.helper");
return false; return false;
} }
break; break;
@ -104,7 +104,7 @@ public class Inbox extends SubCommand {
if (tier <= 3) { if (tier <= 3) {
tier = 3; tier = 3;
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.trusted"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.trusted");
return false; return false;
} }
break; break;
@ -112,7 +112,7 @@ public class Inbox extends SubCommand {
if (tier <= 4) { if (tier <= 4) {
tier = 4; tier = 4;
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.everyone"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.everyone");
return false; return false;
} }
break; break;
@ -120,12 +120,12 @@ public class Inbox extends SubCommand {
if (tier <= 0) { if (tier <= 0) {
tier = -1; tier = -1;
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin");
return false; return false;
} }
break; break;
default: default:
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_INBOX, Arrays.copyOfRange(new String[] { "admin", "owner", "helper", "trusted", "everyone" }, Math.max(0, tier), 4)); MainUtil.sendMessage(plr, C.INVALID_INBOX, Arrays.copyOfRange(new String[] { "admin", "owner", "helper", "trusted", "everyone" }, Math.max(0, tier), 4));
return false; return false;
} }
} else { } else {
@ -149,7 +149,7 @@ public class Inbox extends SubCommand {
if (args.length == 2) { if (args.length == 2) {
final String[] split = args[1].toLowerCase().split(":"); final String[] split = args[1].toLowerCase().split(":");
if (!split[0].equals("clear")) { if (!split[0].equals("clear")) {
BukkitPlayerFunctions.sendMessage(plr, "&c/plot inbox [tier] [clear][:#]"); MainUtil.sendMessage(plr, "&c/plot inbox [tier] [clear][:#]");
return; return;
} }
if (split.length > 1) { if (split.length > 1) {
@ -158,10 +158,10 @@ public class Inbox extends SubCommand {
final PlotComment comment = comments.get(index - 1); final PlotComment comment = comments.get(index - 1);
DBFunc.removeComment(world, plot, comment); DBFunc.removeComment(world, plot, comment);
plot.settings.removeComment(comment); plot.settings.removeComment(comment);
BukkitPlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "1 comment"); MainUtil.sendMessage(plr, C.COMMENT_REMOVED, "1 comment");
return; return;
} catch (final Exception e) { } catch (final Exception e) {
BukkitPlayerFunctions.sendMessage(plr, "&cInvalid index:\n/plot inbox [tier] [clear][:#]"); MainUtil.sendMessage(plr, "&cInvalid index:\n/plot inbox [tier] [clear][:#]");
return; return;
} }
} }
@ -169,7 +169,7 @@ public class Inbox extends SubCommand {
DBFunc.removeComment(world, plot, comment); DBFunc.removeComment(world, plot, comment);
} }
plot.settings.removeComments(comments); plot.settings.removeComments(comments);
BukkitPlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "all comments in that category"); MainUtil.sendMessage(plr, C.COMMENT_REMOVED, "all comments in that category");
} else { } else {
final List<String> recipients = Arrays.asList("A", "O", "H", "T", "E"); final List<String> recipients = Arrays.asList("A", "O", "H", "T", "E");
int count = 1; int count = 1;
@ -183,7 +183,7 @@ public class Inbox extends SubCommand {
if (comments.size() == 0) { if (comments.size() == 0) {
message.append("&cNo messages."); message.append("&cNo messages.");
} }
BukkitPlayerFunctions.sendMessage(plr, message.toString()); MainUtil.sendMessage(plr, message.toString());
} }
} }
}); });

View File

@ -68,7 +68,7 @@ public class Info extends SubCommand {
plot = BukkitPlayerFunctions.getCurrentPlot(player); plot = BukkitPlayerFunctions.getCurrentPlot(player);
} else { } else {
if (args.length < 2) { if (args.length < 2) {
BukkitPlayerFunctions.sendMessage(null, C.INFO_SYNTAX_CONSOLE); MainUtil.sendMessage(null, C.INFO_SYNTAX_CONSOLE);
return false; return false;
} }
final PlotWorld plotworld = PlotSquared.getPlotWorld(args[0]); final PlotWorld plotworld = PlotSquared.getPlotWorld(args[0]);

View File

@ -38,25 +38,25 @@ public class Kick extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
BukkitPlayerFunctions.sendMessage(plr, "You're not in a plot."); MainUtil.sendMessage(plr, "You're not in a plot.");
return false; return false;
} }
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.kick")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.kick")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }
if (args.length != 1) { if (args.length != 1) {
BukkitPlayerFunctions.sendMessage(plr, "&c/plot kick <player>"); MainUtil.sendMessage(plr, "&c/plot kick <player>");
return false; return false;
} }
if (Bukkit.getPlayer(args[0]) == null) { if (Bukkit.getPlayer(args[0]) == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[0]); MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
return false; return false;
} }
final Player player = Bukkit.getPlayer(args[0]); final Player player = Bukkit.getPlayer(args[0]);
if (!player.getWorld().equals(plr.getWorld()) || !BukkitPlayerFunctions.isInPlot(player) || (BukkitPlayerFunctions.getCurrentPlot(player) == null) || !BukkitPlayerFunctions.getCurrentPlot(player).equals(plot)) { if (!player.getWorld().equals(plr.getWorld()) || !BukkitPlayerFunctions.isInPlot(player) || (BukkitPlayerFunctions.getCurrentPlot(player) == null) || !BukkitPlayerFunctions.getCurrentPlot(player).equals(plot)) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER.s().replaceAll("%player%", args[0])); MainUtil.sendMessage(plr, C.INVALID_PLAYER.s().replaceAll("%player%", args[0]));
return false; return false;
} }
player.teleport(player.getWorld().getSpawnLocation()); player.teleport(player.getWorld().getSpawnLocation());

View File

@ -76,22 +76,22 @@ public class Merge extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return true; return true;
} }
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if ((plot == null) || !plot.hasOwner()) { if ((plot == null) || !plot.hasOwner()) {
BukkitPlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
return false; return false;
} }
final boolean admin = BukkitMain.hasPermission(plr, "plots.admin.command.merge"); final boolean admin = Permissions.hasPermission(plr, "plots.admin.command.merge");
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !admin) { if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !admin) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }
if (args.length < 1) { if (args.length < 1) {
BukkitPlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s())); MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s()));
BukkitPlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw()))); MainUtil.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw())));
return false; return false;
} }
int direction = -1; int direction = -1;
@ -102,8 +102,8 @@ public class Merge extends SubCommand {
} }
} }
if (direction == -1) { if (direction == -1) {
BukkitPlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s())); MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s()));
BukkitPlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw()))); MainUtil.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw())));
return false; return false;
} }
final World world = plr.getWorld(); final World world = plr.getWorld();
@ -138,7 +138,7 @@ public class Merge extends SubCommand {
for (final PlotId myid : plots) { for (final PlotId myid : plots) {
final Plot myplot = PlotSquared.getPlots(world).get(myid); final Plot myplot = PlotSquared.getPlots(world).get(myid);
if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(plr)) || admin)) { if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(plr)) || admin)) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString())); MainUtil.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString()));
return false; return false;
} }
} }
@ -160,10 +160,10 @@ public class Merge extends SubCommand {
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
event.setCancelled(true); event.setCancelled(true);
BukkitPlayerFunctions.sendMessage(plr, "&cMerge has been cancelled"); MainUtil.sendMessage(plr, "&cMerge has been cancelled");
return false; return false;
} }
BukkitPlayerFunctions.sendMessage(plr, "&cPlots have been merged"); MainUtil.sendMessage(plr, "&cPlots have been merged");
MainUtil.mergePlots(world, plots, true); MainUtil.mergePlots(world, plots, true);
MainUtil.setSign(world, UUIDHandler.getName(plot.owner), plot); MainUtil.setSign(world, UUIDHandler.getName(plot.owner), plot);
MainUtil.update(plr.getLocation()); MainUtil.update(plr.getLocation());

View File

@ -40,32 +40,32 @@ public class Move extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (plr == null) { if (plr == null) {
BukkitPlayerFunctions.sendMessage(plr, "MUST BE EXECUTED BY PLAYER"); MainUtil.sendMessage(plr, "MUST BE EXECUTED BY PLAYER");
} }
if (args.length != 2) { if (args.length != 2) {
BukkitPlayerFunctions.sendMessage(plr, "/plot move <pos1> <pos2>"); MainUtil.sendMessage(plr, "/plot move <pos1> <pos2>");
return false; return false;
} }
final World world = plr.getWorld(); final World world = plr.getWorld();
final PlotId plot1 = MainUtil.parseId(args[0]); final PlotId plot1 = MainUtil.parseId(args[0]);
final PlotId plot2 = MainUtil.parseId(args[1]); final PlotId plot2 = MainUtil.parseId(args[1]);
if ((plot1 == null) || (plot2 == null)) { if ((plot1 == null) || (plot2 == null)) {
BukkitPlayerFunctions.sendMessage(plr, "INVALID PLOT ID\n/plot move <pos1> <pos2>"); MainUtil.sendMessage(plr, "INVALID PLOT ID\n/plot move <pos1> <pos2>");
return false; return false;
} }
if (plot1 == plot2) { if (plot1 == plot2) {
BukkitPlayerFunctions.sendMessage(plr, "DUPLICATE ID"); MainUtil.sendMessage(plr, "DUPLICATE ID");
return false; return false;
} }
if (MainUtil.move(world, plot1, plot2, new Runnable() { if (MainUtil.move(world, plot1, plot2, new Runnable() {
@Override @Override
public void run() { public void run() {
BukkitPlayerFunctions.sendMessage(plr, "MOVE SUCCESS"); MainUtil.sendMessage(plr, "MOVE SUCCESS");
} }
})) { })) {
return true; return true;
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, "MOVE FAILED"); MainUtil.sendMessage(plr, "MOVE FAILED");
return false; return false;
} }
} }

View File

@ -19,7 +19,7 @@ public class OP extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 1) { if (args.length < 1) {
return BukkitPlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage); return MainUtil.sendMessage(plr, "&cUsage: &c" + this.usage);
} }
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);

View File

@ -37,16 +37,16 @@ public class Paste extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return false; return false;
} }
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.paste")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.paste")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }
if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
BukkitPlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED); MainUtil.sendMessage(plr, C.UNLINK_REQUIRED);
return false; return false;
} }
assert plot != null; assert plot != null;

View File

@ -55,47 +55,47 @@ public class Purge extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (plr != null) { if (plr != null) {
BukkitPlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE)); MainUtil.sendMessage(plr, (C.NOT_CONSOLE));
return false; return false;
} }
if (args.length == 1) { if (args.length == 1) {
final String arg = args[0].toLowerCase(); final String arg = args[0].toLowerCase();
final PlotId id = getId(arg); final PlotId id = getId(arg);
if (id != null) { if (id != null) {
BukkitPlayerFunctions.sendMessage(plr, "/plot purge x;z &l<world>"); MainUtil.sendMessage(plr, "/plot purge x;z &l<world>");
return false; return false;
} }
final UUID uuid = UUIDHandler.getUUID(args[0]); final UUID uuid = UUIDHandler.getUUID(args[0]);
if (uuid != null) { if (uuid != null) {
BukkitPlayerFunctions.sendMessage(plr, "/plot purge " + args[0] + " &l<world>"); MainUtil.sendMessage(plr, "/plot purge " + args[0] + " &l<world>");
return false; return false;
} }
if (arg.equals("player")) { if (arg.equals("player")) {
BukkitPlayerFunctions.sendMessage(plr, "/plot purge &l<player> <world>"); MainUtil.sendMessage(plr, "/plot purge &l<player> <world>");
return false; return false;
} }
if (arg.equals("unowned")) { if (arg.equals("unowned")) {
BukkitPlayerFunctions.sendMessage(plr, "/plot purge unowned &l<world>"); MainUtil.sendMessage(plr, "/plot purge unowned &l<world>");
return false; return false;
} }
if (arg.equals("unknown")) { if (arg.equals("unknown")) {
BukkitPlayerFunctions.sendMessage(plr, "/plot purge unknown &l<world>"); MainUtil.sendMessage(plr, "/plot purge unknown &l<world>");
return false; return false;
} }
if (arg.equals("all")) { if (arg.equals("all")) {
BukkitPlayerFunctions.sendMessage(plr, "/plot purge all &l<world>"); MainUtil.sendMessage(plr, "/plot purge all &l<world>");
return false; return false;
} }
BukkitPlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX); MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
BukkitPlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX); MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
return false; return false;
} }
final World world = Bukkit.getWorld(args[1]); final World world = Bukkit.getWorld(args[1]);
if ((world == null) || !PlotSquared.isPlotWorld(world)) { if ((world == null) || !PlotSquared.isPlotWorld(world)) {
BukkitPlayerFunctions.sendMessage(null, C.NOT_VALID_PLOT_WORLD); MainUtil.sendMessage(null, C.NOT_VALID_PLOT_WORLD);
return false; return false;
} }
final String worldname = world.getName(); final String worldname = world.getName();
@ -123,7 +123,7 @@ public class Purge extends SubCommand {
if (arg.equals("all")) { if (arg.equals("all")) {
final Set<PlotId> ids = PlotSquared.getPlots(world).keySet(); final Set<PlotId> ids = PlotSquared.getPlots(world).keySet();
if (ids.size() == 0) { if (ids.size() == 0) {
return BukkitPlayerFunctions.sendMessage(null, "&cNo plots found"); return MainUtil.sendMessage(null, "&cNo plots found");
} }
DBFunc.purge(worldname, ids); DBFunc.purge(worldname, ids);
return finishPurge(ids.size()); return finishPurge(ids.size());
@ -140,7 +140,7 @@ public class Purge extends SubCommand {
} }
} }
if (ids.size() == 0) { if (ids.size() == 0) {
return BukkitPlayerFunctions.sendMessage(null, "&cNo plots found"); return MainUtil.sendMessage(null, "&cNo plots found");
} }
DBFunc.purge(worldname, ids); DBFunc.purge(worldname, ids);
return finishPurge(ids.size()); return finishPurge(ids.size());
@ -154,17 +154,17 @@ public class Purge extends SubCommand {
} }
} }
if (ids.size() == 0) { if (ids.size() == 0) {
return BukkitPlayerFunctions.sendMessage(null, "&cNo plots found"); return MainUtil.sendMessage(null, "&cNo plots found");
} }
DBFunc.purge(worldname, ids); DBFunc.purge(worldname, ids);
return finishPurge(ids.size()); return finishPurge(ids.size());
} }
BukkitPlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX); MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
return false; return false;
} }
private boolean finishPurge(final int amount) { private boolean finishPurge(final int amount) {
BukkitPlayerFunctions.sendMessage(null, C.PURGE_SUCCESS, amount + ""); MainUtil.sendMessage(null, C.PURGE_SUCCESS, amount + "");
return false; return false;
} }
} }

View File

@ -47,7 +47,7 @@ public class Reload extends SubCommand {
} }
MainUtil.sendMessage(plr, C.RELOADED_CONFIGS); MainUtil.sendMessage(plr, C.RELOADED_CONFIGS);
} catch (final Exception e) { } catch (final Exception e) {
BukkitPlayerFunctions.sendMessage(plr, C.RELOAD_FAILED); MainUtil.sendMessage(plr, C.RELOAD_FAILED);
} }
return true; return true;
} }

View File

@ -69,8 +69,8 @@ public class Schematic extends SubCommand {
PlotSquared.log(C.IS_CONSOLE); PlotSquared.log(C.IS_CONSOLE);
return false; return false;
} }
if (!BukkitMain.hasPermission(plr, "plots.schematic.paste")) { if (!Permissions.hasPermission(plr, "plots.schematic.paste")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste");
return false; return false;
} }
if (args.length < 2) { if (args.length < 2) {
@ -82,7 +82,7 @@ public class Schematic extends SubCommand {
break; break;
} }
if (this.running) { if (this.running) {
BukkitPlayerFunctions.sendMessage(plr, "&cTask is already running."); MainUtil.sendMessage(plr, "&cTask is already running.");
return false; return false;
} }
final String file2 = args[1]; final String file2 = args[1];
@ -150,8 +150,8 @@ public class Schematic extends SubCommand {
PlotSquared.log(C.IS_CONSOLE); PlotSquared.log(C.IS_CONSOLE);
return false; return false;
} }
if (!BukkitMain.hasPermission(plr, "plots.schematic.test")) { if (!Permissions.hasPermission(plr, "plots.schematic.test")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.test"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.test");
return false; return false;
} }
if (args.length < 2) { if (args.length < 2) {
@ -177,20 +177,20 @@ public class Schematic extends SubCommand {
case "saveall": case "saveall":
case "exportall": case "exportall":
if (plr != null) { if (plr != null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_CONSOLE); MainUtil.sendMessage(plr, C.NOT_CONSOLE);
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
BukkitPlayerFunctions.sendMessage(null, "&cNeed world arg. Use &7/plots sch exportall <world>"); MainUtil.sendMessage(null, "&cNeed world arg. Use &7/plots sch exportall <world>");
return false; return false;
} }
final HashMap<PlotId, Plot> plotmap = PlotSquared.getPlots(args[1]); final HashMap<PlotId, Plot> plotmap = PlotSquared.getPlots(args[1]);
if ((plotmap == null) || (plotmap.size() == 0)) { if ((plotmap == null) || (plotmap.size() == 0)) {
BukkitPlayerFunctions.sendMessage(null, "&cInvalid world. Use &7/plots sch exportall <world>"); MainUtil.sendMessage(null, "&cInvalid world. Use &7/plots sch exportall <world>");
return false; return false;
} }
if (this.running) { if (this.running) {
BukkitPlayerFunctions.sendMessage(null, "&cTask is already running."); MainUtil.sendMessage(null, "&cTask is already running.");
return false; return false;
} }
PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while."); PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while.");
@ -216,17 +216,17 @@ public class Schematic extends SubCommand {
final String o = UUIDHandler.getName(plot.owner); final String o = UUIDHandler.getName(plot.owner);
final String owner = o == null ? "unknown" : o; final String owner = o == null ? "unknown" : o;
if (sch == null) { if (sch == null) {
BukkitPlayerFunctions.sendMessage(null, "&7 - Skipped plot &c" + plot.id); MainUtil.sendMessage(null, "&7 - Skipped plot &c" + plot.id);
} else { } else {
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() { Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() {
@Override @Override
public void run() { public void run() {
BukkitPlayerFunctions.sendMessage(null, "&6ID: " + plot.id); MainUtil.sendMessage(null, "&6ID: " + plot.id);
final boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + worldname + "," + owner + ".schematic"); final boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + worldname + "," + owner + ".schematic");
if (!result) { if (!result) {
BukkitPlayerFunctions.sendMessage(null, "&7 - Failed to save &c" + plot.id); MainUtil.sendMessage(null, "&7 - Failed to save &c" + plot.id);
} else { } else {
BukkitPlayerFunctions.sendMessage(null, "&7 - &aExport success: " + plot.id); MainUtil.sendMessage(null, "&7 - &aExport success: " + plot.id);
} }
} }
}); });
@ -237,12 +237,12 @@ public class Schematic extends SubCommand {
break; break;
case "export": case "export":
case "save": case "save":
if (!BukkitMain.hasPermission(plr, "plots.schematic.save")) { if (!Permissions.hasPermission(plr, "plots.schematic.save")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save");
return false; return false;
} }
if (this.running) { if (this.running) {
BukkitPlayerFunctions.sendMessage(plr, "&cTask is already running."); MainUtil.sendMessage(plr, "&cTask is already running.");
return false; return false;
} }
final String world; final String world;
@ -266,16 +266,16 @@ public class Schematic extends SubCommand {
final String[] split = args[2].split(";"); final String[] split = args[2].split(";");
final PlotId i = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1])); final PlotId i = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
if ((PlotSquared.getPlots(world) == null) || (PlotSquared.getPlots(world).get(i) == null)) { if ((PlotSquared.getPlots(world) == null) || (PlotSquared.getPlots(world).get(i) == null)) {
BukkitPlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>"); MainUtil.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
return false; return false;
} }
p2 = PlotSquared.getPlots(world).get(i); p2 = PlotSquared.getPlots(world).get(i);
} catch (final Exception e) { } catch (final Exception e) {
BukkitPlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>"); MainUtil.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
return false; return false;
} }
} else { } else {
BukkitPlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>"); MainUtil.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
return false; return false;
} }
} }
@ -297,17 +297,17 @@ public class Schematic extends SubCommand {
final String o = UUIDHandler.getName(plot.owner); final String o = UUIDHandler.getName(plot.owner);
final String owner = o == null ? "unknown" : o; final String owner = o == null ? "unknown" : o;
if (sch == null) { if (sch == null) {
BukkitPlayerFunctions.sendMessage(plr, "&7 - Skipped plot &c" + plot.id); MainUtil.sendMessage(plr, "&7 - Skipped plot &c" + plot.id);
} else { } else {
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() { Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() {
@Override @Override
public void run() { public void run() {
BukkitPlayerFunctions.sendMessage(plr, "&6ID: " + plot.id); MainUtil.sendMessage(plr, "&6ID: " + plot.id);
final boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + world + "," + owner.trim() + ".schematic"); final boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + world + "," + owner.trim() + ".schematic");
if (!result) { if (!result) {
BukkitPlayerFunctions.sendMessage(plr, "&7 - Failed to save &c" + plot.id); MainUtil.sendMessage(plr, "&7 - Failed to save &c" + plot.id);
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, "&7 - &aExport success: " + plot.id); MainUtil.sendMessage(plr, "&7 - &aExport success: " + plot.id);
} }
} }
}); });

View File

@ -66,7 +66,7 @@ public class Set extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return false; return false;
} }
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
@ -74,12 +74,12 @@ public class Set extends SubCommand {
sendMessage(plr, C.PLOT_NOT_CLAIMED); sendMessage(plr, C.PLOT_NOT_CLAIMED);
return false; return false;
} }
if (!plot.hasRights(plr) && !BukkitMain.hasPermission(plr, "plots.admin.command.set")) { if (!plot.hasRights(plr) && !Permissions.hasPermission(plr, "plots.admin.command.set")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }
if (args.length < 1) { if (args.length < 1) {
BukkitPlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values)); MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values));
return false; return false;
} }
for (int i = 0; i < aliases.length; i++) { for (int i = 0; i < aliases.length; i++) {
@ -90,8 +90,8 @@ public class Set extends SubCommand {
} }
/* TODO: Implement option */ /* TODO: Implement option */
// final boolean advanced_permissions = true; // final boolean advanced_permissions = true;
if (!BukkitMain.hasPermission(plr, "plots.set." + args[0].toLowerCase())) { if (!Permissions.hasPermission(plr, "plots.set." + args[0].toLowerCase())) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.set." + args[0].toLowerCase()); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set." + args[0].toLowerCase());
return false; return false;
} }
if (args[0].equalsIgnoreCase("flag")) { if (args[0].equalsIgnoreCase("flag")) {
@ -104,7 +104,7 @@ public class Set extends SubCommand {
message += "," + StringUtils.join(PlotSquared.worldGuardListener.str_flags, "&c, &6"); message += "," + StringUtils.join(PlotSquared.worldGuardListener.str_flags, "&c, &6");
} }
} }
BukkitPlayerFunctions.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message)); MainUtil.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
return false; return false;
} }
AbstractFlag af; AbstractFlag af;
@ -114,11 +114,11 @@ public class Set extends SubCommand {
af = new AbstractFlag(args[1].toLowerCase()); af = new AbstractFlag(args[1].toLowerCase());
} }
if (!FlagManager.getFlags().contains(af) && ((PlotSquared.worldGuardListener == null) || !PlotSquared.worldGuardListener.str_flags.contains(args[1].toLowerCase()))) { if (!FlagManager.getFlags().contains(af) && ((PlotSquared.worldGuardListener == null) || !PlotSquared.worldGuardListener.str_flags.contains(args[1].toLowerCase()))) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG); MainUtil.sendMessage(plr, C.NOT_VALID_FLAG);
return false; return false;
} }
if (!BukkitMain.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) { if (!Permissions.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION); MainUtil.sendMessage(plr, C.NO_PERMISSION);
return false; return false;
} }
if (args.length == 2) { if (args.length == 2) {
@ -129,15 +129,15 @@ public class Set extends SubCommand {
return false; return false;
} }
} }
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_NOT_IN_PLOT); MainUtil.sendMessage(plr, C.FLAG_NOT_IN_PLOT);
return false; return false;
} }
final boolean result = FlagManager.removePlotFlag(plot, args[1].toLowerCase()); final boolean result = FlagManager.removePlotFlag(plot, args[1].toLowerCase());
if (!result) { if (!result) {
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_NOT_REMOVED); MainUtil.sendMessage(plr, C.FLAG_NOT_REMOVED);
return false; return false;
} }
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_REMOVED); MainUtil.sendMessage(plr, C.FLAG_REMOVED);
PlotListener.plotEntry(plr, plot); PlotListener.plotEntry(plr, plot);
return true; return true;
} }
@ -145,7 +145,7 @@ public class Set extends SubCommand {
final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " "); final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
final Object parsed_value = af.parseValueRaw(value); final Object parsed_value = af.parseValueRaw(value);
if (parsed_value == null) { if (parsed_value == null) {
BukkitPlayerFunctions.sendMessage(plr, af.getValueDesc()); MainUtil.sendMessage(plr, af.getValueDesc());
return false; return false;
} }
if ((FlagManager.getFlag(args[1].toLowerCase()) == null) && (PlotSquared.worldGuardListener != null)) { if ((FlagManager.getFlag(args[1].toLowerCase()) == null) && (PlotSquared.worldGuardListener != null)) {
@ -155,14 +155,14 @@ public class Set extends SubCommand {
final Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), parsed_value); final Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), parsed_value);
final boolean result = FlagManager.addPlotFlag(plot, flag); final boolean result = FlagManager.addPlotFlag(plot, flag);
if (!result) { if (!result) {
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_NOT_ADDED); MainUtil.sendMessage(plr, C.FLAG_NOT_ADDED);
return false; return false;
} }
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_ADDED); MainUtil.sendMessage(plr, C.FLAG_ADDED);
PlotListener.plotEntry(plr, plot); PlotListener.plotEntry(plr, plot);
return true; return true;
} catch (final Exception e) { } catch (final Exception e) {
BukkitPlayerFunctions.sendMessage(plr, "&c" + e.getMessage()); MainUtil.sendMessage(plr, "&c" + e.getMessage());
return false; return false;
} }
} }
@ -173,7 +173,7 @@ public class Set extends SubCommand {
DBFunc.setPosition(plr.getWorld().getName(), plot, ""); DBFunc.setPosition(plr.getWorld().getName(), plot, "");
return true; return true;
} }
return BukkitPlayerFunctions.sendMessage(plr, C.HOME_ARGUMENT); return MainUtil.sendMessage(plr, C.HOME_ARGUMENT);
} }
//set to current location //set to current location
final World world = plr.getWorld(); final World world = plr.getWorld();
@ -183,35 +183,35 @@ public class Set extends SubCommand {
final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ()); final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
plot.settings.setPosition(blockloc); plot.settings.setPosition(blockloc);
DBFunc.setPosition(plr.getWorld().getName(), plot, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ()); DBFunc.setPosition(plr.getWorld().getName(), plot, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ());
return BukkitPlayerFunctions.sendMessage(plr, C.POSITION_SET); return MainUtil.sendMessage(plr, C.POSITION_SET);
} }
if (args[0].equalsIgnoreCase("alias")) { if (args[0].equalsIgnoreCase("alias")) {
if (args.length < 2) { if (args.length < 2) {
BukkitPlayerFunctions.sendMessage(plr, C.MISSING_ALIAS); MainUtil.sendMessage(plr, C.MISSING_ALIAS);
return false; return false;
} }
final String alias = args[1]; final String alias = args[1];
if (alias.length() >= 50) { if (alias.length() >= 50) {
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_TOO_LONG); MainUtil.sendMessage(plr, C.ALIAS_TOO_LONG);
return false; return false;
} }
for (final Plot p : PlotSquared.getPlots(plr.getWorld()).values()) { for (final Plot p : PlotSquared.getPlots(plr.getWorld()).values()) {
if (p.settings.getAlias().equalsIgnoreCase(alias)) { if (p.settings.getAlias().equalsIgnoreCase(alias)) {
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN); MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
return false; return false;
} }
if (UUIDHandler.nameExists(new StringWrapper(alias))) { if (UUIDHandler.nameExists(new StringWrapper(alias))) {
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN); MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
return false; return false;
} }
} }
DBFunc.setAlias(plr.getWorld().getName(), plot, alias); DBFunc.setAlias(plr.getWorld().getName(), plot, alias);
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias)); MainUtil.sendMessage(plr, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias));
return true; return true;
} }
if (args[0].equalsIgnoreCase("biome")) { if (args[0].equalsIgnoreCase("biome")) {
if (args.length < 2) { if (args.length < 2) {
BukkitPlayerFunctions.sendMessage(plr, C.NEED_BIOME); MainUtil.sendMessage(plr, C.NEED_BIOME);
return true; return true;
} }
if (args[1].length() < 2) { if (args[1].length() < 2) {
@ -228,11 +228,11 @@ public class Set extends SubCommand {
* } * }
*/ */
if (biome == null) { if (biome == null) {
BukkitPlayerFunctions.sendMessage(plr, getBiomeList(Arrays.asList(Biome.values()))); MainUtil.sendMessage(plr, getBiomeList(Arrays.asList(Biome.values())));
return true; return true;
} }
MainUtil.setBiome(plr.getWorld(), plot, biome); MainUtil.setBiome(plr.getWorld(), plot, biome);
BukkitPlayerFunctions.sendMessage(plr, C.BIOME_SET_TO.s() + biome.toString().toLowerCase()); MainUtil.sendMessage(plr, C.BIOME_SET_TO.s() + biome.toString().toLowerCase());
return true; return true;
} }
// Get components // Get components
@ -243,7 +243,7 @@ public class Set extends SubCommand {
for (final String component : components) { for (final String component : components) {
if (component.equalsIgnoreCase(args[0])) { if (component.equalsIgnoreCase(args[0])) {
if (args.length < 2) { if (args.length < 2) {
BukkitPlayerFunctions.sendMessage(plr, C.NEED_BLOCK); MainUtil.sendMessage(plr, C.NEED_BLOCK);
return true; return true;
} }
PlotBlock[] blocks; PlotBlock[] blocks;
@ -253,12 +253,12 @@ public class Set extends SubCommand {
try { try {
blocks = new PlotBlock[] { new PlotBlock((short) getMaterial(args[1], PlotWorld.BLOCKS).getId(), (byte) 0) }; blocks = new PlotBlock[] { new PlotBlock((short) getMaterial(args[1], PlotWorld.BLOCKS).getId(), (byte) 0) };
} catch (final Exception e2) { } catch (final Exception e2) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_BLOCK); MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK);
return false; return false;
} }
} }
manager.setComponent(world, plotworld, plot.id, component, blocks); manager.setComponent(world, plotworld, plot.id, component, blocks);
BukkitPlayerFunctions.sendMessage(plr, C.GENERATING_COMPONENT); MainUtil.sendMessage(plr, C.GENERATING_COMPONENT);
return true; return true;
} }
} }
@ -280,7 +280,7 @@ public class Set extends SubCommand {
return true; return true;
} }
} }
BukkitPlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values)); MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values));
return false; return false;
} }

View File

@ -54,15 +54,15 @@ public class SetOwner extends SubCommand {
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if ((plot == null) || (plot.owner == null)) { if ((plot == null) || (plot.owner == null)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return false; return false;
} }
if (args.length < 1) { if (args.length < 1) {
BukkitPlayerFunctions.sendMessage(plr, C.NEED_USER); MainUtil.sendMessage(plr, C.NEED_USER);
return false; return false;
} }
if (!plot.owner.equals(UUIDHandler.getUUID(plr)) && !BukkitMain.hasPermission(plr, "plots.admin.command.setowner")) { if (!plot.owner.equals(UUIDHandler.getUUID(plr)) && !Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner"); MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner");
return false; return false;
} }
final World world = plr.getWorld(); final World world = plr.getWorld();
@ -73,7 +73,7 @@ public class SetOwner extends SubCommand {
final Plot current = PlotSquared.getPlots(world).get(id); final Plot current = PlotSquared.getPlots(world).get(id);
final UUID uuid = getUUID(args[0]); final UUID uuid = getUUID(args[0]);
if (uuid == null) { if (uuid == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[0]); MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
return false; return false;
} }
current.owner = uuid; current.owner = uuid;
@ -84,7 +84,7 @@ public class SetOwner extends SubCommand {
} }
} }
MainUtil.setSign(world, args[0], plot); MainUtil.setSign(world, args[0], plot);
BukkitPlayerFunctions.sendMessage(plr, C.SET_OWNER); MainUtil.sendMessage(plr, C.SET_OWNER);
return true; return true;
} }
} }

View File

@ -93,13 +93,13 @@ public class Setup extends SubCommand {
updateGenerators(); updateGenerators();
final String prefix = "\n&8 - &7"; final String prefix = "\n&8 - &7";
sendMessage(plr, C.SETUP_INIT); sendMessage(plr, C.SETUP_INIT);
BukkitPlayerFunctions.sendMessage(plr, "&6What generator do you want?" + prefix + StringUtils.join(this.generators.keySet(), prefix).replaceAll("PlotSquared", "&2PlotSquared")); MainUtil.sendMessage(plr, "&6What generator do you want?" + prefix + StringUtils.join(this.generators.keySet(), prefix).replaceAll("PlotSquared", "&2PlotSquared"));
return false; return false;
} }
if (args.length == 1) { if (args.length == 1) {
if (args[0].equalsIgnoreCase("cancel")) { if (args[0].equalsIgnoreCase("cancel")) {
setupMap.remove(plr.getName()); setupMap.remove(plr.getName());
BukkitPlayerFunctions.sendMessage(plr, "&aCancelled setup"); MainUtil.sendMessage(plr, "&aCancelled setup");
return false; return false;
} }
if (args[0].equalsIgnoreCase("back")) { if (args[0].equalsIgnoreCase("back")) {
@ -120,14 +120,14 @@ public class Setup extends SubCommand {
case 0: { // choose generator case 0: { // choose generator
if ((args.length != 1) || !this.generators.containsKey(args[0])) { if ((args.length != 1) || !this.generators.containsKey(args[0])) {
final String prefix = "\n&8 - &7"; final String prefix = "\n&8 - &7";
BukkitPlayerFunctions.sendMessage(plr, "&cYou must choose a generator!" + prefix + StringUtils.join(this.generators.keySet(), prefix).replaceAll("PlotSquared", "&2PlotSquared")); MainUtil.sendMessage(plr, "&cYou must choose a generator!" + prefix + StringUtils.join(this.generators.keySet(), prefix).replaceAll("PlotSquared", "&2PlotSquared"));
sendMessage(plr, C.SETUP_INIT); sendMessage(plr, C.SETUP_INIT);
return false; return false;
} }
object.generator = args[0]; object.generator = args[0];
object.current++; object.current++;
final String partial = Settings.ENABLE_CLUSTERS ? "\n&8 - &7PARTIAL&8 - &7Vanilla with clusters of plots" : ""; final String partial = Settings.ENABLE_CLUSTERS ? "\n&8 - &7PARTIAL&8 - &7Vanilla with clusters of plots" : "";
BukkitPlayerFunctions.sendMessage(plr, "&6What world type do you want?" + "\n&8 - &2DEFAULT&8 - &7Standard plot generation" + "\n&8 - &7AUGMENTED&8 - &7Plot generation with terrain" + partial); MainUtil.sendMessage(plr, "&6What world type do you want?" + "\n&8 - &2DEFAULT&8 - &7Standard plot generation" + "\n&8 - &7AUGMENTED&8 - &7Plot generation with terrain" + partial);
break; break;
} }
case 1: { // choose world type case 1: { // choose world type
@ -138,7 +138,7 @@ public class Setup extends SubCommand {
types = Arrays.asList(new String[] { "default", "augmented" }); types = Arrays.asList(new String[] { "default", "augmented" });
} }
if ((args.length != 1) || !types.contains(args[0].toLowerCase())) { if ((args.length != 1) || !types.contains(args[0].toLowerCase())) {
BukkitPlayerFunctions.sendMessage(plr, "&cYou must choose a world type!" + "\n&8 - &2DEFAULT&8 - &7Standard plot generation" + "\n&8 - &7AUGMENTED&8 - &7Plot generation with terrain" + "\n&8 - &7PARTIAL&8 - &7Vanilla with clusters of plots"); MainUtil.sendMessage(plr, "&cYou must choose a world type!" + "\n&8 - &2DEFAULT&8 - &7Standard plot generation" + "\n&8 - &7AUGMENTED&8 - &7Plot generation with terrain" + "\n&8 - &7PARTIAL&8 - &7Vanilla with clusters of plots");
return false; return false;
} }
object.type = types.indexOf(args[0].toLowerCase()); object.type = types.indexOf(args[0].toLowerCase());
@ -150,7 +150,7 @@ public class Setup extends SubCommand {
final ConfigurationNode step = object.step[object.setup_index]; final ConfigurationNode step = object.step[object.setup_index];
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + ""); sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + "");
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, "&6What terrain would you like in plots?" + "\n&8 - &2NONE&8 - &7No terrain at all" + "\n&8 - &7ORE&8 - &7Just some ore veins and trees" + "\n&8 - &7ALL&8 - &7Entirely vanilla generation"); MainUtil.sendMessage(plr, "&6What terrain would you like in plots?" + "\n&8 - &2NONE&8 - &7No terrain at all" + "\n&8 - &7ORE&8 - &7Just some ore veins and trees" + "\n&8 - &7ALL&8 - &7Entirely vanilla generation");
} }
object.current++; object.current++;
break; break;
@ -158,7 +158,7 @@ public class Setup extends SubCommand {
case 2: { // Choose terrain case 2: { // Choose terrain
final List<String> terrain = Arrays.asList(new String[] { "none", "ore", "all" }); final List<String> terrain = Arrays.asList(new String[] { "none", "ore", "all" });
if ((args.length != 1) || !terrain.contains(args[0].toLowerCase())) { if ((args.length != 1) || !terrain.contains(args[0].toLowerCase())) {
BukkitPlayerFunctions.sendMessage(plr, "&cYou must choose the terrain!" + "\n&8 - &2NONE&8 - &7No terrain at all" + "\n&8 - &7ORE&8 - &7Just some ore veins and trees" + "\n&8 - &7ALL&8 - &7Entirely vanilla generation"); MainUtil.sendMessage(plr, "&cYou must choose the terrain!" + "\n&8 - &2NONE&8 - &7No terrain at all" + "\n&8 - &7ORE&8 - &7Just some ore veins and trees" + "\n&8 - &7ALL&8 - &7Entirely vanilla generation");
return false; return false;
} }
object.terrain = terrain.indexOf(args[0].toLowerCase()); object.terrain = terrain.indexOf(args[0].toLowerCase());
@ -172,7 +172,7 @@ public class Setup extends SubCommand {
} }
case 3: { // world setup case 3: { // world setup
if (object.setup_index == object.step.length) { if (object.setup_index == object.step.length) {
BukkitPlayerFunctions.sendMessage(plr, "&6What do you want your world to be called?"); MainUtil.sendMessage(plr, "&6What do you want your world to be called?");
object.setup_index = 0; object.setup_index = 0;
object.current++; object.current++;
return true; return true;
@ -202,11 +202,11 @@ public class Setup extends SubCommand {
} }
case 4: { case 4: {
if (args.length != 1) { if (args.length != 1) {
BukkitPlayerFunctions.sendMessage(plr, "&cYou need to choose a world name!"); MainUtil.sendMessage(plr, "&cYou need to choose a world name!");
return false; return false;
} }
if (Bukkit.getWorld(args[0]) != null) { if (Bukkit.getWorld(args[0]) != null) {
BukkitPlayerFunctions.sendMessage(plr, "&cThat world name is already taken!"); MainUtil.sendMessage(plr, "&cThat world name is already taken!");
} }
object.world = args[0]; object.world = args[0];
setupMap.remove(plr.getName()); setupMap.remove(plr.getName());

View File

@ -46,21 +46,21 @@ public class Swap extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 1) { if (args.length < 1) {
BukkitPlayerFunctions.sendMessage(plr, C.NEED_PLOT_ID); MainUtil.sendMessage(plr, C.NEED_PLOT_ID);
BukkitPlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX); MainUtil.sendMessage(plr, C.SWAP_SYNTAX);
return false; return false;
} }
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return false; return false;
} }
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.swap")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.swap")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false; return false;
} }
if ((plot != null) && plot.settings.isMerged()) { if ((plot != null) && plot.settings.isMerged()) {
BukkitPlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED); MainUtil.sendMessage(plr, C.UNLINK_REQUIRED);
return false; return false;
} }
final String id = args[0]; final String id = args[0];
@ -69,26 +69,26 @@ public class Swap extends SubCommand {
try { try {
plotid = new PlotId(Integer.parseInt(id.split(";")[0]), Integer.parseInt(id.split(";")[1])); plotid = new PlotId(Integer.parseInt(id.split(";")[0]), Integer.parseInt(id.split(";")[1]));
final Plot plot2 = PlotSquared.getPlots(world).get(plotid); final Plot plot2 = PlotSquared.getPlots(world).get(plotid);
if (((plot2 == null) || !plot2.hasOwner() || (plot2.owner != UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.swap")) { if (((plot2 == null) || !plot2.hasOwner() || (plot2.owner != UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.swap")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE, plotid.toString()); MainUtil.sendMessage(plr, C.NO_PERM_MERGE, plotid.toString());
return false; return false;
} }
} catch (final Exception e) { } catch (final Exception e) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
BukkitPlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX); MainUtil.sendMessage(plr, C.SWAP_SYNTAX);
return false; return false;
} }
assert plot != null; assert plot != null;
if (plot.id.equals(plotid)) { if (plot.id.equals(plotid)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
BukkitPlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX); MainUtil.sendMessage(plr, C.SWAP_SYNTAX);
return false; return false;
} }
PlotSelection.swap(world, plot.id, plotid); PlotSelection.swap(world, plot.id, plotid);
// TODO Requires testing!! // TODO Requires testing!!
DBFunc.dbManager.swapPlots(plot, MainUtil.getPlot(world, plotid)); DBFunc.dbManager.swapPlots(plot, MainUtil.getPlot(world, plotid));
// TODO Requires testing!! // TODO Requires testing!!
BukkitPlayerFunctions.sendMessage(plr, C.SWAP_SUCCESS); MainUtil.sendMessage(plr, C.SWAP_SUCCESS);
MainUtil.update(plr.getLocation()); MainUtil.update(plr.getLocation());
return true; return true;
} }

View File

@ -43,7 +43,7 @@ public class TP extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 1) { if (args.length < 1) {
BukkitPlayerFunctions.sendMessage(plr, C.NEED_PLOT_ID); MainUtil.sendMessage(plr, C.NEED_PLOT_ID);
return false; return false;
} }
final String id = args[0]; final String id = args[0];
@ -55,7 +55,7 @@ public class TP extends SubCommand {
} }
} }
if (!PlotSquared.isPlotWorld(world)) { if (!PlotSquared.isPlotWorld(world)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD); MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false; return false;
} }
Plot temp; Plot temp;
@ -68,7 +68,7 @@ public class TP extends SubCommand {
PlotSquared.teleportPlayer(plr, plr.getLocation(), MainUtil.getPlot(world, plotid)); PlotSquared.teleportPlayer(plr, plr.getLocation(), MainUtil.getPlot(world, plotid));
return true; return true;
} catch (final Exception e) { } catch (final Exception e) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
} }
return false; return false;
} }

View File

@ -37,21 +37,21 @@ public class Target extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (!PlotSquared.isPlotWorld(plr.getWorld())) { if (!PlotSquared.isPlotWorld(plr.getWorld())) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD); MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false; return false;
} }
if (args.length == 1) { if (args.length == 1) {
final PlotId id = MainUtil.parseId(args[1]); final PlotId id = MainUtil.parseId(args[1]);
if (id == null) { if (id == null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
return false; return false;
} }
final Location loc = MainUtil.getPlotHome(plr.getWorld(), id); final Location loc = MainUtil.getPlotHome(plr.getWorld(), id);
plr.setCompassTarget(loc); plr.setCompassTarget(loc);
BukkitPlayerFunctions.sendMessage(plr, C.COMPASS_TARGET); MainUtil.sendMessage(plr, C.COMPASS_TARGET);
return true; return true;
} }
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot target <X;Z>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot target <X;Z>");
return false; return false;
} }
} }

View File

@ -42,23 +42,23 @@ public class Template extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length != 2) { if (args.length != 2) {
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|export> <world>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|export> <world>");
return false; return false;
} }
final World world = Bukkit.getWorld(args[1]); final World world = Bukkit.getWorld(args[1]);
final PlotWorld plotworld = PlotSquared.getPlotWorld(args[1]); final PlotWorld plotworld = PlotSquared.getPlotWorld(args[1]);
if ((world == null) || (plotworld == null)) { if ((world == null) || (plotworld == null)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD); MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
return false; return false;
} }
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
case "import": { case "import": {
// TODO import template // TODO import template
BukkitPlayerFunctions.sendMessage(plr, "TODO"); MainUtil.sendMessage(plr, "TODO");
return true; return true;
} }
case "export": { case "export": {
BukkitPlayerFunctions.sendMessage(plr, "TODO"); MainUtil.sendMessage(plr, "TODO");
} }
} }
// TODO allow world settings (including schematics to be packed into a single file) // TODO allow world settings (including schematics to be packed into a single file)

View File

@ -63,35 +63,35 @@ public class Trim extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (plr != null) { if (plr != null) {
BukkitPlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE)); MainUtil.sendMessage(plr, (C.NOT_CONSOLE));
return false; return false;
} }
if (args.length == 1) { if (args.length == 1) {
final String arg = args[0].toLowerCase(); final String arg = args[0].toLowerCase();
final PlotId id = getId(arg); final PlotId id = getId(arg);
if (id != null) { if (id != null) {
BukkitPlayerFunctions.sendMessage(plr, "/plot trim x;z &l<world>"); MainUtil.sendMessage(plr, "/plot trim x;z &l<world>");
return false; return false;
} }
if (arg.equals("all")) { if (arg.equals("all")) {
BukkitPlayerFunctions.sendMessage(plr, "/plot trim all &l<world>"); MainUtil.sendMessage(plr, "/plot trim all &l<world>");
return false; return false;
} }
BukkitPlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX); MainUtil.sendMessage(plr, C.TRIM_SYNTAX);
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
BukkitPlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX); MainUtil.sendMessage(plr, C.TRIM_SYNTAX);
return false; return false;
} }
final String arg = args[0].toLowerCase(); final String arg = args[0].toLowerCase();
if (!arg.equals("all")) { if (!arg.equals("all")) {
BukkitPlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX); MainUtil.sendMessage(plr, C.TRIM_SYNTAX);
return false; return false;
} }
final World world = Bukkit.getWorld(args[1]); final World world = Bukkit.getWorld(args[1]);
if ((world == null) || (PlotSquared.getPlotWorld(world) == null)) { if ((world == null) || (PlotSquared.getPlotWorld(world) == null)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_WORLD); MainUtil.sendMessage(plr, C.NOT_VALID_WORLD);
return false; return false;
} }
if (Trim.TASK) { if (Trim.TASK) {

View File

@ -42,20 +42,20 @@ public class Trusted extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 2) { if (args.length < 2) {
BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT); MainUtil.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
return true; return true;
} }
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return true; return true;
} }
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if ((plot == null) || !plot.hasOwner()) { if ((plot == null) || !plot.hasOwner()) {
BukkitPlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !BukkitMain.hasPermission(plr, "plots.admin.command.trusted")) { if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !Permissions.hasPermission(plr, "plots.admin.command.trusted")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }
if (args[0].equalsIgnoreCase("add")) { if (args[0].equalsIgnoreCase("add")) {
@ -66,12 +66,12 @@ public class Trusted extends SubCommand {
uuid = UUIDHandler.getUUID(args[1]); uuid = UUIDHandler.getUUID(args[1]);
} }
if (uuid == null) { if (uuid == null) {
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[1]);
return false; return false;
} }
if (!plot.trusted.contains(uuid)) { if (!plot.trusted.contains(uuid)) {
if (plot.owner.equals(uuid)) { if (plot.owner.equals(uuid)) {
BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); MainUtil.sendMessage(plr, C.ALREADY_OWNER);
return false; return false;
} }
if (plot.helpers.contains(uuid)) { if (plot.helpers.contains(uuid)) {
@ -87,21 +87,21 @@ public class Trusted extends SubCommand {
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true); final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_ADDED); MainUtil.sendMessage(plr, C.ALREADY_ADDED);
return false; return false;
} }
BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED); MainUtil.sendMessage(plr, C.TRUSTED_ADDED);
return true; return true;
} else if (args[0].equalsIgnoreCase("remove")) { } else if (args[0].equalsIgnoreCase("remove")) {
if (args[1].equalsIgnoreCase("*")) { if (args[1].equalsIgnoreCase("*")) {
final UUID uuid = DBFunc.everyone; final UUID uuid = DBFunc.everyone;
if (!plot.trusted.contains(uuid)) { if (!plot.trusted.contains(uuid)) {
BukkitPlayerFunctions.sendMessage(plr, C.T_WAS_NOT_ADDED); MainUtil.sendMessage(plr, C.T_WAS_NOT_ADDED);
return true; return true;
} }
plot.removeTrusted(uuid); plot.removeTrusted(uuid);
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid); DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED); MainUtil.sendMessage(plr, C.TRUSTED_REMOVED);
return true; return true;
} }
final UUID uuid = UUIDHandler.getUUID(args[1]); final UUID uuid = UUIDHandler.getUUID(args[1]);
@ -109,9 +109,9 @@ public class Trusted extends SubCommand {
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid); DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false); final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED); MainUtil.sendMessage(plr, C.TRUSTED_REMOVED);
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT); MainUtil.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
return true; return true;
} }
return true; return true;

View File

@ -19,7 +19,7 @@ public class Unban extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 1) { if (args.length < 1) {
return BukkitPlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage); return MainUtil.sendMessage(plr, "&cUsage: &c" + this.usage);
} }
if (!BukkitPlayerFunctions.isInPlot(plr)) { if (!BukkitPlayerFunctions.isInPlot(plr)) {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);

View File

@ -48,7 +48,7 @@ public class Unclaim extends SubCommand {
if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
return !sendMessage(plr, C.UNLINK_REQUIRED); return !sendMessage(plr, C.UNLINK_REQUIRED);
} }
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr)))) && !BukkitMain.hasPermission(plr, "plots.admin.command.unclaim")) { if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr)))) && !Permissions.hasPermission(plr, "plots.admin.command.unclaim")) {
return !sendMessage(plr, C.NO_PLOT_PERMS); return !sendMessage(plr, C.NO_PLOT_PERMS);
} }
assert plot != null; assert plot != null;
@ -69,9 +69,9 @@ public class Unclaim extends SubCommand {
DBFunc.delete(worldname, plot); DBFunc.delete(worldname, plot);
// TODO set wall block // TODO set wall block
} else { } else {
BukkitPlayerFunctions.sendMessage(plr, "Plot removal has been denied."); MainUtil.sendMessage(plr, "Plot removal has been denied.");
} }
BukkitPlayerFunctions.sendMessage(plr, C.UNCLAIM_SUCCESS); MainUtil.sendMessage(plr, C.UNCLAIM_SUCCESS);
return true; return true;
} }
} }

View File

@ -55,7 +55,7 @@ public class Unlink extends SubCommand {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);
} }
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.unlink")) { if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.unlink")) {
return sendMessage(plr, C.NO_PLOT_PERMS); return sendMessage(plr, C.NO_PLOT_PERMS);
} }
if (BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { if (BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
@ -63,7 +63,7 @@ public class Unlink extends SubCommand {
} }
final World world = plr.getWorld(); final World world = plr.getWorld();
if (!unlinkPlot(world, plot)) { if (!unlinkPlot(world, plot)) {
BukkitPlayerFunctions.sendMessage(plr, "&cUnlink has been cancelled"); MainUtil.sendMessage(plr, "&cUnlink has been cancelled");
return false; return false;
} }
try { try {
@ -76,7 +76,7 @@ public class Unlink extends SubCommand {
ex.printStackTrace(); ex.printStackTrace();
} }
} }
BukkitPlayerFunctions.sendMessage(plr, "&6Plots unlinked successfully!"); MainUtil.sendMessage(plr, "&6Plots unlinked successfully!");
return true; return true;
} }

View File

@ -36,15 +36,15 @@ public class WE_Anywhere extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (PlotSquared.worldEdit == null) { if (PlotSquared.worldEdit == null) {
BukkitPlayerFunctions.sendMessage(plr, "&cWorldEdit is not enabled on this server"); MainUtil.sendMessage(plr, "&cWorldEdit is not enabled on this server");
return false; return false;
} }
if (BukkitMain.hasPermission(plr, "plots.worldedit.bypass") && PWE.hasMask(plr)) { if (Permissions.hasPermission(plr, "plots.worldedit.bypass") && PWE.hasMask(plr)) {
PWE.removeMask(plr); PWE.removeMask(plr);
BukkitPlayerFunctions.sendMessage(plr, "&6Cleared your WorldEdit mask"); MainUtil.sendMessage(plr, "&6Cleared your WorldEdit mask");
} else { } else {
PWE.setMask(plr, plr.getLocation(), true); PWE.setMask(plr, plr.getLocation(), true);
BukkitPlayerFunctions.sendMessage(plr, "&6Updated your WorldEdit mask"); MainUtil.sendMessage(plr, "&6Updated your WorldEdit mask");
} }
return true; return true;
} }

View File

@ -65,7 +65,7 @@ public class list extends SubCommand {
} else { } else {
builder.append(getArgumentList(new String[] { "all" })); builder.append(getArgumentList(new String[] { "all" }));
} }
BukkitPlayerFunctions.sendMessage(plr, builder.toString()); MainUtil.sendMessage(plr, builder.toString());
return true; return true;
} }
if (args[0].equalsIgnoreCase("forsale") && (plr != null)) { if (args[0].equalsIgnoreCase("forsale") && (plr != null)) {
@ -83,11 +83,11 @@ public class list extends SubCommand {
} }
} }
if (idx == 0) { if (idx == 0) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOTS); MainUtil.sendMessage(plr, C.NO_PLOTS);
return true; return true;
} }
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "Includes").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots")); string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "Includes").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots"));
BukkitPlayerFunctions.sendMessage(plr, string.toString()); MainUtil.sendMessage(plr, string.toString());
return true; return true;
} }
if (args[0].equalsIgnoreCase("mine") && (plr != null)) { if (args[0].equalsIgnoreCase("mine") && (plr != null)) {
@ -99,11 +99,11 @@ public class list extends SubCommand {
idx++; idx++;
} }
if (idx == 0) { if (idx == 0) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOTS); MainUtil.sendMessage(plr, C.NO_PLOTS);
return true; return true;
} }
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "You have").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots")); string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "You have").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots"));
BukkitPlayerFunctions.sendMessage(plr, string.toString()); MainUtil.sendMessage(plr, string.toString());
return true; return true;
} else if (args[0].equalsIgnoreCase("shared") && (plr != null)) { } else if (args[0].equalsIgnoreCase("shared") && (plr != null)) {
final StringBuilder string = new StringBuilder(); final StringBuilder string = new StringBuilder();
@ -114,7 +114,7 @@ public class list extends SubCommand {
} }
} }
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There are").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots")); string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There are").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots"));
BukkitPlayerFunctions.sendMessage(plr, string.toString()); MainUtil.sendMessage(plr, string.toString());
return true; return true;
} else if (args[0].equalsIgnoreCase("all")) { } else if (args[0].equalsIgnoreCase("all")) {
// Current page // Current page
@ -152,7 +152,7 @@ public class list extends SubCommand {
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n"); string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
} }
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots")); string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots"));
BukkitPlayerFunctions.sendMessage(plr, string.toString()); MainUtil.sendMessage(plr, string.toString());
return true; return true;
} else if (args[0].equalsIgnoreCase("world") && (plr != null)) { } else if (args[0].equalsIgnoreCase("world") && (plr != null)) {
final StringBuilder string = new StringBuilder(); final StringBuilder string = new StringBuilder();
@ -162,7 +162,7 @@ public class list extends SubCommand {
string.append(C.PLOT_LIST_ITEM.s().replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n"); string.append(C.PLOT_LIST_ITEM.s().replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
} }
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", plots.values().size() + "").replaceAll("%plot%", plots.values().size() == 1 ? "plot" : "plots")); string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", plots.values().size() + "").replaceAll("%plot%", plots.values().size() == 1 ? "plot" : "plots"));
BukkitPlayerFunctions.sendMessage(plr, string.toString()); MainUtil.sendMessage(plr, string.toString());
return true; return true;
} else { } else {
// execute(plr); // execute(plr);

View File

@ -103,7 +103,7 @@ public class plugin extends SubCommand {
} }
}; };
for (final String s : strings) { for (final String s : strings) {
BukkitPlayerFunctions.sendMessage(plr, s); MainUtil.sendMessage(plr, s);
} }
} }
}); });