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

View File

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

View File

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

View File

@ -115,7 +115,7 @@ public class Claim extends SubCommand {
if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
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);
}
}

View File

@ -71,7 +71,7 @@ public class Clear extends SubCommand {
if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
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);
}
assert plot != null;

View File

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

View File

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

View File

@ -49,7 +49,7 @@ public class Comment extends SubCommand {
}
final List<String> recipients = Arrays.asList("admin", "owner", "helper", "trusted", "everyone");
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 PlotComment comment = new PlotComment(text, plr.getName(), recipients.indexOf(args[0].toLowerCase()));
plot.settings.addComment(comment);

View File

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

View File

@ -37,17 +37,17 @@ public class Copy extends SubCommand {
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
if (!BukkitPlayerFunctions.isInPlot(plr)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return false;
}
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.copy")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.copy")) {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false;
}
assert plot != null;
if (plot.settings.isMerged()) {
BukkitPlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
MainUtil.sendMessage(plr, C.UNLINK_REQUIRED);
return false;
}
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
public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 1) {
return BukkitPlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage);
return MainUtil.sendMessage(plr, "&cUsage: &c" + this.usage);
}
if (!BukkitPlayerFunctions.isInPlot(plr)) {
return sendMessage(plr, C.NOT_IN_PLOT);

View File

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

View File

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

View File

@ -76,11 +76,11 @@ public class DebugClaimTest extends SubCommand {
public boolean execute(final PlotPlayer plr, final String... args) {
if (plr == null) {
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]);
if ((world == null) || !PlotSquared.isPlotWorld(world)) {
return !BukkitPlayerFunctions.sendMessage(null, "&cInvalid plot world!");
return !MainUtil.sendMessage(null, "&cInvalid plot world!");
}
PlotId min, max;
try {
@ -89,10 +89,10 @@ public class DebugClaimTest extends SubCommand {
min = new PlotId(Integer.parseInt(split1[0]), Integer.parseInt(split1[1]));
max = new PlotId(Integer.parseInt(split2[0]), Integer.parseInt(split2[1]));
} 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...");
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: &7Beginning sign to plot conversion. This may take a while...");
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 PlotWorld plotworld = PlotSquared.getPlotWorld(world);
final ArrayList<Plot> plots = new ArrayList<>();
@ -100,7 +100,7 @@ public class DebugClaimTest extends SubCommand {
final Plot plot = MainUtil.getPlot(world, id);
final boolean contains = PlotSquared.getPlots(world).containsKey(plot.id);
if (contains) {
BukkitPlayerFunctions.sendMessage(null, " - &cDB Already contains: " + plot.id);
MainUtil.sendMessage(null, " - &cDB Already contains: " + plot.id);
continue;
}
final Location loc = manager.getSignLoc(world, plotworld, plot);
@ -132,30 +132,30 @@ public class DebugClaimTest extends SubCommand {
uuid = UUIDHandler.getUUID(line);
}
if (uuid != null) {
BukkitPlayerFunctions.sendMessage(null, " - &aFound plot: " + plot.id + " : " + line);
MainUtil.sendMessage(null, " - &aFound plot: " + plot.id + " : " + line);
plot.owner = uuid;
plot.hasChanged = true;
plots.add(plot);
} else {
BukkitPlayerFunctions.sendMessage(null, " - &cInvalid playername: " + plot.id + " : " + line);
MainUtil.sendMessage(null, " - &cInvalid playername: " + plot.id + " : " + line);
}
}
}
}
}
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.createAllSettingsAndHelpers(plots);
for (final Plot plot : plots) {
PlotSquared.updatePlot(plot);
}
BukkitPlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Complete!");
MainUtil.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Complete!");
} else {
BukkitPlayerFunctions.sendMessage(null, "No plots were found for the given search.");
MainUtil.sendMessage(null, "No plots were found for the given search.");
}
} 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;
}

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 pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id);
if (MainUtil.runners.containsKey(plot)) {
BukkitPlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER);
MainUtil.sendMessage(null, C.WAIT_FOR_TIMER);
return false;
}
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))) {
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);
}
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 pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id);
if (MainUtil.runners.containsKey(plot)) {
BukkitPlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER);
MainUtil.sendMessage(null, C.WAIT_FOR_TIMER);
return false;
}
MainUtil.runners.put(plot, 1);
@ -105,7 +105,7 @@ public class DebugClear extends SubCommand {
@Override
public void run() {
MainUtil.runners.remove(plot);
BukkitPlayerFunctions.sendMessage(plr, "&aDone!");
MainUtil.sendMessage(plr, "&aDone!");
}
});
// sign

View File

@ -59,77 +59,77 @@ public class DebugExec extends SubCommand {
if (ExpireManager.task != -1) {
Bukkit.getScheduler().cancelTask(ExpireManager.task);
} else {
return BukkitPlayerFunctions.sendMessage(null, "Task already halted");
return MainUtil.sendMessage(null, "Task already halted");
}
ExpireManager.task = -1;
return BukkitPlayerFunctions.sendMessage(null, "Cancelled task.");
return MainUtil.sendMessage(null, "Cancelled task.");
}
case "start-expire": {
if (ExpireManager.task == -1) {
ExpireManager.runTask();
} 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": {
if (args.length > 1) {
final World world = Bukkit.getWorld(args[1]);
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]);
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": {
if (args.length > 1) {
final World world = Bukkit.getWorld(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()) {
final Plot plot = entry.getKey();
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 BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec show-expired <world>");
return MainUtil.sendMessage(null, "Use /plot debugexec show-expired <world>");
}
case "seen": {
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]);
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);
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 Date date = new Date(stamp.getTime());
BukkitPlayerFunctions.sendMessage(null, "PLAYER: " + args[1]);
BukkitPlayerFunctions.sendMessage(null, "UUID: " + uuid);
BukkitPlayerFunctions.sendMessage(null, "Object: " + date.toGMTString());
BukkitPlayerFunctions.sendMessage(null, "GMT: " + date.toGMTString());
BukkitPlayerFunctions.sendMessage(null, "Local: " + date.toLocaleString());
MainUtil.sendMessage(null, "PLAYER: " + args[1]);
MainUtil.sendMessage(null, "UUID: " + uuid);
MainUtil.sendMessage(null, "Object: " + date.toGMTString());
MainUtil.sendMessage(null, "GMT: " + date.toGMTString());
MainUtil.sendMessage(null, "Local: " + date.toLocaleString());
return true;
}
case "trim-check": {
if (args.length != 2) {
BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec trim-check <world>");
BukkitPlayerFunctions.sendMessage(null, "&7 - Generates a list of regions to trim");
return BukkitPlayerFunctions.sendMessage(null, "&7 - Run after plot expiry has run");
MainUtil.sendMessage(null, "Use /plot debugexec trim-check <world>");
MainUtil.sendMessage(null, "&7 - Generates a list of regions to trim");
return MainUtil.sendMessage(null, "&7 - Run after plot expiry has run");
}
final World world = Bukkit.getWorld(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 boolean result = Trim.getTrimRegions(empty, world, new Runnable() {
@ -160,7 +160,7 @@ public class DebugExec extends SubCommand {
}
});
if (!result) {
BukkitPlayerFunctions.sendMessage(null, "Trim task already started!");
MainUtil.sendMessage(null, "Trim task already started!");
}
return result;
}

View File

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

View File

@ -49,7 +49,7 @@ public class DebugLoadTest extends SubCommand {
PlotSquared.log("&3===END OF STACKTRACE===");
}
} 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;
}

View File

@ -45,7 +45,7 @@ public class DebugSaveTest extends SubCommand {
DBFunc.createPlots(plots);
DBFunc.createAllSettingsAndHelpers(plots);
} 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;
}

View File

@ -47,7 +47,7 @@ public class Delete extends SubCommand {
if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
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);
}
assert plot != null;
@ -65,7 +65,7 @@ public class Delete extends SubCommand {
plot.clear(plr, true);
DBFunc.delete(plr.getWorld().getName(), plot);
} else {
BukkitPlayerFunctions.sendMessage(plr, "Plot deletion has been denied.");
MainUtil.sendMessage(plr, "Plot deletion has been denied.");
}
return true;
}

View File

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

View File

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

View File

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

View File

@ -51,17 +51,17 @@ public class Inbox extends SubCommand {
}
}
if (!BukkitPlayerFunctions.isInPlot(plr) && !report) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return false;
}
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
if ((plot != null) && !plot.hasOwner()) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return false;
}
Integer tier;
final UUID uuid = UUIDHandler.getUUID(plr);
if (BukkitMain.hasPermission(plr, "plots.comment.admin")) {
if (Permissions.hasPermission(plr, "plots.comment.admin")) {
tier = 0;
} else if ((plot != null) && plot.owner.equals(uuid)) {
tier = 1;
@ -80,7 +80,7 @@ public class Inbox extends SubCommand {
if (tier <= 0) {
tier = 0;
} else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin");
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin");
return false;
}
break;
@ -88,7 +88,7 @@ public class Inbox extends SubCommand {
if (tier <= 1) {
tier = 1;
} else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.owner");
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.owner");
return false;
}
break;
@ -96,7 +96,7 @@ public class Inbox extends SubCommand {
if (tier <= 2) {
tier = 2;
} else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.helper");
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.helper");
return false;
}
break;
@ -104,7 +104,7 @@ public class Inbox extends SubCommand {
if (tier <= 3) {
tier = 3;
} else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.trusted");
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.trusted");
return false;
}
break;
@ -112,7 +112,7 @@ public class Inbox extends SubCommand {
if (tier <= 4) {
tier = 4;
} else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.everyone");
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.everyone");
return false;
}
break;
@ -120,12 +120,12 @@ public class Inbox extends SubCommand {
if (tier <= 0) {
tier = -1;
} else {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin");
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin");
return false;
}
break;
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;
}
} else {
@ -149,7 +149,7 @@ public class Inbox extends SubCommand {
if (args.length == 2) {
final String[] split = args[1].toLowerCase().split(":");
if (!split[0].equals("clear")) {
BukkitPlayerFunctions.sendMessage(plr, "&c/plot inbox [tier] [clear][:#]");
MainUtil.sendMessage(plr, "&c/plot inbox [tier] [clear][:#]");
return;
}
if (split.length > 1) {
@ -158,10 +158,10 @@ public class Inbox extends SubCommand {
final PlotComment comment = comments.get(index - 1);
DBFunc.removeComment(world, plot, comment);
plot.settings.removeComment(comment);
BukkitPlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "1 comment");
MainUtil.sendMessage(plr, C.COMMENT_REMOVED, "1 comment");
return;
} 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;
}
}
@ -169,7 +169,7 @@ public class Inbox extends SubCommand {
DBFunc.removeComment(world, plot, comment);
}
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 {
final List<String> recipients = Arrays.asList("A", "O", "H", "T", "E");
int count = 1;
@ -183,7 +183,7 @@ public class Inbox extends SubCommand {
if (comments.size() == 0) {
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);
} else {
if (args.length < 2) {
BukkitPlayerFunctions.sendMessage(null, C.INFO_SYNTAX_CONSOLE);
MainUtil.sendMessage(null, C.INFO_SYNTAX_CONSOLE);
return false;
}
final PlotWorld plotworld = PlotSquared.getPlotWorld(args[0]);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -69,8 +69,8 @@ public class Schematic extends SubCommand {
PlotSquared.log(C.IS_CONSOLE);
return false;
}
if (!BukkitMain.hasPermission(plr, "plots.schematic.paste")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste");
if (!Permissions.hasPermission(plr, "plots.schematic.paste")) {
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste");
return false;
}
if (args.length < 2) {
@ -82,7 +82,7 @@ public class Schematic extends SubCommand {
break;
}
if (this.running) {
BukkitPlayerFunctions.sendMessage(plr, "&cTask is already running.");
MainUtil.sendMessage(plr, "&cTask is already running.");
return false;
}
final String file2 = args[1];
@ -150,8 +150,8 @@ public class Schematic extends SubCommand {
PlotSquared.log(C.IS_CONSOLE);
return false;
}
if (!BukkitMain.hasPermission(plr, "plots.schematic.test")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.test");
if (!Permissions.hasPermission(plr, "plots.schematic.test")) {
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.test");
return false;
}
if (args.length < 2) {
@ -177,20 +177,20 @@ public class Schematic extends SubCommand {
case "saveall":
case "exportall":
if (plr != null) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_CONSOLE);
MainUtil.sendMessage(plr, C.NOT_CONSOLE);
return false;
}
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;
}
final HashMap<PlotId, Plot> plotmap = PlotSquared.getPlots(args[1]);
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;
}
if (this.running) {
BukkitPlayerFunctions.sendMessage(null, "&cTask is already running.");
MainUtil.sendMessage(null, "&cTask is already running.");
return false;
}
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 owner = o == null ? "unknown" : o;
if (sch == null) {
BukkitPlayerFunctions.sendMessage(null, "&7 - Skipped plot &c" + plot.id);
MainUtil.sendMessage(null, "&7 - Skipped plot &c" + plot.id);
} else {
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() {
@Override
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");
if (!result) {
BukkitPlayerFunctions.sendMessage(null, "&7 - Failed to save &c" + plot.id);
MainUtil.sendMessage(null, "&7 - Failed to save &c" + plot.id);
} 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;
case "export":
case "save":
if (!BukkitMain.hasPermission(plr, "plots.schematic.save")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save");
if (!Permissions.hasPermission(plr, "plots.schematic.save")) {
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save");
return false;
}
if (this.running) {
BukkitPlayerFunctions.sendMessage(plr, "&cTask is already running.");
MainUtil.sendMessage(plr, "&cTask is already running.");
return false;
}
final String world;
@ -266,16 +266,16 @@ public class Schematic extends SubCommand {
final String[] split = args[2].split(";");
final PlotId i = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
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;
}
p2 = PlotSquared.getPlots(world).get(i);
} 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;
}
} 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;
}
}
@ -297,17 +297,17 @@ public class Schematic extends SubCommand {
final String o = UUIDHandler.getName(plot.owner);
final String owner = o == null ? "unknown" : o;
if (sch == null) {
BukkitPlayerFunctions.sendMessage(plr, "&7 - Skipped plot &c" + plot.id);
MainUtil.sendMessage(plr, "&7 - Skipped plot &c" + plot.id);
} else {
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() {
@Override
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");
if (!result) {
BukkitPlayerFunctions.sendMessage(plr, "&7 - Failed to save &c" + plot.id);
MainUtil.sendMessage(plr, "&7 - Failed to save &c" + plot.id);
} 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
public boolean execute(final PlotPlayer plr, final String... args) {
if (!BukkitPlayerFunctions.isInPlot(plr)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
return false;
}
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
@ -74,12 +74,12 @@ public class Set extends SubCommand {
sendMessage(plr, C.PLOT_NOT_CLAIMED);
return false;
}
if (!plot.hasRights(plr) && !BukkitMain.hasPermission(plr, "plots.admin.command.set")) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
if (!plot.hasRights(plr) && !Permissions.hasPermission(plr, "plots.admin.command.set")) {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false;
}
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;
}
for (int i = 0; i < aliases.length; i++) {
@ -90,8 +90,8 @@ public class Set extends SubCommand {
}
/* TODO: Implement option */
// final boolean advanced_permissions = true;
if (!BukkitMain.hasPermission(plr, "plots.set." + args[0].toLowerCase())) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.set." + args[0].toLowerCase());
if (!Permissions.hasPermission(plr, "plots.set." + args[0].toLowerCase())) {
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set." + args[0].toLowerCase());
return false;
}
if (args[0].equalsIgnoreCase("flag")) {
@ -104,7 +104,7 @@ public class Set extends SubCommand {
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;
}
AbstractFlag af;
@ -114,11 +114,11 @@ public class Set extends SubCommand {
af = new AbstractFlag(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;
}
if (!BukkitMain.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
if (!Permissions.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) {
MainUtil.sendMessage(plr, C.NO_PERMISSION);
return false;
}
if (args.length == 2) {
@ -129,15 +129,15 @@ public class Set extends SubCommand {
return false;
}
}
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_NOT_IN_PLOT);
MainUtil.sendMessage(plr, C.FLAG_NOT_IN_PLOT);
return false;
}
final boolean result = FlagManager.removePlotFlag(plot, args[1].toLowerCase());
if (!result) {
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_NOT_REMOVED);
MainUtil.sendMessage(plr, C.FLAG_NOT_REMOVED);
return false;
}
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_REMOVED);
MainUtil.sendMessage(plr, C.FLAG_REMOVED);
PlotListener.plotEntry(plr, plot);
return true;
}
@ -145,7 +145,7 @@ public class Set extends SubCommand {
final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
final Object parsed_value = af.parseValueRaw(value);
if (parsed_value == null) {
BukkitPlayerFunctions.sendMessage(plr, af.getValueDesc());
MainUtil.sendMessage(plr, af.getValueDesc());
return false;
}
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 boolean result = FlagManager.addPlotFlag(plot, flag);
if (!result) {
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_NOT_ADDED);
MainUtil.sendMessage(plr, C.FLAG_NOT_ADDED);
return false;
}
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_ADDED);
MainUtil.sendMessage(plr, C.FLAG_ADDED);
PlotListener.plotEntry(plr, plot);
return true;
} catch (final Exception e) {
BukkitPlayerFunctions.sendMessage(plr, "&c" + e.getMessage());
MainUtil.sendMessage(plr, "&c" + e.getMessage());
return false;
}
}
@ -173,7 +173,7 @@ public class Set extends SubCommand {
DBFunc.setPosition(plr.getWorld().getName(), plot, "");
return true;
}
return BukkitPlayerFunctions.sendMessage(plr, C.HOME_ARGUMENT);
return MainUtil.sendMessage(plr, C.HOME_ARGUMENT);
}
//set to current location
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());
plot.settings.setPosition(blockloc);
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.length < 2) {
BukkitPlayerFunctions.sendMessage(plr, C.MISSING_ALIAS);
MainUtil.sendMessage(plr, C.MISSING_ALIAS);
return false;
}
final String alias = args[1];
if (alias.length() >= 50) {
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_TOO_LONG);
MainUtil.sendMessage(plr, C.ALIAS_TOO_LONG);
return false;
}
for (final Plot p : PlotSquared.getPlots(plr.getWorld()).values()) {
if (p.settings.getAlias().equalsIgnoreCase(alias)) {
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
return false;
}
if (UUIDHandler.nameExists(new StringWrapper(alias))) {
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
return false;
}
}
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;
}
if (args[0].equalsIgnoreCase("biome")) {
if (args.length < 2) {
BukkitPlayerFunctions.sendMessage(plr, C.NEED_BIOME);
MainUtil.sendMessage(plr, C.NEED_BIOME);
return true;
}
if (args[1].length() < 2) {
@ -228,11 +228,11 @@ public class Set extends SubCommand {
* }
*/
if (biome == null) {
BukkitPlayerFunctions.sendMessage(plr, getBiomeList(Arrays.asList(Biome.values())));
MainUtil.sendMessage(plr, getBiomeList(Arrays.asList(Biome.values())));
return true;
}
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;
}
// Get components
@ -243,7 +243,7 @@ public class Set extends SubCommand {
for (final String component : components) {
if (component.equalsIgnoreCase(args[0])) {
if (args.length < 2) {
BukkitPlayerFunctions.sendMessage(plr, C.NEED_BLOCK);
MainUtil.sendMessage(plr, C.NEED_BLOCK);
return true;
}
PlotBlock[] blocks;
@ -253,12 +253,12 @@ public class Set extends SubCommand {
try {
blocks = new PlotBlock[] { new PlotBlock((short) getMaterial(args[1], PlotWorld.BLOCKS).getId(), (byte) 0) };
} catch (final Exception e2) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_BLOCK);
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK);
return false;
}
}
manager.setComponent(world, plotworld, plot.id, component, blocks);
BukkitPlayerFunctions.sendMessage(plr, C.GENERATING_COMPONENT);
MainUtil.sendMessage(plr, C.GENERATING_COMPONENT);
return true;
}
}
@ -280,7 +280,7 @@ public class Set extends SubCommand {
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;
}

View File

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

View File

@ -93,13 +93,13 @@ public class Setup extends SubCommand {
updateGenerators();
final String prefix = "\n&8 - &7";
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;
}
if (args.length == 1) {
if (args[0].equalsIgnoreCase("cancel")) {
setupMap.remove(plr.getName());
BukkitPlayerFunctions.sendMessage(plr, "&aCancelled setup");
MainUtil.sendMessage(plr, "&aCancelled setup");
return false;
}
if (args[0].equalsIgnoreCase("back")) {
@ -120,14 +120,14 @@ public class Setup extends SubCommand {
case 0: { // choose generator
if ((args.length != 1) || !this.generators.containsKey(args[0])) {
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);
return false;
}
object.generator = args[0];
object.current++;
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;
}
case 1: { // choose world type
@ -138,7 +138,7 @@ public class Setup extends SubCommand {
types = Arrays.asList(new String[] { "default", "augmented" });
}
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;
}
object.type = types.indexOf(args[0].toLowerCase());
@ -150,7 +150,7 @@ public class Setup extends SubCommand {
final ConfigurationNode step = object.step[object.setup_index];
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + "");
} 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++;
break;
@ -158,7 +158,7 @@ public class Setup extends SubCommand {
case 2: { // Choose terrain
final List<String> terrain = Arrays.asList(new String[] { "none", "ore", "all" });
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;
}
object.terrain = terrain.indexOf(args[0].toLowerCase());
@ -172,7 +172,7 @@ public class Setup extends SubCommand {
}
case 3: { // world setup
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.current++;
return true;
@ -202,11 +202,11 @@ public class Setup extends SubCommand {
}
case 4: {
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;
}
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];
setupMap.remove(plr.getName());

View File

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

View File

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

View File

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

View File

@ -42,23 +42,23 @@ public class Template extends SubCommand {
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
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;
}
final World world = Bukkit.getWorld(args[1]);
final PlotWorld plotworld = PlotSquared.getPlotWorld(args[1]);
if ((world == null) || (plotworld == null)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
return false;
}
switch (args[0].toLowerCase()) {
case "import": {
// TODO import template
BukkitPlayerFunctions.sendMessage(plr, "TODO");
MainUtil.sendMessage(plr, "TODO");
return true;
}
case "export": {
BukkitPlayerFunctions.sendMessage(plr, "TODO");
MainUtil.sendMessage(plr, "TODO");
}
}
// 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
public boolean execute(final PlotPlayer plr, final String... args) {
if (plr != null) {
BukkitPlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE));
MainUtil.sendMessage(plr, (C.NOT_CONSOLE));
return false;
}
if (args.length == 1) {
final String arg = args[0].toLowerCase();
final PlotId id = getId(arg);
if (id != null) {
BukkitPlayerFunctions.sendMessage(plr, "/plot trim x;z &l<world>");
MainUtil.sendMessage(plr, "/plot trim x;z &l<world>");
return false;
}
if (arg.equals("all")) {
BukkitPlayerFunctions.sendMessage(plr, "/plot trim all &l<world>");
MainUtil.sendMessage(plr, "/plot trim all &l<world>");
return false;
}
BukkitPlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX);
MainUtil.sendMessage(plr, C.TRIM_SYNTAX);
return false;
}
if (args.length != 2) {
BukkitPlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX);
MainUtil.sendMessage(plr, C.TRIM_SYNTAX);
return false;
}
final String arg = args[0].toLowerCase();
if (!arg.equals("all")) {
BukkitPlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX);
MainUtil.sendMessage(plr, C.TRIM_SYNTAX);
return false;
}
final World world = Bukkit.getWorld(args[1]);
if ((world == null) || (PlotSquared.getPlotWorld(world) == null)) {
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_WORLD);
MainUtil.sendMessage(plr, C.NOT_VALID_WORLD);
return false;
}
if (Trim.TASK) {

View File

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

View File

@ -19,7 +19,7 @@ public class Unban extends SubCommand {
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 1) {
return BukkitPlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage);
return MainUtil.sendMessage(plr, "&cUsage: &c" + this.usage);
}
if (!BukkitPlayerFunctions.isInPlot(plr)) {
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))) {
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);
}
assert plot != null;
@ -69,9 +69,9 @@ public class Unclaim extends SubCommand {
DBFunc.delete(worldname, plot);
// TODO set wall block
} 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;
}
}

View File

@ -55,7 +55,7 @@ public class Unlink extends SubCommand {
return sendMessage(plr, C.NOT_IN_PLOT);
}
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);
}
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();
if (!unlinkPlot(world, plot)) {
BukkitPlayerFunctions.sendMessage(plr, "&cUnlink has been cancelled");
MainUtil.sendMessage(plr, "&cUnlink has been cancelled");
return false;
}
try {
@ -76,7 +76,7 @@ public class Unlink extends SubCommand {
ex.printStackTrace();
}
}
BukkitPlayerFunctions.sendMessage(plr, "&6Plots unlinked successfully!");
MainUtil.sendMessage(plr, "&6Plots unlinked successfully!");
return true;
}

View File

@ -36,15 +36,15 @@ public class WE_Anywhere extends SubCommand {
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
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;
}
if (BukkitMain.hasPermission(plr, "plots.worldedit.bypass") && PWE.hasMask(plr)) {
if (Permissions.hasPermission(plr, "plots.worldedit.bypass") && PWE.hasMask(plr)) {
PWE.removeMask(plr);
BukkitPlayerFunctions.sendMessage(plr, "&6Cleared your WorldEdit mask");
MainUtil.sendMessage(plr, "&6Cleared your WorldEdit mask");
} else {
PWE.setMask(plr, plr.getLocation(), true);
BukkitPlayerFunctions.sendMessage(plr, "&6Updated your WorldEdit mask");
MainUtil.sendMessage(plr, "&6Updated your WorldEdit mask");
}
return true;
}

View File

@ -65,7 +65,7 @@ public class list extends SubCommand {
} else {
builder.append(getArgumentList(new String[] { "all" }));
}
BukkitPlayerFunctions.sendMessage(plr, builder.toString());
MainUtil.sendMessage(plr, builder.toString());
return true;
}
if (args[0].equalsIgnoreCase("forsale") && (plr != null)) {
@ -83,11 +83,11 @@ public class list extends SubCommand {
}
}
if (idx == 0) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOTS);
MainUtil.sendMessage(plr, C.NO_PLOTS);
return true;
}
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;
}
if (args[0].equalsIgnoreCase("mine") && (plr != null)) {
@ -99,11 +99,11 @@ public class list extends SubCommand {
idx++;
}
if (idx == 0) {
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOTS);
MainUtil.sendMessage(plr, C.NO_PLOTS);
return true;
}
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;
} else if (args[0].equalsIgnoreCase("shared") && (plr != null)) {
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"));
BukkitPlayerFunctions.sendMessage(plr, string.toString());
MainUtil.sendMessage(plr, string.toString());
return true;
} else if (args[0].equalsIgnoreCase("all")) {
// 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_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;
} else if (args[0].equalsIgnoreCase("world") && (plr != null)) {
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_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;
} else {
// execute(plr);

View File

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