mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 23:26:45 +01:00
.
This commit is contained in:
parent
632a6e4268
commit
afd0218f40
@ -76,7 +76,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
if (Settings.USE_PLOTME_ALIAS) {
|
if (Settings.USE_PLOTME_ALIAS) {
|
||||||
player.performCommand(message.replace("/plotme", "plots"));
|
player.performCommand(message.replace("/plotme", "plots"));
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_USING_PLOTME);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_USING_PLOTME);
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
|||||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class Auto extends SubCommand {
|
public class Auto extends SubCommand {
|
||||||
public Auto() {
|
public Auto() {
|
||||||
@ -87,7 +87,7 @@ public class Auto extends SubCommand {
|
|||||||
if (PlotSquared.isPlotWorld(plr.getWorld().getName())) {
|
if (PlotSquared.isPlotWorld(plr.getWorld().getName())) {
|
||||||
world = plr.getWorld();
|
world = plr.getWorld();
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,10 +98,10 @@ public class Auto extends SubCommand {
|
|||||||
size_x = Integer.parseInt(split[0]);
|
size_x = Integer.parseInt(split[0]);
|
||||||
size_z = Integer.parseInt(split[1]);
|
size_z = Integer.parseInt(split[1]);
|
||||||
if ((size_x < 1) || (size_z < 1)) {
|
if ((size_x < 1) || (size_z < 1)) {
|
||||||
PlayerFunctions.sendMessage(plr, "&cError: size<=0");
|
BukkitPlayerFunctions.sendMessage(plr, "&cError: size<=0");
|
||||||
}
|
}
|
||||||
if ((size_x > 4) || (size_z > 4)) {
|
if ((size_x > 4) || (size_z > 4)) {
|
||||||
PlayerFunctions.sendMessage(plr, "&cError: size>4");
|
BukkitPlayerFunctions.sendMessage(plr, "&cError: size>4");
|
||||||
}
|
}
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
schematic = args[1];
|
schematic = args[1];
|
||||||
@ -121,15 +121,15 @@ public class Auto extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((size_x * size_z) > Settings.MAX_AUTO_SIZE) {
|
if ((size_x * size_z) > Settings.MAX_AUTO_SIZE) {
|
||||||
PlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.MAX_AUTO_SIZE + "");
|
BukkitPlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.MAX_AUTO_SIZE + "");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int diff = PlayerFunctions.getPlayerPlotCount(world, plr) - PlayerFunctions.getAllowedPlots(plr);
|
final int diff = BukkitPlayerFunctions.getPlayerPlotCount(world, plr) - BukkitPlayerFunctions.getAllowedPlots(plr);
|
||||||
if ((diff + (size_x * size_z)) > 0) {
|
if ((diff + (size_x * size_z)) > 0) {
|
||||||
if (diff < 0) {
|
if (diff < 0) {
|
||||||
PlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, (-diff) + "");
|
BukkitPlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, (-diff) + "");
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
BukkitPlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ public class Auto extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) {
|
if (!BukkitMain.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
@ -170,7 +170,7 @@ public class Auto extends SubCommand {
|
|||||||
final PlotCluster cluster = ClusterManager.getCluster(loc);
|
final PlotCluster cluster = ClusterManager.getCluster(loc);
|
||||||
// Must be standing in a cluster
|
// Must be standing in a cluster
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotId bot = cluster.getP1();
|
final PlotId bot = cluster.getP1();
|
||||||
@ -190,7 +190,7 @@ public class Auto extends SubCommand {
|
|||||||
id = getNextPlot(id, 1);
|
id = getNextPlot(id, 1);
|
||||||
}
|
}
|
||||||
// no free plots
|
// no free plots
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_FREE_PLOTS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_FREE_PLOTS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean br = false;
|
boolean br = false;
|
||||||
@ -225,7 +225,7 @@ public class Auto extends SubCommand {
|
|||||||
Claim.claimPlot(plr, plot, teleport, true);
|
Claim.claimPlot(plr, plot, teleport, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!MainUtil.mergePlots(plr, worldname, PlayerFunctions.getPlotSelectionIds(start, end))) {
|
if (!MainUtil.mergePlots(plr, worldname, BukkitPlayerFunctions.getPlotSelectionIds(start, end))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
br = true;
|
br = true;
|
||||||
|
@ -4,7 +4,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created 2014-11-09 for PlotSquared
|
* Created 2014-11-09 for PlotSquared
|
||||||
@ -19,12 +19,12 @@ public class Ban extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
return PlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage);
|
return BukkitPlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage);
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (!plot.hasRights(plr)) {
|
if (!plot.hasRights(plr)) {
|
||||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,12 +64,12 @@ public class Buy extends SubCommand {
|
|||||||
return sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
return sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
plot = PlayerFunctions.getCurrentPlot(plr);
|
plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
}
|
}
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (PlayerFunctions.getPlayerPlotCount(world, plr) >= PlayerFunctions.getAllowedPlots(plr)) {
|
if (BukkitPlayerFunctions.getPlayerPlotCount(world, plr) >= BukkitPlayerFunctions.getAllowedPlots(plr)) {
|
||||||
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
@ -85,8 +85,8 @@ public class Buy extends SubCommand {
|
|||||||
double initPrice = (double) flag.getValue();
|
double initPrice = (double) flag.getValue();
|
||||||
double price = initPrice;
|
double price = initPrice;
|
||||||
final PlotId id = plot.id;
|
final PlotId id = plot.id;
|
||||||
final PlotId id2 = PlayerFunctions.getTopPlot(world, plot).id;
|
final PlotId id2 = BukkitPlayerFunctions.getTopPlot(world, plot).id;
|
||||||
final int size = PlayerFunctions.getPlotSelectionIds(id, id2).size();
|
final int size = BukkitPlayerFunctions.getPlotSelectionIds(id, id2).size();
|
||||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||||
if (plotworld.USE_ECONOMY) {
|
if (plotworld.USE_ECONOMY) {
|
||||||
price += plotworld.PLOT_PRICE * size;
|
price += plotworld.PLOT_PRICE * size;
|
||||||
@ -108,7 +108,7 @@ public class Buy extends SubCommand {
|
|||||||
}
|
}
|
||||||
plot.owner = UUIDHandler.getUUID(plr);
|
plot.owner = UUIDHandler.getUUID(plr);
|
||||||
DBFunc.setOwner(plot, plot.owner);
|
DBFunc.setOwner(plot, plot.owner);
|
||||||
PlayerFunctions.sendMessage(plr, C.CLAIMED);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLAIMED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
@ -57,7 +57,7 @@ public class Claim extends SubCommand {
|
|||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
MainUtil.createPlot(player, plot);
|
MainUtil.createPlot(player, plot);
|
||||||
MainUtil.setSign(player, plot);
|
MainUtil.setSign(player, plot);
|
||||||
PlayerFunctions.sendMessage(player, C.CLAIMED);
|
BukkitPlayerFunctions.sendMessage(player, C.CLAIMED);
|
||||||
if (teleport) {
|
if (teleport) {
|
||||||
PlotSquared.teleportPlayer(player, BukkitUtil.getLocation(entity), plot);
|
PlotSquared.teleportPlayer(player, BukkitUtil.getLocation(entity), plot);
|
||||||
}
|
}
|
||||||
@ -88,13 +88,13 @@ public class Claim extends SubCommand {
|
|||||||
if (args.length >= 1) {
|
if (args.length >= 1) {
|
||||||
schematic = args[0];
|
schematic = args[0];
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (PlayerFunctions.getPlayerPlotCount(plr.getWorld(), plr) >= PlayerFunctions.getAllowedPlots(plr)) {
|
if (BukkitPlayerFunctions.getPlayerPlotCount(plr.getWorld(), plr) >= BukkitPlayerFunctions.getAllowedPlots(plr)) {
|
||||||
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
return sendMessage(plr, C.PLOT_IS_CLAIMED);
|
return sendMessage(plr, C.PLOT_IS_CLAIMED);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class Clear extends SubCommand {
|
public class Clear extends SubCommand {
|
||||||
@ -64,11 +64,11 @@ public class Clear extends SubCommand {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
||||||
return sendMessage(plr, C.UNLINK_REQUIRED);
|
return sendMessage(plr, C.UNLINK_REQUIRED);
|
||||||
}
|
}
|
||||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.clear")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.clear")) {
|
||||||
|
@ -24,7 +24,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class Clipboard extends SubCommand {
|
public class Clipboard extends SubCommand {
|
||||||
public Clipboard() {
|
public Clipboard() {
|
||||||
@ -42,7 +42,7 @@ public class Clipboard extends SubCommand {
|
|||||||
final int total = selection.getBlocks().length;
|
final int total = selection.getBlocks().length;
|
||||||
String message = C.CLIPBOARD_INFO.s();
|
String message = C.CLIPBOARD_INFO.s();
|
||||||
message = message.replace("%id", plotId.toString()).replace("%width", width + "").replace("%total", total + "");
|
message = message.replace("%id", plotId.toString()).replace("%width", width + "").replace("%total", total + "");
|
||||||
PlayerFunctions.sendMessage(plr, message);
|
BukkitPlayerFunctions.sendMessage(plr, message);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class Cluster extends SubCommand {
|
public class Cluster extends SubCommand {
|
||||||
@ -55,7 +55,7 @@ public class Cluster extends SubCommand {
|
|||||||
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
|
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
// return arguments
|
// return arguments
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_AVAILABLE_ARGS);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_AVAILABLE_ARGS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String sub = args[0].toLowerCase();
|
final String sub = args[0].toLowerCase();
|
||||||
@ -63,26 +63,26 @@ public class Cluster extends SubCommand {
|
|||||||
case "l":
|
case "l":
|
||||||
case "list": {
|
case "list": {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.list")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.list")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.list");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.list");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster list");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster list");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final HashSet<PlotCluster> clusters = ClusterManager.getClusters(plr.getWorld());
|
final HashSet<PlotCluster> clusters = ClusterManager.getClusters(plr.getWorld());
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_HEADING, clusters.size() + "");
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_HEADING, clusters.size() + "");
|
||||||
for (final PlotCluster cluster : clusters) {
|
for (final PlotCluster cluster : clusters) {
|
||||||
// Ignore unmanaged clusters
|
// Ignore unmanaged clusters
|
||||||
final String name = "'" + cluster.getName() + "' : " + cluster.toString();
|
final String name = "'" + cluster.getName() + "' : " + cluster.toString();
|
||||||
if (UUIDHandler.getUUID(plr).equals(cluster.owner)) {
|
if (UUIDHandler.getUUID(plr).equals(cluster.owner)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&a" + name);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&a" + name);
|
||||||
} else if (cluster.helpers.contains(UUIDHandler.getUUID(plr))) {
|
} else if (cluster.helpers.contains(UUIDHandler.getUUID(plr))) {
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&3" + name);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&3" + name);
|
||||||
} else if (cluster.invited.contains(UUIDHandler.getUUID(plr))) {
|
} else if (cluster.invited.contains(UUIDHandler.getUUID(plr))) {
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&9" + name);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&9" + name);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, cluster.toString());
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, cluster.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -90,27 +90,27 @@ public class Cluster extends SubCommand {
|
|||||||
case "c":
|
case "c":
|
||||||
case "create": {
|
case "create": {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.create")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.create")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.create");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.create");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 4) {
|
if (args.length != 4) {
|
||||||
final PlotId id = ClusterManager.estimatePlotId(plr.getLocation());
|
final PlotId id = ClusterManager.estimatePlotId(plr.getLocation());
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster create <name> <id-bot> <id-top>");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster create <name> <id-bot> <id-top>");
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_CURRENT_PLOTID, "" + id);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_CURRENT_PLOTID, "" + id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check pos1 / pos2
|
// check pos1 / pos2
|
||||||
final PlotId pos1 = MainUtil.parseId(args[2]);
|
final PlotId pos1 = MainUtil.parseId(args[2]);
|
||||||
final PlotId pos2 = MainUtil.parseId(args[3]);
|
final PlotId pos2 = MainUtil.parseId(args[3]);
|
||||||
if ((pos1 == null) || (pos2 == null)) {
|
if ((pos1 == null) || (pos2 == null)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check if name is taken
|
// check if name is taken
|
||||||
final String name = args[1];
|
final String name = args[1];
|
||||||
for (final PlotCluster cluster : ClusterManager.getClusters(plr.getWorld())) {
|
for (final PlotCluster cluster : ClusterManager.getClusters(plr.getWorld())) {
|
||||||
if (name.equals(cluster.getName())) {
|
if (name.equals(cluster.getName())) {
|
||||||
PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ public class Cluster extends SubCommand {
|
|||||||
final PlotClusterId id = new PlotClusterId(pos1, pos2);
|
final PlotClusterId id = new PlotClusterId(pos1, pos2);
|
||||||
final HashSet<PlotCluster> intersects = ClusterManager.getIntersects(plr.getWorld().getName(), id);
|
final HashSet<PlotCluster> intersects = ClusterManager.getIntersects(plr.getWorld().getName(), id);
|
||||||
if ((intersects.size() > 0) || (pos2.x < pos1.x) || (pos2.y < pos1.y)) {
|
if ((intersects.size() > 0) || (pos2.x < pos1.x) || (pos2.y < pos1.y)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_INTERSECTION, intersects.size() + "");
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_INTERSECTION, intersects.size() + "");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// create cluster
|
// create cluster
|
||||||
@ -142,37 +142,37 @@ public class Cluster extends SubCommand {
|
|||||||
PlotSquared.config.createSection("worlds." + world);
|
PlotSquared.config.createSection("worlds." + world);
|
||||||
PlotSquared.loadWorld(plr.getWorld());
|
PlotSquared.loadWorld(plr.getWorld());
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "disband":
|
case "disband":
|
||||||
case "del":
|
case "del":
|
||||||
case "delete": {
|
case "delete": {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.delete")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.delete")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((args.length != 1) && (args.length != 2)) {
|
if ((args.length != 1) && (args.length != 2)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster delete [name]");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster delete [name]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotCluster cluster;
|
PlotCluster cluster;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
|
cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cluster = ClusterManager.getCluster(plr.getLocation());
|
cluster = ClusterManager.getCluster(plr.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
|
if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.delete.other")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.delete.other")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete.other");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete.other");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,35 +205,35 @@ public class Cluster extends SubCommand {
|
|||||||
ClusterManager.last = null;
|
ClusterManager.last = null;
|
||||||
ClusterManager.clusters.get(cluster.world).remove(cluster);
|
ClusterManager.clusters.get(cluster.world).remove(cluster);
|
||||||
ClusterManager.regenCluster(cluster);
|
ClusterManager.regenCluster(cluster);
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_DELETED);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_DELETED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "res":
|
case "res":
|
||||||
case "resize": {
|
case "resize": {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.resize")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.resize")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 3) {
|
if (args.length != 3) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster resize <pos1> <pos2>");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster resize <pos1> <pos2>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check pos1 / pos2
|
// check pos1 / pos2
|
||||||
final PlotId pos1 = MainUtil.parseId(args[1]);
|
final PlotId pos1 = MainUtil.parseId(args[1]);
|
||||||
final PlotId pos2 = MainUtil.parseId(args[2]);
|
final PlotId pos2 = MainUtil.parseId(args[2]);
|
||||||
if ((pos1 == null) || (pos2 == null)) {
|
if ((pos1 == null) || (pos2 == null)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check if in cluster
|
// check if in cluster
|
||||||
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
|
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
|
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.resize.other")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.resize.other")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize.other");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize.other");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,76 +241,76 @@ public class Cluster extends SubCommand {
|
|||||||
final PlotClusterId id = new PlotClusterId(pos1, pos2);
|
final PlotClusterId id = new PlotClusterId(pos1, pos2);
|
||||||
final HashSet<PlotCluster> intersects = ClusterManager.getIntersects(plr.getWorld().getName(), id);
|
final HashSet<PlotCluster> intersects = ClusterManager.getIntersects(plr.getWorld().getName(), id);
|
||||||
if (intersects.size() > 1) {
|
if (intersects.size() > 1) {
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_INTERSECTION, (intersects.size() - 1) + "");
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_INTERSECTION, (intersects.size() - 1) + "");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// resize cluster
|
// resize cluster
|
||||||
DBFunc.resizeCluster(cluster, id);
|
DBFunc.resizeCluster(cluster, id);
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_RESIZED);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_RESIZED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "reg":
|
case "reg":
|
||||||
case "regenerate":
|
case "regenerate":
|
||||||
case "regen": {
|
case "regen": {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.delete")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.delete")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((args.length != 1) && (args.length != 2)) {
|
if ((args.length != 1) && (args.length != 2)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster regen [name]");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster regen [name]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotCluster cluster;
|
PlotCluster cluster;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
|
cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cluster = ClusterManager.getCluster(plr.getLocation());
|
cluster = ClusterManager.getCluster(plr.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
|
if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.regen.other")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.regen.other")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen.other");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen.other");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClusterManager.regenCluster(cluster);
|
ClusterManager.regenCluster(cluster);
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_REGENERATED);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_REGENERATED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "add":
|
case "add":
|
||||||
case "inv":
|
case "inv":
|
||||||
case "invite": {
|
case "invite": {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.invite")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.invite")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster invite <player>");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster invite <player>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check if in cluster
|
// check if in cluster
|
||||||
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
|
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
|
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.invite.other")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.invite.other")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite.other");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite.other");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check uuid
|
// check uuid
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasRights(uuid)) {
|
if (!cluster.hasRights(uuid)) {
|
||||||
@ -320,43 +320,43 @@ public class Cluster extends SubCommand {
|
|||||||
DBFunc.setInvited(world, cluster, uuid);
|
DBFunc.setInvited(world, cluster, uuid);
|
||||||
final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid);
|
final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
PlayerFunctions.sendMessage(player, C.CLUSTER_INVITED, cluster.getName());
|
BukkitPlayerFunctions.sendMessage(player, C.CLUSTER_INVITED, cluster.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED_USER);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED_USER);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "k":
|
case "k":
|
||||||
case "remove":
|
case "remove":
|
||||||
case "kick": {
|
case "kick": {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.kick")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.kick")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster kick <player>");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster kick <player>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
|
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
|
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.kick.other")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.kick.other")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick.other");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick.other");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check uuid
|
// check uuid
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Can't kick if the player is yourself, the owner, or not added to the cluster
|
// Can't kick if the player is yourself, the owner, or not added to the cluster
|
||||||
if (uuid.equals(UUIDHandler.getUUID(plr)) || uuid.equals(cluster.owner) || !cluster.hasRights(uuid)) {
|
if (uuid.equals(UUIDHandler.getUUID(plr)) || uuid.equals(cluster.owner) || !cluster.hasRights(uuid)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.CANNOT_KICK_PLAYER, cluster.getName());
|
BukkitPlayerFunctions.sendMessage(plr, C.CANNOT_KICK_PLAYER, cluster.getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (cluster.helpers.contains(uuid)) {
|
if (cluster.helpers.contains(uuid)) {
|
||||||
@ -367,7 +367,7 @@ public class Cluster extends SubCommand {
|
|||||||
DBFunc.removeInvited(cluster, uuid);
|
DBFunc.removeInvited(cluster, uuid);
|
||||||
final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid);
|
final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
PlayerFunctions.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
|
BukkitPlayerFunctions.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
|
||||||
}
|
}
|
||||||
for (final Plot plot : PlotSquared.getPlots(plr.getWorld(), uuid)) {
|
for (final Plot plot : PlotSquared.getPlots(plr.getWorld(), uuid)) {
|
||||||
final PlotCluster current = ClusterManager.getCluster(plot);
|
final PlotCluster current = ClusterManager.getCluster(plot);
|
||||||
@ -376,40 +376,40 @@ public class Cluster extends SubCommand {
|
|||||||
DBFunc.delete(world, plot);
|
DBFunc.delete(world, plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_KICKED_USER);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_KICKED_USER);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "quit":
|
case "quit":
|
||||||
case "leave": {
|
case "leave": {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.leave")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.leave")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.leave");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.leave");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((args.length != 1) && (args.length != 2)) {
|
if ((args.length != 1) && (args.length != 2)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster leave [name]");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster leave [name]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotCluster cluster;
|
PlotCluster cluster;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
|
cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cluster = ClusterManager.getCluster(plr.getLocation());
|
cluster = ClusterManager.getCluster(plr.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final UUID uuid = UUIDHandler.getUUID(plr);
|
final UUID uuid = UUIDHandler.getUUID(plr);
|
||||||
if (!cluster.hasRights(uuid)) {
|
if (!cluster.hasRights(uuid)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_NOT_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_NOT_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (uuid.equals(cluster.owner)) {
|
if (uuid.equals(cluster.owner)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_CANNOT_LEAVE);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_CANNOT_LEAVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (cluster.helpers.contains(uuid)) {
|
if (cluster.helpers.contains(uuid)) {
|
||||||
@ -418,7 +418,7 @@ public class Cluster extends SubCommand {
|
|||||||
}
|
}
|
||||||
cluster.invited.remove(uuid);
|
cluster.invited.remove(uuid);
|
||||||
DBFunc.removeInvited(cluster, uuid);
|
DBFunc.removeInvited(cluster, uuid);
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_REMOVED, cluster.getName());
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_REMOVED, cluster.getName());
|
||||||
for (final Plot plot : PlotSquared.getPlots(plr.getWorld(), uuid)) {
|
for (final Plot plot : PlotSquared.getPlots(plr.getWorld(), uuid)) {
|
||||||
final PlotCluster current = ClusterManager.getCluster(plot);
|
final PlotCluster current = ClusterManager.getCluster(plot);
|
||||||
if ((current != null) && current.equals(cluster)) {
|
if ((current != null) && current.equals(cluster)) {
|
||||||
@ -432,83 +432,83 @@ public class Cluster extends SubCommand {
|
|||||||
case "helper":
|
case "helper":
|
||||||
case "helpers": {
|
case "helpers": {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.helpers")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.helpers")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.helpers");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.helpers");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 3) {
|
if (args.length != 3) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers <add|remove> <player>");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers <add|remove> <player>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
|
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[2]);
|
final UUID uuid = UUIDHandler.getUUID(args[2]);
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args[1].toLowerCase().equals("add")) {
|
if (args[1].toLowerCase().equals("add")) {
|
||||||
cluster.helpers.add(uuid);
|
cluster.helpers.add(uuid);
|
||||||
return PlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED_HELPER);
|
return BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED_HELPER);
|
||||||
}
|
}
|
||||||
if (args[1].toLowerCase().equals("remove")) {
|
if (args[1].toLowerCase().equals("remove")) {
|
||||||
cluster.helpers.remove(uuid);
|
cluster.helpers.remove(uuid);
|
||||||
return PlayerFunctions.sendMessage(plr, C.CLUSTER_REMOVED_HELPER);
|
return BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_REMOVED_HELPER);
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers <add|remove> <player>");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers <add|remove> <player>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case "spawn":
|
case "spawn":
|
||||||
case "home":
|
case "home":
|
||||||
case "tp": {
|
case "tp": {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.tp")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.tp")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster tp <name>");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster tp <name>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotCluster cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
|
final PlotCluster cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final UUID uuid = UUIDHandler.getUUID(plr);
|
final UUID uuid = UUIDHandler.getUUID(plr);
|
||||||
if (!cluster.hasRights(uuid)) {
|
if (!cluster.hasRights(uuid)) {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.tp.other")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.tp.other")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp.other");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp.other");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plr.teleport(ClusterManager.getHome(cluster));
|
plr.teleport(ClusterManager.getHome(cluster));
|
||||||
return PlayerFunctions.sendMessage(plr, C.CLUSTER_TELEPORTING);
|
return BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_TELEPORTING);
|
||||||
}
|
}
|
||||||
case "i":
|
case "i":
|
||||||
case "info":
|
case "info":
|
||||||
case "show":
|
case "show":
|
||||||
case "information": {
|
case "information": {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.info")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.info")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.info");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.info");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((args.length != 1) && (args.length != 2)) {
|
if ((args.length != 1) && (args.length != 2)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster info [name]");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster info [name]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotCluster cluster;
|
PlotCluster cluster;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
|
cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]);
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cluster = ClusterManager.getCluster(plr.getLocation());
|
cluster = ClusterManager.getCluster(plr.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -526,28 +526,28 @@ public class Cluster extends SubCommand {
|
|||||||
message = message.replaceAll("%name%", name);
|
message = message.replaceAll("%name%", name);
|
||||||
message = message.replaceAll("%size%", size);
|
message = message.replaceAll("%size%", size);
|
||||||
message = message.replaceAll("%rights%", rights);
|
message = message.replaceAll("%rights%", rights);
|
||||||
PlayerFunctions.sendMessage(plr, message);
|
BukkitPlayerFunctions.sendMessage(plr, message);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "sh":
|
case "sh":
|
||||||
case "setspawn":
|
case "setspawn":
|
||||||
case "sethome": {
|
case "sethome": {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.sethome")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.sethome")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((args.length != 1) && (args.length != 2)) {
|
if ((args.length != 1) && (args.length != 2)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster sethome");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster sethome");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
|
final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
|
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.cluster.sethome.other")) {
|
if (!BukkitMain.hasPermission(plr, "plots.cluster.sethome.other")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome.other");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome.other");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -557,10 +557,10 @@ public class Cluster extends SubCommand {
|
|||||||
final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
|
final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
|
||||||
cluster.settings.setPosition(blockloc);
|
cluster.settings.setPosition(blockloc);
|
||||||
DBFunc.setPosition(cluster, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ());
|
DBFunc.setPosition(cluster, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ());
|
||||||
return PlayerFunctions.sendMessage(plr, C.POSITION_SET);
|
return BukkitPlayerFunctions.sendMessage(plr, C.POSITION_SET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.CLUSTER_AVAILABLE_ARGS);
|
BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_AVAILABLE_ARGS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotComment;
|
import com.intellectualcrafters.plot.object.PlotComment;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class Comment extends SubCommand {
|
public class Comment extends SubCommand {
|
||||||
public Comment() {
|
public Comment() {
|
||||||
@ -40,10 +40,10 @@ public class Comment extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class Condense extends SubCommand {
|
public class Condense extends SubCommand {
|
||||||
public static boolean TASK = false;
|
public static boolean TASK = false;
|
||||||
@ -48,35 +48,35 @@ public class Condense extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (plr != null) {
|
if (plr != null) {
|
||||||
PlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE));
|
BukkitPlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((args.length != 2) && (args.length != 3)) {
|
if ((args.length != 2) && (args.length != 3)) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot condense <world> <start|stop|info> [radius]");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot condense <world> <start|stop|info> [radius]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String worldname = args[0];
|
final String worldname = args[0];
|
||||||
final World world = Bukkit.getWorld(worldname);
|
final World world = Bukkit.getWorld(worldname);
|
||||||
if ((world == null) || !PlotSquared.isPlotWorld(worldname)) {
|
if ((world == null) || !PlotSquared.isPlotWorld(worldname)) {
|
||||||
PlayerFunctions.sendMessage(plr, "INVALID WORLD");
|
BukkitPlayerFunctions.sendMessage(plr, "INVALID WORLD");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (args[1].toLowerCase()) {
|
switch (args[1].toLowerCase()) {
|
||||||
case "start": {
|
case "start": {
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " start <radius>");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " start <radius>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (TASK) {
|
if (TASK) {
|
||||||
PlayerFunctions.sendMessage(plr, "TASK ALREADY STARTED");
|
BukkitPlayerFunctions.sendMessage(plr, "TASK ALREADY STARTED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " start <radius>");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " start <radius>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!StringUtils.isNumeric(args[2])) {
|
if (!StringUtils.isNumeric(args[2])) {
|
||||||
PlayerFunctions.sendMessage(plr, "INVALID RADIUS");
|
BukkitPlayerFunctions.sendMessage(plr, "INVALID RADIUS");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int radius = Integer.parseInt(args[2]);
|
final int radius = Integer.parseInt(args[2]);
|
||||||
@ -84,7 +84,7 @@ public class Condense extends SubCommand {
|
|||||||
final int size = plots.size();
|
final int size = plots.size();
|
||||||
final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1);
|
final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1);
|
||||||
if (radius < minimum_radius) {
|
if (radius < minimum_radius) {
|
||||||
PlayerFunctions.sendMessage(plr, "RADIUS TOO SMALL");
|
BukkitPlayerFunctions.sendMessage(plr, "RADIUS TOO SMALL");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final List<PlotId> to_move = new ArrayList<>(getPlots(plots, radius));
|
final List<PlotId> to_move = new ArrayList<>(getPlots(plots, radius));
|
||||||
@ -143,25 +143,25 @@ public class Condense extends SubCommand {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
TASK = true;
|
TASK = true;
|
||||||
PlayerFunctions.sendMessage(plr, "TASK STARTED...");
|
BukkitPlayerFunctions.sendMessage(plr, "TASK STARTED...");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "stop": {
|
case "stop": {
|
||||||
if (!TASK) {
|
if (!TASK) {
|
||||||
PlayerFunctions.sendMessage(plr, "TASK ALREADY STOPPED");
|
BukkitPlayerFunctions.sendMessage(plr, "TASK ALREADY STOPPED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TASK = false;
|
TASK = false;
|
||||||
PlayerFunctions.sendMessage(plr, "TASK STOPPED");
|
BukkitPlayerFunctions.sendMessage(plr, "TASK STOPPED");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "info": {
|
case "info": {
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " info <radius>");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " info <radius>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!StringUtils.isNumeric(args[2])) {
|
if (!StringUtils.isNumeric(args[2])) {
|
||||||
PlayerFunctions.sendMessage(plr, "INVALID RADIUS");
|
BukkitPlayerFunctions.sendMessage(plr, "INVALID RADIUS");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int radius = Integer.parseInt(args[2]);
|
final int radius = Integer.parseInt(args[2]);
|
||||||
@ -169,23 +169,23 @@ public class Condense extends SubCommand {
|
|||||||
final int size = plots.size();
|
final int size = plots.size();
|
||||||
final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1);
|
final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1);
|
||||||
if (radius < minimum_radius) {
|
if (radius < minimum_radius) {
|
||||||
PlayerFunctions.sendMessage(plr, "RADIUS TOO SMALL");
|
BukkitPlayerFunctions.sendMessage(plr, "RADIUS TOO SMALL");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int max_move = getPlots(plots, minimum_radius).size();
|
final int max_move = getPlots(plots, minimum_radius).size();
|
||||||
final int user_move = getPlots(plots, radius).size();
|
final int user_move = getPlots(plots, radius).size();
|
||||||
PlayerFunctions.sendMessage(plr, "=== DEFAULT EVAL ===");
|
BukkitPlayerFunctions.sendMessage(plr, "=== DEFAULT EVAL ===");
|
||||||
PlayerFunctions.sendMessage(plr, "MINIMUM RADIUS: " + minimum_radius);
|
BukkitPlayerFunctions.sendMessage(plr, "MINIMUM RADIUS: " + minimum_radius);
|
||||||
PlayerFunctions.sendMessage(plr, "MAXIMUM MOVES: " + max_move);
|
BukkitPlayerFunctions.sendMessage(plr, "MAXIMUM MOVES: " + max_move);
|
||||||
PlayerFunctions.sendMessage(plr, "=== INPUT EVAL ===");
|
BukkitPlayerFunctions.sendMessage(plr, "=== INPUT EVAL ===");
|
||||||
PlayerFunctions.sendMessage(plr, "INPUT RADIUS: " + radius);
|
BukkitPlayerFunctions.sendMessage(plr, "INPUT RADIUS: " + radius);
|
||||||
PlayerFunctions.sendMessage(plr, "ESTIMATED MOVES: " + user_move);
|
BukkitPlayerFunctions.sendMessage(plr, "ESTIMATED MOVES: " + user_move);
|
||||||
PlayerFunctions.sendMessage(plr, "ESTIMATED TIME: " + "No idea, times will drastically change based on the system performance and load");
|
BukkitPlayerFunctions.sendMessage(plr, "ESTIMATED TIME: " + "No idea, times will drastically change based on the system performance and load");
|
||||||
PlayerFunctions.sendMessage(plr, "&e - Radius is measured in plot width");
|
BukkitPlayerFunctions.sendMessage(plr, "&e - Radius is measured in plot width");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " <start|stop|info> [radius]");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " <start|stop|info> [radius]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import com.intellectualcrafters.plot.BukkitMain;
|
|||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class Copy extends SubCommand {
|
public class Copy extends SubCommand {
|
||||||
@ -36,18 +36,18 @@ public class Copy extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.copy")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.copy")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
if (plot.settings.isMerged()) {
|
if (plot.settings.isMerged()) {
|
||||||
PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
|
BukkitPlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int size = (MainUtil.getPlotTopLocAbs(plr.getWorld(), plot.getId()).getBlockX() - MainUtil.getPlotBottomLocAbs(plr.getWorld(), plot.getId()).getBlockX());
|
final int size = (MainUtil.getPlotTopLocAbs(plr.getWorld(), plot.getId()).getBlockX() - MainUtil.getPlotBottomLocAbs(plr.getWorld(), plot.getId()).getBlockX());
|
||||||
|
@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.generator.HybridPlotManager;
|
|||||||
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class CreateRoadSchematic extends SubCommand {
|
public class CreateRoadSchematic extends SubCommand {
|
||||||
public CreateRoadSchematic() {
|
public CreateRoadSchematic() {
|
||||||
@ -37,18 +37,18 @@ public class CreateRoadSchematic extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player player, final String... args) {
|
public boolean execute(final Player player, final String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(player)) {
|
if (!BukkitPlayerFunctions.isInPlot(player)) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(PlotSquared.getPlotWorld(player.getWorld()) instanceof HybridPlotWorld)) {
|
if (!(PlotSquared.getPlotWorld(player.getWorld()) instanceof HybridPlotWorld)) {
|
||||||
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(player);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(player);
|
||||||
final HybridPlotManager manager = (HybridPlotManager) PlotSquared.getPlotManager(player.getWorld());
|
final HybridPlotManager manager = (HybridPlotManager) PlotSquared.getPlotManager(player.getWorld());
|
||||||
manager.setupRoadSchematic(plot);
|
manager.setupRoadSchematic(plot);
|
||||||
MainUtil.update(BukkitUtil.getLocation(entity));
|
MainUtil.update(BukkitUtil.getLocation(entity));
|
||||||
PlayerFunctions.sendMessage(player, "&6Saved new road schematic");
|
BukkitPlayerFunctions.sendMessage(player, "&6Saved new road schematic");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created 2014-11-09 for PlotSquared
|
* Created 2014-11-09 for PlotSquared
|
||||||
@ -19,12 +19,12 @@ public class DEOP extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
return PlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage);
|
return BukkitPlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage);
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (!plot.hasRights(plr)) {
|
if (!plot.hasRights(plr)) {
|
||||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import com.intellectualcrafters.plot.database.SQLManager;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.StringComparison;
|
import com.intellectualcrafters.plot.util.StringComparison;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,7 +36,7 @@ public class Database extends SubCommand {
|
|||||||
} else {
|
} else {
|
||||||
final Player p = UUIDHandler.uuidWrapper.getPlayer(uuid);
|
final Player p = UUIDHandler.uuidWrapper.getPlayer(uuid);
|
||||||
if ((p != null) && p.isOnline()) {
|
if ((p != null) && p.isOnline()) {
|
||||||
return PlayerFunctions.sendMessage(p, msg);
|
return BukkitPlayerFunctions.sendMessage(p, msg);
|
||||||
} else {
|
} else {
|
||||||
return sendMessageU(null, msg);
|
return sendMessageU(null, msg);
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ public class Database extends SubCommand {
|
|||||||
if (player == null) {
|
if (player == null) {
|
||||||
PlotSquared.log(msg);
|
PlotSquared.log(msg);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(player, msg);
|
BukkitPlayerFunctions.sendMessage(player, msg);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.util.Lag;
|
import com.intellectualcrafters.plot.util.Lag;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.RUtils;
|
import com.intellectualcrafters.plot.util.RUtils;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class Debug extends SubCommand {
|
public class Debug extends SubCommand {
|
||||||
public Debug() {
|
public Debug() {
|
||||||
@ -43,7 +43,7 @@ public class Debug extends SubCommand {
|
|||||||
for (final C c : C.values()) {
|
for (final C c : C.values()) {
|
||||||
msg.append(c.s()).append("\n");
|
msg.append(c.s()).append("\n");
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, msg.toString());
|
BukkitPlayerFunctions.sendMessage(plr, msg.toString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
StringBuilder information;
|
StringBuilder information;
|
||||||
@ -84,7 +84,7 @@ public class Debug extends SubCommand {
|
|||||||
information.append(getLine(line, "View all captions", "/plot debug msg"));
|
information.append(getLine(line, "View all captions", "/plot debug msg"));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
PlayerFunctions.sendMessage(plr, information.toString());
|
BukkitPlayerFunctions.sendMessage(plr, information.toString());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ import com.intellectualcrafters.plot.object.PlotManager;
|
|||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,7 +64,7 @@ public class DebugClaimTest extends SubCommand {
|
|||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
MainUtil.createPlot(player, plot);
|
MainUtil.createPlot(player, plot);
|
||||||
MainUtil.setSign(player, plot);
|
MainUtil.setSign(player, plot);
|
||||||
PlayerFunctions.sendMessage(player, C.CLAIMED);
|
BukkitPlayerFunctions.sendMessage(player, C.CLAIMED);
|
||||||
if (teleport) {
|
if (teleport) {
|
||||||
PlotSquared.teleportPlayer(player, BukkitUtil.getLocation(entity), plot);
|
PlotSquared.teleportPlayer(player, BukkitUtil.getLocation(entity), plot);
|
||||||
}
|
}
|
||||||
@ -76,11 +76,11 @@ public class DebugClaimTest extends SubCommand {
|
|||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
return !PlayerFunctions.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 !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}");
|
||||||
}
|
}
|
||||||
final World world = Bukkit.getWorld(args[0]);
|
final World world = Bukkit.getWorld(args[0]);
|
||||||
if ((world == null) || !PlotSquared.isPlotWorld(world)) {
|
if ((world == null) || !PlotSquared.isPlotWorld(world)) {
|
||||||
return !PlayerFunctions.sendMessage(null, "&cInvalid plot world!");
|
return !BukkitPlayerFunctions.sendMessage(null, "&cInvalid plot world!");
|
||||||
}
|
}
|
||||||
PlotId min, max;
|
PlotId min, max;
|
||||||
try {
|
try {
|
||||||
@ -89,18 +89,18 @@ public class DebugClaimTest extends SubCommand {
|
|||||||
min = new PlotId(Integer.parseInt(split1[0]), Integer.parseInt(split1[1]));
|
min = new PlotId(Integer.parseInt(split1[0]), Integer.parseInt(split1[1]));
|
||||||
max = new PlotId(Integer.parseInt(split2[0]), Integer.parseInt(split2[1]));
|
max = new PlotId(Integer.parseInt(split2[0]), Integer.parseInt(split2[1]));
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
return !PlayerFunctions.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 !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.");
|
||||||
}
|
}
|
||||||
PlayerFunctions.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: &7Beginning sign to plot conversion. This may take a while...");
|
||||||
PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)");
|
BukkitPlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)");
|
||||||
final PlotManager manager = PlotSquared.getPlotManager(world);
|
final PlotManager manager = PlotSquared.getPlotManager(world);
|
||||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||||
final ArrayList<Plot> plots = new ArrayList<>();
|
final ArrayList<Plot> plots = new ArrayList<>();
|
||||||
for (final PlotId id : PlayerFunctions.getPlotSelectionIds(min, max)) {
|
for (final PlotId id : BukkitPlayerFunctions.getPlotSelectionIds(min, max)) {
|
||||||
final Plot plot = MainUtil.getPlot(world, id);
|
final Plot plot = MainUtil.getPlot(world, id);
|
||||||
final boolean contains = PlotSquared.getPlots(world).containsKey(plot.id);
|
final boolean contains = PlotSquared.getPlots(world).containsKey(plot.id);
|
||||||
if (contains) {
|
if (contains) {
|
||||||
PlayerFunctions.sendMessage(null, " - &cDB Already contains: " + plot.id);
|
BukkitPlayerFunctions.sendMessage(null, " - &cDB Already contains: " + plot.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final Location loc = manager.getSignLoc(world, plotworld, plot);
|
final Location loc = manager.getSignLoc(world, plotworld, plot);
|
||||||
@ -132,30 +132,30 @@ public class DebugClaimTest extends SubCommand {
|
|||||||
uuid = UUIDHandler.getUUID(line);
|
uuid = UUIDHandler.getUUID(line);
|
||||||
}
|
}
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
PlayerFunctions.sendMessage(null, " - &aFound plot: " + plot.id + " : " + line);
|
BukkitPlayerFunctions.sendMessage(null, " - &aFound plot: " + plot.id + " : " + line);
|
||||||
plot.owner = uuid;
|
plot.owner = uuid;
|
||||||
plot.hasChanged = true;
|
plot.hasChanged = true;
|
||||||
plots.add(plot);
|
plots.add(plot);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(null, " - &cInvalid playername: " + plot.id + " : " + line);
|
BukkitPlayerFunctions.sendMessage(null, " - &cInvalid playername: " + plot.id + " : " + line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (plots.size() > 0) {
|
if (plots.size() > 0) {
|
||||||
PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Updating '" + plots.size() + "' plots!");
|
BukkitPlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Updating '" + plots.size() + "' plots!");
|
||||||
DBFunc.createPlots(plots);
|
DBFunc.createPlots(plots);
|
||||||
DBFunc.createAllSettingsAndHelpers(plots);
|
DBFunc.createAllSettingsAndHelpers(plots);
|
||||||
for (final Plot plot : plots) {
|
for (final Plot plot : plots) {
|
||||||
PlotSquared.updatePlot(plot);
|
PlotSquared.updatePlot(plot);
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Complete!");
|
BukkitPlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Complete!");
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(null, "No plots were found for the given search.");
|
BukkitPlayerFunctions.sendMessage(null, "No plots were found for the given search.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, "&6This command can only be executed by console as it has been deemed unsafe if abused.");
|
BukkitPlayerFunctions.sendMessage(plr, "&6This command can only be executed by console as it has been deemed unsafe if abused.");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.ChunkManager;
|
import com.intellectualcrafters.plot.util.bukkit.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class DebugClear extends SubCommand {
|
public class DebugClear extends SubCommand {
|
||||||
@ -64,7 +64,7 @@ public class DebugClear extends SubCommand {
|
|||||||
final Location pos1 = MainUtil.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1);
|
final Location pos1 = MainUtil.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1);
|
||||||
final Location pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id);
|
final Location pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id);
|
||||||
if (MainUtil.runners.containsKey(plot)) {
|
if (MainUtil.runners.containsKey(plot)) {
|
||||||
PlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER);
|
BukkitPlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.runners.put(plot, 1);
|
MainUtil.runners.put(plot, 1);
|
||||||
@ -82,11 +82,11 @@ public class DebugClear extends SubCommand {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr) || !(PlotSquared.getPlotWorld(plr.getWorld()) instanceof SquarePlotWorld)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr) || !(PlotSquared.getPlotWorld(plr.getWorld()) instanceof SquarePlotWorld)) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
||||||
return sendMessage(plr, C.UNLINK_REQUIRED);
|
return sendMessage(plr, C.UNLINK_REQUIRED);
|
||||||
}
|
}
|
||||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.debugclear")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.debugclear")) {
|
||||||
@ -97,7 +97,7 @@ public class DebugClear extends SubCommand {
|
|||||||
final Location pos1 = MainUtil.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1);
|
final Location pos1 = MainUtil.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1);
|
||||||
final Location pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id);
|
final Location pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id);
|
||||||
if (MainUtil.runners.containsKey(plot)) {
|
if (MainUtil.runners.containsKey(plot)) {
|
||||||
PlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER);
|
BukkitPlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.runners.put(plot, 1);
|
MainUtil.runners.put(plot, 1);
|
||||||
@ -105,7 +105,7 @@ public class DebugClear extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainUtil.runners.remove(plot);
|
MainUtil.runners.remove(plot);
|
||||||
PlayerFunctions.sendMessage(plr, "&aDone!");
|
BukkitPlayerFunctions.sendMessage(plr, "&aDone!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// sign
|
// sign
|
||||||
|
@ -41,7 +41,7 @@ import com.intellectualcrafters.plot.PlotSquared;
|
|||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class DebugExec extends SubCommand {
|
public class DebugExec extends SubCommand {
|
||||||
@ -59,77 +59,77 @@ public class DebugExec extends SubCommand {
|
|||||||
if (ExpireManager.task != -1) {
|
if (ExpireManager.task != -1) {
|
||||||
Bukkit.getScheduler().cancelTask(ExpireManager.task);
|
Bukkit.getScheduler().cancelTask(ExpireManager.task);
|
||||||
} else {
|
} else {
|
||||||
return PlayerFunctions.sendMessage(null, "Task already halted");
|
return BukkitPlayerFunctions.sendMessage(null, "Task already halted");
|
||||||
}
|
}
|
||||||
ExpireManager.task = -1;
|
ExpireManager.task = -1;
|
||||||
return PlayerFunctions.sendMessage(null, "Cancelled task.");
|
return BukkitPlayerFunctions.sendMessage(null, "Cancelled task.");
|
||||||
}
|
}
|
||||||
case "start-expire": {
|
case "start-expire": {
|
||||||
if (ExpireManager.task == -1) {
|
if (ExpireManager.task == -1) {
|
||||||
ExpireManager.runTask();
|
ExpireManager.runTask();
|
||||||
} else {
|
} else {
|
||||||
return PlayerFunctions.sendMessage(null, "Plot expiry task already started");
|
return BukkitPlayerFunctions.sendMessage(null, "Plot expiry task already started");
|
||||||
}
|
}
|
||||||
return PlayerFunctions.sendMessage(null, "Started plot expiry task");
|
return BukkitPlayerFunctions.sendMessage(null, "Started plot expiry task");
|
||||||
}
|
}
|
||||||
case "update-expired": {
|
case "update-expired": {
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
final World world = Bukkit.getWorld(args[1]);
|
final World world = Bukkit.getWorld(args[1]);
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
return PlayerFunctions.sendMessage(null, "Invalid world: " + args[1]);
|
return BukkitPlayerFunctions.sendMessage(null, "Invalid world: " + args[1]);
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(null, "Updating expired plot list");
|
BukkitPlayerFunctions.sendMessage(null, "Updating expired plot list");
|
||||||
ExpireManager.updateExpired(args[1]);
|
ExpireManager.updateExpired(args[1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return PlayerFunctions.sendMessage(null, "Use /plot debugexec update-expired <world>");
|
return BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec update-expired <world>");
|
||||||
}
|
}
|
||||||
case "show-expired": {
|
case "show-expired": {
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
final World world = Bukkit.getWorld(args[1]);
|
final World world = Bukkit.getWorld(args[1]);
|
||||||
if ((world == null) || !ExpireManager.expiredPlots.containsKey(args[1])) {
|
if ((world == null) || !ExpireManager.expiredPlots.containsKey(args[1])) {
|
||||||
return PlayerFunctions.sendMessage(null, "Invalid world: " + args[1]);
|
return BukkitPlayerFunctions.sendMessage(null, "Invalid world: " + args[1]);
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(null, "Expired plots (" + ExpireManager.expiredPlots.get(args[1]).size() + "):");
|
BukkitPlayerFunctions.sendMessage(null, "Expired plots (" + ExpireManager.expiredPlots.get(args[1]).size() + "):");
|
||||||
for (final Entry<Plot, Long> entry : ExpireManager.expiredPlots.get(args[1]).entrySet()) {
|
for (final Entry<Plot, Long> entry : ExpireManager.expiredPlots.get(args[1]).entrySet()) {
|
||||||
final Plot plot = entry.getKey();
|
final Plot plot = entry.getKey();
|
||||||
final Long stamp = entry.getValue();
|
final Long stamp = entry.getValue();
|
||||||
PlayerFunctions.sendMessage(null, " - " + plot.world + ";" + plot.id.x + ";" + plot.id.y + ";" + UUIDHandler.getName(plot.owner) + " : " + stamp);
|
BukkitPlayerFunctions.sendMessage(null, " - " + plot.world + ";" + plot.id.x + ";" + plot.id.y + ";" + UUIDHandler.getName(plot.owner) + " : " + stamp);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return PlayerFunctions.sendMessage(null, "Use /plot debugexec show-expired <world>");
|
return BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec show-expired <world>");
|
||||||
}
|
}
|
||||||
case "seen": {
|
case "seen": {
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
return PlayerFunctions.sendMessage(null, "Use /plot debugexec seen <player>");
|
return BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec seen <player>");
|
||||||
}
|
}
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
return PlayerFunctions.sendMessage(null, "player not found: " + args[1]);
|
return BukkitPlayerFunctions.sendMessage(null, "player not found: " + args[1]);
|
||||||
}
|
}
|
||||||
final OfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
final OfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
||||||
if ((op == null) || !op.hasPlayedBefore()) {
|
if ((op == null) || !op.hasPlayedBefore()) {
|
||||||
return PlayerFunctions.sendMessage(null, "player hasn't connected before: " + args[1]);
|
return BukkitPlayerFunctions.sendMessage(null, "player hasn't connected before: " + args[1]);
|
||||||
}
|
}
|
||||||
final Timestamp stamp = new Timestamp(op.getLastPlayed());
|
final Timestamp stamp = new Timestamp(op.getLastPlayed());
|
||||||
final Date date = new Date(stamp.getTime());
|
final Date date = new Date(stamp.getTime());
|
||||||
PlayerFunctions.sendMessage(null, "PLAYER: " + args[1]);
|
BukkitPlayerFunctions.sendMessage(null, "PLAYER: " + args[1]);
|
||||||
PlayerFunctions.sendMessage(null, "UUID: " + uuid);
|
BukkitPlayerFunctions.sendMessage(null, "UUID: " + uuid);
|
||||||
PlayerFunctions.sendMessage(null, "Object: " + date.toGMTString());
|
BukkitPlayerFunctions.sendMessage(null, "Object: " + date.toGMTString());
|
||||||
PlayerFunctions.sendMessage(null, "GMT: " + date.toGMTString());
|
BukkitPlayerFunctions.sendMessage(null, "GMT: " + date.toGMTString());
|
||||||
PlayerFunctions.sendMessage(null, "Local: " + date.toLocaleString());
|
BukkitPlayerFunctions.sendMessage(null, "Local: " + date.toLocaleString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "trim-check": {
|
case "trim-check": {
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
PlayerFunctions.sendMessage(null, "Use /plot debugexec trim-check <world>");
|
BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec trim-check <world>");
|
||||||
PlayerFunctions.sendMessage(null, "&7 - Generates a list of regions to trim");
|
BukkitPlayerFunctions.sendMessage(null, "&7 - Generates a list of regions to trim");
|
||||||
return PlayerFunctions.sendMessage(null, "&7 - Run after plot expiry has run");
|
return BukkitPlayerFunctions.sendMessage(null, "&7 - Run after plot expiry has run");
|
||||||
}
|
}
|
||||||
final World world = Bukkit.getWorld(args[1]);
|
final World world = Bukkit.getWorld(args[1]);
|
||||||
if ((world == null) || !PlotSquared.isPlotWorld(args[1])) {
|
if ((world == null) || !PlotSquared.isPlotWorld(args[1])) {
|
||||||
return PlayerFunctions.sendMessage(null, "Invalid world: " + args[1]);
|
return BukkitPlayerFunctions.sendMessage(null, "Invalid world: " + args[1]);
|
||||||
}
|
}
|
||||||
final ArrayList<ChunkLoc> empty = new ArrayList<>();
|
final ArrayList<ChunkLoc> empty = new ArrayList<>();
|
||||||
final boolean result = Trim.getTrimRegions(empty, world, new Runnable() {
|
final boolean result = Trim.getTrimRegions(empty, world, new Runnable() {
|
||||||
@ -160,13 +160,13 @@ public class DebugExec extends SubCommand {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!result) {
|
if (!result) {
|
||||||
PlayerFunctions.sendMessage(null, "Trim task already started!");
|
BukkitPlayerFunctions.sendMessage(null, "Trim task already started!");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(player, "Possible sub commands: /plot debugexec <" + StringUtils.join(allowed_params, "|") + ">");
|
BukkitPlayerFunctions.sendMessage(player, "Possible sub commands: /plot debugexec <" + StringUtils.join(allowed_params, "|") + ">");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.flag.AbstractFlag;
|
|||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class DebugFixFlags extends SubCommand {
|
public class DebugFixFlags extends SubCommand {
|
||||||
public DebugFixFlags() {
|
public DebugFixFlags() {
|
||||||
@ -44,19 +44,19 @@ public class DebugFixFlags extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (plr != null) {
|
if (plr != null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_CONSOLE);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_CONSOLE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot debugfixflags <world>");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot debugfixflags <world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final World world = Bukkit.getWorld(args[0]);
|
final World world = Bukkit.getWorld(args[0]);
|
||||||
if ((world == null) || !PlotSquared.isPlotWorld(world)) {
|
if ((world == null) || !PlotSquared.isPlotWorld(world)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, "&8--- &6Starting task &8 ---");
|
BukkitPlayerFunctions.sendMessage(plr, "&8--- &6Starting task &8 ---");
|
||||||
for (final Plot plot : PlotSquared.getPlots(world).values()) {
|
for (final Plot plot : PlotSquared.getPlots(world).values()) {
|
||||||
final Set<Flag> flags = plot.settings.flags;
|
final Set<Flag> flags = plot.settings.flags;
|
||||||
final ArrayList<Flag> toRemove = new ArrayList<Flag>();
|
final ArrayList<Flag> toRemove = new ArrayList<Flag>();
|
||||||
@ -73,7 +73,7 @@ public class DebugFixFlags extends SubCommand {
|
|||||||
DBFunc.setFlags(plot.world, plot, plot.settings.flags);
|
DBFunc.setFlags(plot.world, plot, plot.settings.flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, "&aDone!");
|
BukkitPlayerFunctions.sendMessage(plr, "&aDone!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
@ -49,7 +49,7 @@ public class DebugLoadTest extends SubCommand {
|
|||||||
PlotSquared.log("&3===END OF STACKTRACE===");
|
PlotSquared.log("&3===END OF STACKTRACE===");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, "&6This command can only be executed by console as it has been deemed unsafe if abused..");
|
BukkitPlayerFunctions.sendMessage(plr, "&6This command can only be executed by console as it has been deemed unsafe if abused..");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.PlotSquared;
|
|||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.generator.HybridPlotManager;
|
import com.intellectualcrafters.plot.generator.HybridPlotManager;
|
||||||
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.SetBlockManager;
|
import com.intellectualcrafters.plot.util.bukkit.SetBlockManager;
|
||||||
|
|
||||||
public class DebugRoadRegen extends SubCommand {
|
public class DebugRoadRegen extends SubCommand {
|
||||||
@ -48,7 +48,7 @@ public class DebugRoadRegen extends SubCommand {
|
|||||||
if (result) {
|
if (result) {
|
||||||
SetBlockManager.setBlockManager.update(Arrays.asList(new Chunk[] { chunk }));
|
SetBlockManager.setBlockManager.update(Arrays.asList(new Chunk[] { chunk }));
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(player, "&6Regenerating chunk: " + chunk.getX() + "," + chunk.getZ() + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed"));
|
BukkitPlayerFunctions.sendMessage(player, "&6Regenerating chunk: " + chunk.getX() + "," + chunk.getZ() + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
@ -45,7 +45,7 @@ public class DebugSaveTest extends SubCommand {
|
|||||||
DBFunc.createPlots(plots);
|
DBFunc.createPlots(plots);
|
||||||
DBFunc.createAllSettingsAndHelpers(plots);
|
DBFunc.createAllSettingsAndHelpers(plots);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, "This debug command can only be executed by console as it has been deemed unsafe if abused");
|
BukkitPlayerFunctions.sendMessage(plr, "This debug command can only be executed by console as it has been deemed unsafe if abused");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class Delete extends SubCommand {
|
public class Delete extends SubCommand {
|
||||||
@ -40,11 +40,11 @@ public class Delete extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
||||||
return !sendMessage(plr, C.UNLINK_REQUIRED);
|
return !sendMessage(plr, C.UNLINK_REQUIRED);
|
||||||
}
|
}
|
||||||
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.uuidWrapper.getUUID(plr)))) && !BukkitMain.hasPermission(plr, "plots.admin.command.delete")) {
|
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.uuidWrapper.getUUID(plr)))) && !BukkitMain.hasPermission(plr, "plots.admin.command.delete")) {
|
||||||
@ -65,7 +65,7 @@ public class Delete extends SubCommand {
|
|||||||
plot.clear(plr, true);
|
plot.clear(plr, true);
|
||||||
DBFunc.delete(plr.getWorld().getName(), plot);
|
DBFunc.delete(plr.getWorld().getName(), plot);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, "Plot deletion has been denied.");
|
BukkitPlayerFunctions.sendMessage(plr, "Plot deletion has been denied.");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
|
import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -42,20 +42,20 @@ public class Denied extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
|
BukkitPlayerFunctions.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
|
BukkitPlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !BukkitMain.hasPermission(plr, "plots.admin.command.denied")) {
|
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !BukkitMain.hasPermission(plr, "plots.admin.command.denied")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("add")) {
|
if (args[0].equalsIgnoreCase("add")) {
|
||||||
@ -66,12 +66,12 @@ public class Denied extends SubCommand {
|
|||||||
uuid = UUIDHandler.getUUID(args[1]);
|
uuid = UUIDHandler.getUUID(args[1]);
|
||||||
}
|
}
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.denied.contains(uuid)) {
|
if (!plot.denied.contains(uuid)) {
|
||||||
if (plot.owner.equals(uuid)) {
|
if (plot.owner.equals(uuid)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.trusted.contains(uuid)) {
|
if (plot.trusted.contains(uuid)) {
|
||||||
@ -87,29 +87,29 @@ public class Denied extends SubCommand {
|
|||||||
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
|
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid);
|
final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid);
|
||||||
if (!uuid.equals(DBFunc.everyone) && (player != null) && player.isOnline()) {
|
if (!uuid.equals(DBFunc.everyone) && (player != null) && player.isOnline()) {
|
||||||
final Plot pl = PlayerFunctions.getCurrentPlot(player);
|
final Plot pl = BukkitPlayerFunctions.getCurrentPlot(player);
|
||||||
if ((pl != null) && pl.id.equals(plot.id)) {
|
if ((pl != null) && pl.id.equals(plot.id)) {
|
||||||
PlayerFunctions.sendMessage(player, C.YOU_BE_DENIED);
|
BukkitPlayerFunctions.sendMessage(player, C.YOU_BE_DENIED);
|
||||||
player.teleport(player.getWorld().getSpawnLocation());
|
player.teleport(player.getWorld().getSpawnLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.DENIED_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.DENIED_ADDED);
|
||||||
return true;
|
return true;
|
||||||
} else if (args[0].equalsIgnoreCase("remove")) {
|
} else if (args[0].equalsIgnoreCase("remove")) {
|
||||||
if (args[1].equalsIgnoreCase("*")) {
|
if (args[1].equalsIgnoreCase("*")) {
|
||||||
final UUID uuid = DBFunc.everyone;
|
final UUID uuid = DBFunc.everyone;
|
||||||
if (!plot.denied.contains(uuid)) {
|
if (!plot.denied.contains(uuid)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plot.removeDenied(uuid);
|
plot.removeDenied(uuid);
|
||||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
|
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
|
||||||
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
|
BukkitPlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
@ -117,9 +117,9 @@ public class Denied extends SubCommand {
|
|||||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
|
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
|
||||||
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);
|
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
|
BukkitPlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
|
BukkitPlayerFunctions.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.flag.FlagManager;
|
|||||||
import com.intellectualcrafters.plot.flag.FlagValue;
|
import com.intellectualcrafters.plot.flag.FlagValue;
|
||||||
import com.intellectualcrafters.plot.listeners.PlotListener;
|
import com.intellectualcrafters.plot.listeners.PlotListener;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class FlagCmd extends SubCommand {
|
public class FlagCmd extends SubCommand {
|
||||||
public FlagCmd() {
|
public FlagCmd() {
|
||||||
@ -53,12 +53,12 @@ public class FlagCmd extends SubCommand {
|
|||||||
* plot flag list
|
* plot flag list
|
||||||
*/
|
*/
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
|
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(player);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(player);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
@ -66,88 +66,88 @@ public class FlagCmd extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasRights(player) && !BukkitMain.hasPermission(player, "plots.set.flag.other")) {
|
if (!plot.hasRights(player) && !BukkitMain.hasPermission(player, "plots.set.flag.other")) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag.other");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag.other");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "info": {
|
case "info": {
|
||||||
if (!BukkitMain.hasPermission(player, "plots.set.flag")) {
|
if (!BukkitMain.hasPermission(player, "plots.set.flag")) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.info");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.info");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info <flag>");
|
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info <flag>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final AbstractFlag af = FlagManager.getFlag(args[1]);
|
final AbstractFlag af = FlagManager.getFlag(args[1]);
|
||||||
if (af == null) {
|
if (af == null) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
|
||||||
PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info <flag>");
|
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info <flag>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// flag key
|
// flag key
|
||||||
PlayerFunctions.sendMessage(player, C.FLAG_KEY, af.getKey());
|
BukkitPlayerFunctions.sendMessage(player, C.FLAG_KEY, af.getKey());
|
||||||
// flag type
|
// flag type
|
||||||
PlayerFunctions.sendMessage(player, C.FLAG_TYPE, af.value.getClass().getSimpleName());
|
BukkitPlayerFunctions.sendMessage(player, C.FLAG_TYPE, af.value.getClass().getSimpleName());
|
||||||
// Flag type description
|
// Flag type description
|
||||||
PlayerFunctions.sendMessage(player, C.FLAG_DESC, af.getValueDesc());
|
BukkitPlayerFunctions.sendMessage(player, C.FLAG_DESC, af.getValueDesc());
|
||||||
PlayerFunctions.sendMessage(player, "&cNot implemented.");
|
BukkitPlayerFunctions.sendMessage(player, "&cNot implemented.");
|
||||||
}
|
}
|
||||||
case "set": {
|
case "set": {
|
||||||
if (!BukkitMain.hasPermission(player, "plots.set.flag")) {
|
if (!BukkitMain.hasPermission(player, "plots.set.flag")) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag set <flag> <value>");
|
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag set <flag> <value>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final AbstractFlag af = FlagManager.getFlag(args[1].toLowerCase());
|
final AbstractFlag af = FlagManager.getFlag(args[1].toLowerCase());
|
||||||
if (af == null) {
|
if (af == null) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
if (!BukkitMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
||||||
final Object parsed = af.parseValueRaw(value);
|
final Object parsed = af.parseValueRaw(value);
|
||||||
if (parsed == null) {
|
if (parsed == null) {
|
||||||
PlayerFunctions.sendMessage(player, "&c" + af.getValueDesc());
|
BukkitPlayerFunctions.sendMessage(player, "&c" + af.getValueDesc());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), parsed);
|
final Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), parsed);
|
||||||
final boolean result = FlagManager.addPlotFlag(plot, flag);
|
final boolean result = FlagManager.addPlotFlag(plot, flag);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
PlayerFunctions.sendMessage(player, C.FLAG_NOT_ADDED);
|
BukkitPlayerFunctions.sendMessage(player, C.FLAG_NOT_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(player, C.FLAG_ADDED);
|
BukkitPlayerFunctions.sendMessage(player, C.FLAG_ADDED);
|
||||||
PlotListener.plotEntry(player, plot);
|
PlotListener.plotEntry(player, plot);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "remove": {
|
case "remove": {
|
||||||
if (!BukkitMain.hasPermission(player, "plots.flag.remove")) {
|
if (!BukkitMain.hasPermission(player, "plots.flag.remove")) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.remove");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.remove");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((args.length != 2) && (args.length != 3)) {
|
if ((args.length != 2) && (args.length != 3)) {
|
||||||
PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag remove <flag> [values]");
|
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag remove <flag> [values]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final AbstractFlag af = FlagManager.getFlag(args[1].toLowerCase());
|
final AbstractFlag af = FlagManager.getFlag(args[1].toLowerCase());
|
||||||
if (af == null) {
|
if (af == null) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
if (!BukkitMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Flag flag = FlagManager.getPlotFlagAbs(plot, args[1].toLowerCase());
|
final Flag flag = FlagManager.getPlotFlagAbs(plot, args[1].toLowerCase());
|
||||||
if (flag == null) {
|
if (flag == null) {
|
||||||
PlayerFunctions.sendMessage(player, C.FLAG_NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(player, C.FLAG_NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((args.length == 3) && flag.getAbstractFlag().isList()) {
|
if ((args.length == 3) && flag.getAbstractFlag().isList()) {
|
||||||
@ -157,36 +157,36 @@ public class FlagCmd extends SubCommand {
|
|||||||
} else {
|
} else {
|
||||||
final boolean result = FlagManager.removePlotFlag(plot, flag.getKey());
|
final boolean result = FlagManager.removePlotFlag(plot, flag.getKey());
|
||||||
if (!result) {
|
if (!result) {
|
||||||
PlayerFunctions.sendMessage(player, C.FLAG_NOT_REMOVED);
|
BukkitPlayerFunctions.sendMessage(player, C.FLAG_NOT_REMOVED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(player, C.FLAG_REMOVED);
|
BukkitPlayerFunctions.sendMessage(player, C.FLAG_REMOVED);
|
||||||
PlotListener.plotEntry(player, plot);
|
PlotListener.plotEntry(player, plot);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "add": {
|
case "add": {
|
||||||
if (!BukkitMain.hasPermission(player, "plots.flag.add")) {
|
if (!BukkitMain.hasPermission(player, "plots.flag.add")) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.add");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.add");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag add <flag> <values>");
|
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag add <flag> <values>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final AbstractFlag af = FlagManager.getFlag(args[1].toLowerCase());
|
final AbstractFlag af = FlagManager.getFlag(args[1].toLowerCase());
|
||||||
if (af == null) {
|
if (af == null) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
if (!BukkitMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
||||||
final Object parsed = af.parseValueRaw(value);
|
final Object parsed = af.parseValueRaw(value);
|
||||||
if (parsed == null) {
|
if (parsed == null) {
|
||||||
PlayerFunctions.sendMessage(player, "&c" + af.getValueDesc());
|
BukkitPlayerFunctions.sendMessage(player, "&c" + af.getValueDesc());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Flag flag = FlagManager.getPlotFlag(plot, args[1].toLowerCase());
|
Flag flag = FlagManager.getPlotFlag(plot, args[1].toLowerCase());
|
||||||
@ -197,21 +197,21 @@ public class FlagCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
final boolean result = FlagManager.addPlotFlag(plot, flag);
|
final boolean result = FlagManager.addPlotFlag(plot, flag);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
PlayerFunctions.sendMessage(player, C.FLAG_NOT_ADDED);
|
BukkitPlayerFunctions.sendMessage(player, C.FLAG_NOT_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
DBFunc.setFlags(plot.world, plot, plot.settings.flags);
|
DBFunc.setFlags(plot.world, plot, plot.settings.flags);
|
||||||
PlayerFunctions.sendMessage(player, C.FLAG_ADDED);
|
BukkitPlayerFunctions.sendMessage(player, C.FLAG_ADDED);
|
||||||
PlotListener.plotEntry(player, plot);
|
PlotListener.plotEntry(player, plot);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "list": {
|
case "list": {
|
||||||
if (!BukkitMain.hasPermission(player, "plots.flag.list")) {
|
if (!BukkitMain.hasPermission(player, "plots.flag.list")) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.list");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.flag.list");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag list");
|
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag list");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final HashMap<String, ArrayList<String>> flags = new HashMap<>();
|
final HashMap<String, ArrayList<String>> flags = new HashMap<>();
|
||||||
@ -228,11 +228,11 @@ public class FlagCmd extends SubCommand {
|
|||||||
message += prefix + "&6" + flag + ": &7" + StringUtils.join(flags.get(flag), ", ");
|
message += prefix + "&6" + flag + ": &7" + StringUtils.join(flags.get(flag), ", ");
|
||||||
prefix = "\n";
|
prefix = "\n";
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(player, message);
|
BukkitPlayerFunctions.sendMessage(player, message);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
|
BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
|
import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class Helpers extends SubCommand {
|
public class Helpers extends SubCommand {
|
||||||
@ -41,20 +41,20 @@ public class Helpers extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
|
BukkitPlayerFunctions.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
|
BukkitPlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !BukkitMain.hasPermission(plr, "plots.admin.command.helpers")) {
|
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !BukkitMain.hasPermission(plr, "plots.admin.command.helpers")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("add")) {
|
if (args[0].equalsIgnoreCase("add")) {
|
||||||
@ -65,12 +65,12 @@ public class Helpers extends SubCommand {
|
|||||||
uuid = UUIDHandler.getUUID(args[1]);
|
uuid = UUIDHandler.getUUID(args[1]);
|
||||||
}
|
}
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.helpers.contains(uuid)) {
|
if (!plot.helpers.contains(uuid)) {
|
||||||
if (plot.owner.equals(uuid)) {
|
if (plot.owner.equals(uuid)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.trusted.contains(uuid)) {
|
if (plot.trusted.contains(uuid)) {
|
||||||
@ -86,21 +86,21 @@ public class Helpers extends SubCommand {
|
|||||||
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
|
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.HELPER_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.HELPER_ADDED);
|
||||||
return true;
|
return true;
|
||||||
} else if (args[0].equalsIgnoreCase("remove")) {
|
} else if (args[0].equalsIgnoreCase("remove")) {
|
||||||
if (args[1].equalsIgnoreCase("*")) {
|
if (args[1].equalsIgnoreCase("*")) {
|
||||||
final UUID uuid = DBFunc.everyone;
|
final UUID uuid = DBFunc.everyone;
|
||||||
if (!plot.helpers.contains(uuid)) {
|
if (!plot.helpers.contains(uuid)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plot.removeHelper(uuid);
|
plot.removeHelper(uuid);
|
||||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
|
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
|
||||||
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
BukkitPlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
@ -108,9 +108,9 @@ public class Helpers extends SubCommand {
|
|||||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
|
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
|
||||||
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false);
|
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
BukkitPlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
|
BukkitPlayerFunctions.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -25,7 +25,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,20 +67,20 @@ public class Home extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_YOUR_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_YOUR_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((id > (plots.length)) || (id < 1)) {
|
if ((id > (plots.length)) || (id < 1)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
teleportPlayer(plr, plots[id - 1]);
|
teleportPlayer(plr, plots[id - 1]);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOTS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOTS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotComment;
|
import com.intellectualcrafters.plot.object.PlotComment;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class Inbox extends SubCommand {
|
public class Inbox extends SubCommand {
|
||||||
@ -50,13 +50,13 @@ public class Inbox extends SubCommand {
|
|||||||
report = true;
|
report = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr) && !report) {
|
if (!BukkitPlayerFunctions.isInPlot(plr) && !report) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if ((plot != null) && !plot.hasOwner()) {
|
if ((plot != null) && !plot.hasOwner()) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Integer tier;
|
Integer tier;
|
||||||
@ -80,7 +80,7 @@ public class Inbox extends SubCommand {
|
|||||||
if (tier <= 0) {
|
if (tier <= 0) {
|
||||||
tier = 0;
|
tier = 0;
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -88,7 +88,7 @@ public class Inbox extends SubCommand {
|
|||||||
if (tier <= 1) {
|
if (tier <= 1) {
|
||||||
tier = 1;
|
tier = 1;
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.owner");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.owner");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -96,7 +96,7 @@ public class Inbox extends SubCommand {
|
|||||||
if (tier <= 2) {
|
if (tier <= 2) {
|
||||||
tier = 2;
|
tier = 2;
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.helper");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.helper");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -104,7 +104,7 @@ public class Inbox extends SubCommand {
|
|||||||
if (tier <= 3) {
|
if (tier <= 3) {
|
||||||
tier = 3;
|
tier = 3;
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.trusted");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.trusted");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -112,7 +112,7 @@ public class Inbox extends SubCommand {
|
|||||||
if (tier <= 4) {
|
if (tier <= 4) {
|
||||||
tier = 4;
|
tier = 4;
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.everyone");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.everyone");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -120,12 +120,12 @@ public class Inbox extends SubCommand {
|
|||||||
if (tier <= 0) {
|
if (tier <= 0) {
|
||||||
tier = -1;
|
tier = -1;
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_INBOX, Arrays.copyOfRange(new String[] { "admin", "owner", "helper", "trusted", "everyone" }, Math.max(0, tier), 4));
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_INBOX, Arrays.copyOfRange(new String[] { "admin", "owner", "helper", "trusted", "everyone" }, Math.max(0, tier), 4));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -149,7 +149,7 @@ public class Inbox extends SubCommand {
|
|||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
final String[] split = args[1].toLowerCase().split(":");
|
final String[] split = args[1].toLowerCase().split(":");
|
||||||
if (!split[0].equals("clear")) {
|
if (!split[0].equals("clear")) {
|
||||||
PlayerFunctions.sendMessage(plr, "&c/plot inbox [tier] [clear][:#]");
|
BukkitPlayerFunctions.sendMessage(plr, "&c/plot inbox [tier] [clear][:#]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (split.length > 1) {
|
if (split.length > 1) {
|
||||||
@ -158,10 +158,10 @@ public class Inbox extends SubCommand {
|
|||||||
final PlotComment comment = comments.get(index - 1);
|
final PlotComment comment = comments.get(index - 1);
|
||||||
DBFunc.removeComment(world, plot, comment);
|
DBFunc.removeComment(world, plot, comment);
|
||||||
plot.settings.removeComment(comment);
|
plot.settings.removeComment(comment);
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "1 comment");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "1 comment");
|
||||||
return;
|
return;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
PlayerFunctions.sendMessage(plr, "&cInvalid index:\n/plot inbox [tier] [clear][:#]");
|
BukkitPlayerFunctions.sendMessage(plr, "&cInvalid index:\n/plot inbox [tier] [clear][:#]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ public class Inbox extends SubCommand {
|
|||||||
DBFunc.removeComment(world, plot, comment);
|
DBFunc.removeComment(world, plot, comment);
|
||||||
}
|
}
|
||||||
plot.settings.removeComments(comments);
|
plot.settings.removeComments(comments);
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "all comments in that category");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "all comments in that category");
|
||||||
} else {
|
} else {
|
||||||
final List<String> recipients = Arrays.asList("A", "O", "H", "T", "E");
|
final List<String> recipients = Arrays.asList("A", "O", "H", "T", "E");
|
||||||
int count = 1;
|
int count = 1;
|
||||||
@ -183,7 +183,7 @@ public class Inbox extends SubCommand {
|
|||||||
if (comments.size() == 0) {
|
if (comments.size() == 0) {
|
||||||
message.append("&cNo messages.");
|
message.append("&cNo messages.");
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, message.toString());
|
BukkitPlayerFunctions.sendMessage(plr, message.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -39,7 +39,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,22 +58,22 @@ public class Info extends SubCommand {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
world = player.getWorld();
|
world = player.getWorld();
|
||||||
if (!PlotSquared.isPlotWorld(world)) {
|
if (!PlotSquared.isPlotWorld(world)) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(player)) {
|
if (!BukkitPlayerFunctions.isInPlot(player)) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot = PlayerFunctions.getCurrentPlot(player);
|
plot = BukkitPlayerFunctions.getCurrentPlot(player);
|
||||||
} else {
|
} else {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(null, C.INFO_SYNTAX_CONSOLE);
|
BukkitPlayerFunctions.sendMessage(null, C.INFO_SYNTAX_CONSOLE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(args[0]);
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(args[0]);
|
||||||
if (plotworld == null) {
|
if (plotworld == null) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_VALID_WORLD);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -81,7 +81,7 @@ public class Info extends SubCommand {
|
|||||||
final PlotId id = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
final PlotId id = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
||||||
plot = MainUtil.getPlot(Bukkit.getWorld(plotworld.worldname), id);
|
plot = MainUtil.getPlot(Bukkit.getWorld(plotworld.worldname), id);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_PLOT_ID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
world = Bukkit.getWorld(args[0]);
|
world = Bukkit.getWorld(args[0]);
|
||||||
@ -91,7 +91,7 @@ public class Info extends SubCommand {
|
|||||||
args = new String[0];
|
args = new String[0];
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
PlayerFunctions.sendMessage(player, C.INFO_SYNTAX_CONSOLE);
|
BukkitPlayerFunctions.sendMessage(player, C.INFO_SYNTAX_CONSOLE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ public class Info extends SubCommand {
|
|||||||
}
|
}
|
||||||
// Unclaimed?
|
// Unclaimed?
|
||||||
if (!hasOwner && !containsEveryone && !trustedEveryone) {
|
if (!hasOwner && !containsEveryone && !trustedEveryone) {
|
||||||
PlayerFunctions.sendMessage(player, C.PLOT_INFO_UNCLAIMED, (plot.id.x + ";" + plot.id.y));
|
BukkitPlayerFunctions.sendMessage(player, C.PLOT_INFO_UNCLAIMED, (plot.id.x + ";" + plot.id.y));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String owner = "none";
|
String owner = "none";
|
||||||
@ -123,13 +123,13 @@ public class Info extends SubCommand {
|
|||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
info = getCaption(args[0].toLowerCase());
|
info = getCaption(args[0].toLowerCase());
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
PlayerFunctions.sendMessage(player, "&6Categories&7: &ahelpers&7, &aalias&7, &abiome&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, &aowner&7, &arating");
|
BukkitPlayerFunctions.sendMessage(player, "&6Categories&7: &ahelpers&7, &aalias&7, &abiome&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, &aowner&7, &arating");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info = format(info, world, plot, player);
|
info = format(info, world, plot, player);
|
||||||
PlayerFunctions.sendMessage(player, C.PLOT_INFO_HEADER);
|
BukkitPlayerFunctions.sendMessage(player, C.PLOT_INFO_HEADER);
|
||||||
PlayerFunctions.sendMessage(player, info, false);
|
BukkitPlayerFunctions.sendMessage(player, info, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,8 +162,8 @@ public class Info extends SubCommand {
|
|||||||
|
|
||||||
private String format(String info, final World world, final Plot plot, final Player player) {
|
private String format(String info, final World world, final Plot plot, final Player player) {
|
||||||
final PlotId id = plot.id;
|
final PlotId id = plot.id;
|
||||||
final PlotId id2 = PlayerFunctions.getTopPlot(world, plot).id;
|
final PlotId id2 = BukkitPlayerFunctions.getTopPlot(world, plot).id;
|
||||||
final int num = PlayerFunctions.getPlotSelectionIds(id, id2).size();
|
final int num = BukkitPlayerFunctions.getPlotSelectionIds(id, id2).size();
|
||||||
final String alias = plot.settings.getAlias().length() > 0 ? plot.settings.getAlias() : "none";
|
final String alias = plot.settings.getAlias().length() > 0 ? plot.settings.getAlias() : "none";
|
||||||
final String biome = getBiomeAt(plot).toString();
|
final String biome = getBiomeAt(plot).toString();
|
||||||
final String helpers = getPlayerList(plot.helpers);
|
final String helpers = getPlayerList(plot.helpers);
|
||||||
|
@ -26,7 +26,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.intellectualcrafters.plot.BukkitMain;
|
import com.intellectualcrafters.plot.BukkitMain;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
@SuppressWarnings({ "unused", "deprecation", "javadoc" })
|
@SuppressWarnings({ "unused", "deprecation", "javadoc" })
|
||||||
@ -37,26 +37,26 @@ public class Kick extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
PlayerFunctions.sendMessage(plr, "You're not in a plot.");
|
BukkitPlayerFunctions.sendMessage(plr, "You're not in a plot.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.kick")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.kick")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
PlayerFunctions.sendMessage(plr, "&c/plot kick <player>");
|
BukkitPlayerFunctions.sendMessage(plr, "&c/plot kick <player>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Bukkit.getPlayer(args[0]) == null) {
|
if (Bukkit.getPlayer(args[0]) == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[0]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[0]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Player player = Bukkit.getPlayer(args[0]);
|
final Player player = Bukkit.getPlayer(args[0]);
|
||||||
if (!player.getWorld().equals(plr.getWorld()) || !PlayerFunctions.isInPlot(player) || (PlayerFunctions.getCurrentPlot(player) == null) || !PlayerFunctions.getCurrentPlot(player).equals(plot)) {
|
if (!player.getWorld().equals(plr.getWorld()) || !BukkitPlayerFunctions.isInPlot(player) || (BukkitPlayerFunctions.getCurrentPlot(player) == null) || !BukkitPlayerFunctions.getCurrentPlot(player).equals(plot)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER.s().replaceAll("%player%", args[0]));
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER.s().replaceAll("%player%", args[0]));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
player.teleport(player.getWorld().getSpawnLocation());
|
player.teleport(player.getWorld().getSpawnLocation());
|
||||||
|
@ -25,7 +25,7 @@ import com.intellectualcrafters.plot.PlotSquared;
|
|||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.StringComparison;
|
import com.intellectualcrafters.plot.util.StringComparison;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -52,7 +52,7 @@ public class MainCommand {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public static boolean no_permission(final PlotPlayer player, final String permission) {
|
public static boolean no_permission(final PlotPlayer player, final String permission) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, permission);
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, permission);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ public class MainCommand {
|
|||||||
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
|
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
|
||||||
}
|
}
|
||||||
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", "all").replaceAll("%category_desc%", "Display all commands"));
|
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", "all").replaceAll("%category_desc%", "Display all commands"));
|
||||||
return PlayerFunctions.sendMessage(player, builder.toString());
|
return BukkitPlayerFunctions.sendMessage(player, builder.toString());
|
||||||
}
|
}
|
||||||
final String cat = args[1];
|
final String cat = args[1];
|
||||||
SubCommand.CommandCategory cato = null;
|
SubCommand.CommandCategory cato = null;
|
||||||
@ -136,7 +136,7 @@ public class MainCommand {
|
|||||||
for (final SubCommand.CommandCategory category : SubCommand.CommandCategory.values()) {
|
for (final SubCommand.CommandCategory category : SubCommand.CommandCategory.values()) {
|
||||||
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
|
builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
|
||||||
}
|
}
|
||||||
return PlayerFunctions.sendMessage(player, builder.toString(), false);
|
return BukkitPlayerFunctions.sendMessage(player, builder.toString(), false);
|
||||||
}
|
}
|
||||||
final StringBuilder help = new StringBuilder();
|
final StringBuilder help = new StringBuilder();
|
||||||
int page = 0;
|
int page = 0;
|
||||||
@ -173,21 +173,21 @@ public class MainCommand {
|
|||||||
if ((player != null) || !command.isPlayer) {
|
if ((player != null) || !command.isPlayer) {
|
||||||
return command.execute(player, arguments);
|
return command.execute(player, arguments);
|
||||||
} else {
|
} else {
|
||||||
return !PlayerFunctions.sendMessage(null, C.IS_CONSOLE);
|
return !BukkitPlayerFunctions.sendMessage(null, C.IS_CONSOLE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return no_permission(player, command.permission.permission.toLowerCase());
|
return no_permission(player, command.permission.permission.toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_VALID_SUBCOMMAND);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_SUBCOMMAND);
|
||||||
final String[] commands = new String[subCommands.size()];
|
final String[] commands = new String[subCommands.size()];
|
||||||
for (int x = 0; x < subCommands.size(); x++) {
|
for (int x = 0; x < subCommands.size(); x++) {
|
||||||
commands[x] = subCommands.get(x).cmd;
|
commands[x] = subCommands.get(x).cmd;
|
||||||
}
|
}
|
||||||
/* Let's try to get a proper usage string */
|
/* Let's try to get a proper usage string */
|
||||||
final String command = new StringComparison(args[0], commands).getBestMatch();
|
final String command = new StringComparison(args[0], commands).getBestMatch();
|
||||||
return PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, "/plot " + command);
|
return BukkitPlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, "/plot " + command);
|
||||||
// PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, new
|
// PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, new
|
||||||
// StringComparsion(args[0], commands).getBestMatch());
|
// StringComparsion(args[0], commands).getBestMatch());
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,23 +75,23 @@ public class Merge extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
|
BukkitPlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final boolean admin = BukkitMain.hasPermission(plr, "plots.admin.command.merge");
|
final boolean admin = BukkitMain.hasPermission(plr, "plots.admin.command.merge");
|
||||||
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !admin) {
|
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !admin) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
PlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s()));
|
BukkitPlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s()));
|
||||||
PlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw())));
|
BukkitPlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw())));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int direction = -1;
|
int direction = -1;
|
||||||
@ -102,43 +102,43 @@ public class Merge extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (direction == -1) {
|
if (direction == -1) {
|
||||||
PlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s()));
|
BukkitPlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s()));
|
||||||
PlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw())));
|
BukkitPlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw())));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final World world = plr.getWorld();
|
final World world = plr.getWorld();
|
||||||
PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id;
|
PlotId bot = BukkitPlayerFunctions.getBottomPlot(world, plot).id;
|
||||||
PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
|
PlotId top = BukkitPlayerFunctions.getTopPlot(world, plot).id;
|
||||||
ArrayList<PlotId> plots;
|
ArrayList<PlotId> plots;
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case 0: // north = -y
|
case 0: // north = -y
|
||||||
plots = PlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y));
|
plots = BukkitPlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y));
|
||||||
break;
|
break;
|
||||||
case 1: // east = +x
|
case 1: // east = +x
|
||||||
plots = PlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x + 1, top.y));
|
plots = BukkitPlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x + 1, top.y));
|
||||||
break;
|
break;
|
||||||
case 2: // south = +y
|
case 2: // south = +y
|
||||||
plots = PlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x, top.y + 1));
|
plots = BukkitPlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x, top.y + 1));
|
||||||
break;
|
break;
|
||||||
case 3: // west = -x
|
case 3: // west = -x
|
||||||
plots = PlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x - 1, bot.y), new PlotId(top.x, top.y));
|
plots = BukkitPlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x - 1, bot.y), new PlotId(top.x, top.y));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotId botId = plots.get(0);
|
final PlotId botId = plots.get(0);
|
||||||
final PlotId topId = plots.get(plots.size() - 1);
|
final PlotId topId = plots.get(plots.size() - 1);
|
||||||
final PlotId bot1 = PlayerFunctions.getBottomPlot(world, MainUtil.getPlot(world, botId)).id;
|
final PlotId bot1 = BukkitPlayerFunctions.getBottomPlot(world, MainUtil.getPlot(world, botId)).id;
|
||||||
final PlotId bot2 = PlayerFunctions.getBottomPlot(world, MainUtil.getPlot(world, topId)).id;
|
final PlotId bot2 = BukkitPlayerFunctions.getBottomPlot(world, MainUtil.getPlot(world, topId)).id;
|
||||||
final PlotId top1 = PlayerFunctions.getTopPlot(world, MainUtil.getPlot(world, topId)).id;
|
final PlotId top1 = BukkitPlayerFunctions.getTopPlot(world, MainUtil.getPlot(world, topId)).id;
|
||||||
final PlotId top2 = PlayerFunctions.getTopPlot(world, MainUtil.getPlot(world, botId)).id;
|
final PlotId top2 = BukkitPlayerFunctions.getTopPlot(world, MainUtil.getPlot(world, botId)).id;
|
||||||
bot = new PlotId(Math.min(bot1.x, bot2.x), Math.min(bot1.y, bot2.y));
|
bot = new PlotId(Math.min(bot1.x, bot2.x), Math.min(bot1.y, bot2.y));
|
||||||
top = new PlotId(Math.max(top1.x, top2.x), Math.max(top1.y, top2.y));
|
top = new PlotId(Math.max(top1.x, top2.x), Math.max(top1.y, top2.y));
|
||||||
plots = PlayerFunctions.getMaxPlotSelectionIds(world, bot, top);
|
plots = BukkitPlayerFunctions.getMaxPlotSelectionIds(world, bot, top);
|
||||||
for (final PlotId myid : plots) {
|
for (final PlotId myid : plots) {
|
||||||
final Plot myplot = PlotSquared.getPlots(world).get(myid);
|
final Plot myplot = PlotSquared.getPlots(world).get(myid);
|
||||||
if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(plr)) || admin)) {
|
if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(plr)) || admin)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString()));
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,10 +160,10 @@ public class Merge extends SubCommand {
|
|||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
PlayerFunctions.sendMessage(plr, "&cMerge has been cancelled");
|
BukkitPlayerFunctions.sendMessage(plr, "&cMerge has been cancelled");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, "&cPlots have been merged");
|
BukkitPlayerFunctions.sendMessage(plr, "&cPlots have been merged");
|
||||||
MainUtil.mergePlots(world, plots, true);
|
MainUtil.mergePlots(world, plots, true);
|
||||||
MainUtil.setSign(world, UUIDHandler.getName(plot.owner), plot);
|
MainUtil.setSign(world, UUIDHandler.getName(plot.owner), plot);
|
||||||
MainUtil.update(plr.getLocation());
|
MainUtil.update(plr.getLocation());
|
||||||
|
@ -25,7 +25,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created 2014-08-01 for PlotSquared
|
* Created 2014-08-01 for PlotSquared
|
||||||
@ -40,32 +40,32 @@ public class Move extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
PlayerFunctions.sendMessage(plr, "MUST BE EXECUTED BY PLAYER");
|
BukkitPlayerFunctions.sendMessage(plr, "MUST BE EXECUTED BY PLAYER");
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot move <pos1> <pos2>");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot move <pos1> <pos2>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final World world = plr.getWorld();
|
final World world = plr.getWorld();
|
||||||
final PlotId plot1 = MainUtil.parseId(args[0]);
|
final PlotId plot1 = MainUtil.parseId(args[0]);
|
||||||
final PlotId plot2 = MainUtil.parseId(args[1]);
|
final PlotId plot2 = MainUtil.parseId(args[1]);
|
||||||
if ((plot1 == null) || (plot2 == null)) {
|
if ((plot1 == null) || (plot2 == null)) {
|
||||||
PlayerFunctions.sendMessage(plr, "INVALID PLOT ID\n/plot move <pos1> <pos2>");
|
BukkitPlayerFunctions.sendMessage(plr, "INVALID PLOT ID\n/plot move <pos1> <pos2>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot1 == plot2) {
|
if (plot1 == plot2) {
|
||||||
PlayerFunctions.sendMessage(plr, "DUPLICATE ID");
|
BukkitPlayerFunctions.sendMessage(plr, "DUPLICATE ID");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (MainUtil.move(world, plot1, plot2, new Runnable() {
|
if (MainUtil.move(world, plot1, plot2, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
PlayerFunctions.sendMessage(plr, "MOVE SUCCESS");
|
BukkitPlayerFunctions.sendMessage(plr, "MOVE SUCCESS");
|
||||||
}
|
}
|
||||||
})) {
|
})) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, "MOVE FAILED");
|
BukkitPlayerFunctions.sendMessage(plr, "MOVE FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
|
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class MusicSubcommand extends SubCommand {
|
public class MusicSubcommand extends SubCommand {
|
||||||
public MusicSubcommand() {
|
public MusicSubcommand() {
|
||||||
@ -40,11 +40,11 @@ public class MusicSubcommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player player, final String... args) {
|
public boolean execute(final Player player, final String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(player)) {
|
if (!BukkitPlayerFunctions.isInPlot(player)) {
|
||||||
sendMessage(player, C.NOT_IN_PLOT);
|
sendMessage(player, C.NOT_IN_PLOT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(player);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(player);
|
||||||
if (!plot.hasRights(player)) {
|
if (!plot.hasRights(player)) {
|
||||||
sendMessage(player, C.NO_PLOT_PERMS);
|
sendMessage(player, C.NO_PLOT_PERMS);
|
||||||
return true;
|
return true;
|
||||||
|
@ -4,7 +4,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created 2014-11-09 for PlotSquared
|
* Created 2014-11-09 for PlotSquared
|
||||||
@ -19,12 +19,12 @@ public class OP extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
return PlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage);
|
return BukkitPlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage);
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (!plot.hasRights(plr)) {
|
if (!plot.hasRights(plr)) {
|
||||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import com.intellectualcrafters.plot.BukkitMain;
|
|||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class Paste extends SubCommand {
|
public class Paste extends SubCommand {
|
||||||
@ -36,17 +36,17 @@ public class Paste extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.paste")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.paste")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
||||||
PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
|
BukkitPlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
|
@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
@SuppressWarnings({ "javadoc" })
|
@SuppressWarnings({ "javadoc" })
|
||||||
@ -55,47 +55,47 @@ public class Purge extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (plr != null) {
|
if (plr != null) {
|
||||||
PlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE));
|
BukkitPlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final String arg = args[0].toLowerCase();
|
final String arg = args[0].toLowerCase();
|
||||||
final PlotId id = getId(arg);
|
final PlotId id = getId(arg);
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot purge x;z &l<world>");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot purge x;z &l<world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[0]);
|
final UUID uuid = UUIDHandler.getUUID(args[0]);
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot purge " + args[0] + " &l<world>");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot purge " + args[0] + " &l<world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (arg.equals("player")) {
|
if (arg.equals("player")) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot purge &l<player> <world>");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot purge &l<player> <world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (arg.equals("unowned")) {
|
if (arg.equals("unowned")) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot purge unowned &l<world>");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot purge unowned &l<world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (arg.equals("unknown")) {
|
if (arg.equals("unknown")) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot purge unknown &l<world>");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot purge unknown &l<world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (arg.equals("all")) {
|
if (arg.equals("all")) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot purge all &l<world>");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot purge all &l<world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX);
|
BukkitPlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX);
|
BukkitPlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final World world = Bukkit.getWorld(args[1]);
|
final World world = Bukkit.getWorld(args[1]);
|
||||||
if ((world == null) || !PlotSquared.isPlotWorld(world)) {
|
if ((world == null) || !PlotSquared.isPlotWorld(world)) {
|
||||||
PlayerFunctions.sendMessage(null, C.NOT_VALID_PLOT_WORLD);
|
BukkitPlayerFunctions.sendMessage(null, C.NOT_VALID_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String worldname = world.getName();
|
final String worldname = world.getName();
|
||||||
@ -123,7 +123,7 @@ public class Purge extends SubCommand {
|
|||||||
if (arg.equals("all")) {
|
if (arg.equals("all")) {
|
||||||
final Set<PlotId> ids = PlotSquared.getPlots(world).keySet();
|
final Set<PlotId> ids = PlotSquared.getPlots(world).keySet();
|
||||||
if (ids.size() == 0) {
|
if (ids.size() == 0) {
|
||||||
return PlayerFunctions.sendMessage(null, "&cNo plots found");
|
return BukkitPlayerFunctions.sendMessage(null, "&cNo plots found");
|
||||||
}
|
}
|
||||||
DBFunc.purge(worldname, ids);
|
DBFunc.purge(worldname, ids);
|
||||||
return finishPurge(ids.size());
|
return finishPurge(ids.size());
|
||||||
@ -140,7 +140,7 @@ public class Purge extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ids.size() == 0) {
|
if (ids.size() == 0) {
|
||||||
return PlayerFunctions.sendMessage(null, "&cNo plots found");
|
return BukkitPlayerFunctions.sendMessage(null, "&cNo plots found");
|
||||||
}
|
}
|
||||||
DBFunc.purge(worldname, ids);
|
DBFunc.purge(worldname, ids);
|
||||||
return finishPurge(ids.size());
|
return finishPurge(ids.size());
|
||||||
@ -154,17 +154,17 @@ public class Purge extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ids.size() == 0) {
|
if (ids.size() == 0) {
|
||||||
return PlayerFunctions.sendMessage(null, "&cNo plots found");
|
return BukkitPlayerFunctions.sendMessage(null, "&cNo plots found");
|
||||||
}
|
}
|
||||||
DBFunc.purge(worldname, ids);
|
DBFunc.purge(worldname, ids);
|
||||||
return finishPurge(ids.size());
|
return finishPurge(ids.size());
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX);
|
BukkitPlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean finishPurge(final int amount) {
|
private boolean finishPurge(final int amount) {
|
||||||
PlayerFunctions.sendMessage(null, C.PURGE_SUCCESS, amount + "");
|
BukkitPlayerFunctions.sendMessage(null, C.PURGE_SUCCESS, amount + "");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
@SuppressWarnings({ "unused", "deprecated", "javadoc" })
|
@SuppressWarnings({ "unused", "deprecated", "javadoc" })
|
||||||
@ -44,11 +44,11 @@ public class Rate extends SubCommand {
|
|||||||
sendMessage(plr, C.RATING_NOT_VALID);
|
sendMessage(plr, C.RATING_NOT_VALID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
sendMessage(plr, C.NOT_IN_PLOT);
|
sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
sendMessage(plr, C.RATING_NOT_OWNED);
|
sendMessage(plr, C.RATING_NOT_OWNED);
|
||||||
return true;
|
return true;
|
||||||
|
@ -25,7 +25,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class Reload extends SubCommand {
|
public class Reload extends SubCommand {
|
||||||
public Reload() {
|
public Reload() {
|
||||||
@ -46,7 +46,7 @@ public class Reload extends SubCommand {
|
|||||||
}
|
}
|
||||||
MainUtil.sendMessage(plr, C.RELOADED_CONFIGS);
|
MainUtil.sendMessage(plr, C.RELOADED_CONFIGS);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
PlayerFunctions.sendMessage(plr, C.RELOAD_FAILED);
|
BukkitPlayerFunctions.sendMessage(plr, C.RELOAD_FAILED);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler.DataCollection;
|
import com.intellectualcrafters.plot.util.SchematicHandler.DataCollection;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class Schematic extends SubCommand {
|
public class Schematic extends SubCommand {
|
||||||
@ -70,19 +70,19 @@ public class Schematic extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.schematic.paste")) {
|
if (!BukkitMain.hasPermission(plr, "plots.schematic.paste")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
sendMessage(plr, C.SCHEMATIC_MISSING_ARG);
|
sendMessage(plr, C.SCHEMATIC_MISSING_ARG);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
sendMessage(plr, C.NOT_IN_PLOT);
|
sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (this.running) {
|
if (this.running) {
|
||||||
PlayerFunctions.sendMessage(plr, "&cTask is already running.");
|
BukkitPlayerFunctions.sendMessage(plr, "&cTask is already running.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String file2 = args[1];
|
final String file2 = args[1];
|
||||||
@ -99,7 +99,7 @@ public class Schematic extends SubCommand {
|
|||||||
}
|
}
|
||||||
final int x;
|
final int x;
|
||||||
final int z;
|
final int z;
|
||||||
final Plot plot2 = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot2 = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
final Dimension dem = schematic.getSchematicDimension();
|
final Dimension dem = schematic.getSchematicDimension();
|
||||||
final Location bot = MainUtil.getPlotBottomLoc(plr.getWorld(), plot2.id).add(1, 0, 1);
|
final Location bot = MainUtil.getPlotBottomLoc(plr.getWorld(), plot2.id).add(1, 0, 1);
|
||||||
final int length2 = MainUtil.getPlotWidth(plr.getWorld(), plot2.id);
|
final int length2 = MainUtil.getPlotWidth(plr.getWorld(), plot2.id);
|
||||||
@ -151,7 +151,7 @@ public class Schematic extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.schematic.test")) {
|
if (!BukkitMain.hasPermission(plr, "plots.schematic.test")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.test");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.test");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
@ -166,7 +166,7 @@ public class Schematic extends SubCommand {
|
|||||||
}
|
}
|
||||||
final int l1 = schematic.getSchematicDimension().getX();
|
final int l1 = schematic.getSchematicDimension().getX();
|
||||||
final int l2 = schematic.getSchematicDimension().getZ();
|
final int l2 = schematic.getSchematicDimension().getZ();
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
final int length = MainUtil.getPlotWidth(plr.getWorld(), plot.id);
|
final int length = MainUtil.getPlotWidth(plr.getWorld(), plot.id);
|
||||||
if ((l1 < length) || (l2 < length)) {
|
if ((l1 < length) || (l2 < length)) {
|
||||||
sendMessage(plr, C.SCHEMATIC_INVALID, String.format("Wrong size (x: %s, z: %d) vs %d ", l1, l2, length));
|
sendMessage(plr, C.SCHEMATIC_INVALID, String.format("Wrong size (x: %s, z: %d) vs %d ", l1, l2, length));
|
||||||
@ -177,20 +177,20 @@ public class Schematic extends SubCommand {
|
|||||||
case "saveall":
|
case "saveall":
|
||||||
case "exportall":
|
case "exportall":
|
||||||
if (plr != null) {
|
if (plr != null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_CONSOLE);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_CONSOLE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
PlayerFunctions.sendMessage(null, "&cNeed world arg. Use &7/plots sch exportall <world>");
|
BukkitPlayerFunctions.sendMessage(null, "&cNeed world arg. Use &7/plots sch exportall <world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final HashMap<PlotId, Plot> plotmap = PlotSquared.getPlots(args[1]);
|
final HashMap<PlotId, Plot> plotmap = PlotSquared.getPlots(args[1]);
|
||||||
if ((plotmap == null) || (plotmap.size() == 0)) {
|
if ((plotmap == null) || (plotmap.size() == 0)) {
|
||||||
PlayerFunctions.sendMessage(null, "&cInvalid world. Use &7/plots sch exportall <world>");
|
BukkitPlayerFunctions.sendMessage(null, "&cInvalid world. Use &7/plots sch exportall <world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.running) {
|
if (this.running) {
|
||||||
PlayerFunctions.sendMessage(null, "&cTask is already running.");
|
BukkitPlayerFunctions.sendMessage(null, "&cTask is already running.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while.");
|
PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while.");
|
||||||
@ -216,17 +216,17 @@ public class Schematic extends SubCommand {
|
|||||||
final String o = UUIDHandler.getName(plot.owner);
|
final String o = UUIDHandler.getName(plot.owner);
|
||||||
final String owner = o == null ? "unknown" : o;
|
final String owner = o == null ? "unknown" : o;
|
||||||
if (sch == null) {
|
if (sch == null) {
|
||||||
PlayerFunctions.sendMessage(null, "&7 - Skipped plot &c" + plot.id);
|
BukkitPlayerFunctions.sendMessage(null, "&7 - Skipped plot &c" + plot.id);
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
PlayerFunctions.sendMessage(null, "&6ID: " + plot.id);
|
BukkitPlayerFunctions.sendMessage(null, "&6ID: " + plot.id);
|
||||||
final boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + worldname + "," + owner + ".schematic");
|
final boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + worldname + "," + owner + ".schematic");
|
||||||
if (!result) {
|
if (!result) {
|
||||||
PlayerFunctions.sendMessage(null, "&7 - Failed to save &c" + plot.id);
|
BukkitPlayerFunctions.sendMessage(null, "&7 - Failed to save &c" + plot.id);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(null, "&7 - &aExport success: " + plot.id);
|
BukkitPlayerFunctions.sendMessage(null, "&7 - &aExport success: " + plot.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -238,21 +238,21 @@ public class Schematic extends SubCommand {
|
|||||||
case "export":
|
case "export":
|
||||||
case "save":
|
case "save":
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.schematic.save")) {
|
if (!BukkitMain.hasPermission(plr, "plots.schematic.save")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.running) {
|
if (this.running) {
|
||||||
PlayerFunctions.sendMessage(plr, "&cTask is already running.");
|
BukkitPlayerFunctions.sendMessage(plr, "&cTask is already running.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String world;
|
final String world;
|
||||||
final Plot p2;
|
final Plot p2;
|
||||||
if (plr != null) {
|
if (plr != null) {
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
sendMessage(plr, C.NOT_IN_PLOT);
|
sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Plot myplot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot myplot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (!myplot.hasRights(plr)) {
|
if (!myplot.hasRights(plr)) {
|
||||||
sendMessage(plr, C.NO_PLOT_PERMS);
|
sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
@ -266,16 +266,16 @@ public class Schematic extends SubCommand {
|
|||||||
final String[] split = args[2].split(";");
|
final String[] split = args[2].split(";");
|
||||||
final PlotId i = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
final PlotId i = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
||||||
if ((PlotSquared.getPlots(world) == null) || (PlotSquared.getPlots(world).get(i) == null)) {
|
if ((PlotSquared.getPlots(world) == null) || (PlotSquared.getPlots(world).get(i) == null)) {
|
||||||
PlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
|
BukkitPlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
p2 = PlotSquared.getPlots(world).get(i);
|
p2 = PlotSquared.getPlots(world).get(i);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
PlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
|
BukkitPlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
|
BukkitPlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save <world> <id>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,17 +297,17 @@ public class Schematic extends SubCommand {
|
|||||||
final String o = UUIDHandler.getName(plot.owner);
|
final String o = UUIDHandler.getName(plot.owner);
|
||||||
final String owner = o == null ? "unknown" : o;
|
final String owner = o == null ? "unknown" : o;
|
||||||
if (sch == null) {
|
if (sch == null) {
|
||||||
PlayerFunctions.sendMessage(plr, "&7 - Skipped plot &c" + plot.id);
|
BukkitPlayerFunctions.sendMessage(plr, "&7 - Skipped plot &c" + plot.id);
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
PlayerFunctions.sendMessage(plr, "&6ID: " + plot.id);
|
BukkitPlayerFunctions.sendMessage(plr, "&6ID: " + plot.id);
|
||||||
final boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + world + "," + owner.trim() + ".schematic");
|
final boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + world + "," + owner.trim() + ".schematic");
|
||||||
if (!result) {
|
if (!result) {
|
||||||
PlayerFunctions.sendMessage(plr, "&7 - Failed to save &c" + plot.id);
|
BukkitPlayerFunctions.sendMessage(plr, "&7 - Failed to save &c" + plot.id);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, "&7 - &aExport success: " + plot.id);
|
BukkitPlayerFunctions.sendMessage(plr, "&7 - &aExport success: " + plot.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -48,7 +48,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
|||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.StringComparison;
|
import com.intellectualcrafters.plot.util.StringComparison;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,21 +65,21 @@ public class Set extends SubCommand {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasRights(plr) && !BukkitMain.hasPermission(plr, "plots.admin.command.set")) {
|
if (!plot.hasRights(plr) && !BukkitMain.hasPermission(plr, "plots.admin.command.set")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
PlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values));
|
BukkitPlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < aliases.length; i++) {
|
for (int i = 0; i < aliases.length; i++) {
|
||||||
@ -91,7 +91,7 @@ public class Set extends SubCommand {
|
|||||||
/* TODO: Implement option */
|
/* TODO: Implement option */
|
||||||
// final boolean advanced_permissions = true;
|
// final boolean advanced_permissions = true;
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.set." + args[0].toLowerCase())) {
|
if (!BukkitMain.hasPermission(plr, "plots.set." + args[0].toLowerCase())) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.set." + args[0].toLowerCase());
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.set." + args[0].toLowerCase());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("flag")) {
|
if (args[0].equalsIgnoreCase("flag")) {
|
||||||
@ -104,7 +104,7 @@ public class Set extends SubCommand {
|
|||||||
message += "," + StringUtils.join(PlotSquared.worldGuardListener.str_flags, "&c, &6");
|
message += "," + StringUtils.join(PlotSquared.worldGuardListener.str_flags, "&c, &6");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
|
BukkitPlayerFunctions.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
AbstractFlag af;
|
AbstractFlag af;
|
||||||
@ -114,11 +114,11 @@ public class Set extends SubCommand {
|
|||||||
af = new AbstractFlag(args[1].toLowerCase());
|
af = new AbstractFlag(args[1].toLowerCase());
|
||||||
}
|
}
|
||||||
if (!FlagManager.getFlags().contains(af) && ((PlotSquared.worldGuardListener == null) || !PlotSquared.worldGuardListener.str_flags.contains(args[1].toLowerCase()))) {
|
if (!FlagManager.getFlags().contains(af) && ((PlotSquared.worldGuardListener == null) || !PlotSquared.worldGuardListener.str_flags.contains(args[1].toLowerCase()))) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) {
|
if (!BukkitMain.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
@ -129,15 +129,15 @@ public class Set extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.FLAG_NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final boolean result = FlagManager.removePlotFlag(plot, args[1].toLowerCase());
|
final boolean result = FlagManager.removePlotFlag(plot, args[1].toLowerCase());
|
||||||
if (!result) {
|
if (!result) {
|
||||||
PlayerFunctions.sendMessage(plr, C.FLAG_NOT_REMOVED);
|
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_NOT_REMOVED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.FLAG_REMOVED);
|
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_REMOVED);
|
||||||
PlotListener.plotEntry(plr, plot);
|
PlotListener.plotEntry(plr, plot);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ public class Set extends SubCommand {
|
|||||||
final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
||||||
final Object parsed_value = af.parseValueRaw(value);
|
final Object parsed_value = af.parseValueRaw(value);
|
||||||
if (parsed_value == null) {
|
if (parsed_value == null) {
|
||||||
PlayerFunctions.sendMessage(plr, af.getValueDesc());
|
BukkitPlayerFunctions.sendMessage(plr, af.getValueDesc());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((FlagManager.getFlag(args[1].toLowerCase()) == null) && (PlotSquared.worldGuardListener != null)) {
|
if ((FlagManager.getFlag(args[1].toLowerCase()) == null) && (PlotSquared.worldGuardListener != null)) {
|
||||||
@ -155,14 +155,14 @@ public class Set extends SubCommand {
|
|||||||
final Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), parsed_value);
|
final Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), parsed_value);
|
||||||
final boolean result = FlagManager.addPlotFlag(plot, flag);
|
final boolean result = FlagManager.addPlotFlag(plot, flag);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
PlayerFunctions.sendMessage(plr, C.FLAG_NOT_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_NOT_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.FLAG_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.FLAG_ADDED);
|
||||||
PlotListener.plotEntry(plr, plot);
|
PlotListener.plotEntry(plr, plot);
|
||||||
return true;
|
return true;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
PlayerFunctions.sendMessage(plr, "&c" + e.getMessage());
|
BukkitPlayerFunctions.sendMessage(plr, "&c" + e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ public class Set extends SubCommand {
|
|||||||
DBFunc.setPosition(plr.getWorld().getName(), plot, "");
|
DBFunc.setPosition(plr.getWorld().getName(), plot, "");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return PlayerFunctions.sendMessage(plr, C.HOME_ARGUMENT);
|
return BukkitPlayerFunctions.sendMessage(plr, C.HOME_ARGUMENT);
|
||||||
}
|
}
|
||||||
//set to current location
|
//set to current location
|
||||||
final World world = plr.getWorld();
|
final World world = plr.getWorld();
|
||||||
@ -183,35 +183,35 @@ public class Set extends SubCommand {
|
|||||||
final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
|
final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
|
||||||
plot.settings.setPosition(blockloc);
|
plot.settings.setPosition(blockloc);
|
||||||
DBFunc.setPosition(plr.getWorld().getName(), plot, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ());
|
DBFunc.setPosition(plr.getWorld().getName(), plot, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ());
|
||||||
return PlayerFunctions.sendMessage(plr, C.POSITION_SET);
|
return BukkitPlayerFunctions.sendMessage(plr, C.POSITION_SET);
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("alias")) {
|
if (args[0].equalsIgnoreCase("alias")) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.MISSING_ALIAS);
|
BukkitPlayerFunctions.sendMessage(plr, C.MISSING_ALIAS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String alias = args[1];
|
final String alias = args[1];
|
||||||
if (alias.length() >= 50) {
|
if (alias.length() >= 50) {
|
||||||
PlayerFunctions.sendMessage(plr, C.ALIAS_TOO_LONG);
|
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_TOO_LONG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (final Plot p : PlotSquared.getPlots(plr.getWorld()).values()) {
|
for (final Plot p : PlotSquared.getPlots(plr.getWorld()).values()) {
|
||||||
if (p.settings.getAlias().equalsIgnoreCase(alias)) {
|
if (p.settings.getAlias().equalsIgnoreCase(alias)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (UUIDHandler.nameExists(new StringWrapper(alias))) {
|
if (UUIDHandler.nameExists(new StringWrapper(alias))) {
|
||||||
PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBFunc.setAlias(plr.getWorld().getName(), plot, alias);
|
DBFunc.setAlias(plr.getWorld().getName(), plot, alias);
|
||||||
PlayerFunctions.sendMessage(plr, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias));
|
BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("biome")) {
|
if (args[0].equalsIgnoreCase("biome")) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_BIOME);
|
BukkitPlayerFunctions.sendMessage(plr, C.NEED_BIOME);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args[1].length() < 2) {
|
if (args[1].length() < 2) {
|
||||||
@ -228,11 +228,11 @@ public class Set extends SubCommand {
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
if (biome == null) {
|
if (biome == null) {
|
||||||
PlayerFunctions.sendMessage(plr, getBiomeList(Arrays.asList(Biome.values())));
|
BukkitPlayerFunctions.sendMessage(plr, getBiomeList(Arrays.asList(Biome.values())));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
MainUtil.setBiome(plr.getWorld(), plot, biome);
|
MainUtil.setBiome(plr.getWorld(), plot, biome);
|
||||||
PlayerFunctions.sendMessage(plr, C.BIOME_SET_TO.s() + biome.toString().toLowerCase());
|
BukkitPlayerFunctions.sendMessage(plr, C.BIOME_SET_TO.s() + biome.toString().toLowerCase());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Get components
|
// Get components
|
||||||
@ -243,7 +243,7 @@ public class Set extends SubCommand {
|
|||||||
for (final String component : components) {
|
for (final String component : components) {
|
||||||
if (component.equalsIgnoreCase(args[0])) {
|
if (component.equalsIgnoreCase(args[0])) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_BLOCK);
|
BukkitPlayerFunctions.sendMessage(plr, C.NEED_BLOCK);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PlotBlock[] blocks;
|
PlotBlock[] blocks;
|
||||||
@ -253,12 +253,12 @@ public class Set extends SubCommand {
|
|||||||
try {
|
try {
|
||||||
blocks = new PlotBlock[] { new PlotBlock((short) getMaterial(args[1], PlotWorld.BLOCKS).getId(), (byte) 0) };
|
blocks = new PlotBlock[] { new PlotBlock((short) getMaterial(args[1], PlotWorld.BLOCKS).getId(), (byte) 0) };
|
||||||
} catch (final Exception e2) {
|
} catch (final Exception e2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_BLOCK);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_BLOCK);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
manager.setComponent(world, plotworld, plot.id, component, blocks);
|
manager.setComponent(world, plotworld, plot.id, component, blocks);
|
||||||
PlayerFunctions.sendMessage(plr, C.GENERATING_COMPONENT);
|
BukkitPlayerFunctions.sendMessage(plr, C.GENERATING_COMPONENT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ public class Set extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values));
|
BukkitPlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class SetOwner extends SubCommand {
|
public class SetOwner extends SubCommand {
|
||||||
@ -52,28 +52,28 @@ public class SetOwner extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if ((plot == null) || (plot.owner == null)) {
|
if ((plot == null) || (plot.owner == null)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_USER);
|
BukkitPlayerFunctions.sendMessage(plr, C.NEED_USER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.owner.equals(UUIDHandler.getUUID(plr)) && !BukkitMain.hasPermission(plr, "plots.admin.command.setowner")) {
|
if (!plot.owner.equals(UUIDHandler.getUUID(plr)) && !BukkitMain.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner");
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final World world = plr.getWorld();
|
final World world = plr.getWorld();
|
||||||
final PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id;
|
final PlotId bot = BukkitPlayerFunctions.getBottomPlot(world, plot).id;
|
||||||
final PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
|
final PlotId top = BukkitPlayerFunctions.getTopPlot(world, plot).id;
|
||||||
final ArrayList<PlotId> plots = PlayerFunctions.getPlotSelectionIds(bot, top);
|
final ArrayList<PlotId> plots = BukkitPlayerFunctions.getPlotSelectionIds(bot, top);
|
||||||
for (final PlotId id : plots) {
|
for (final PlotId id : plots) {
|
||||||
final Plot current = PlotSquared.getPlots(world).get(id);
|
final Plot current = PlotSquared.getPlots(world).get(id);
|
||||||
final UUID uuid = getUUID(args[0]);
|
final UUID uuid = getUUID(args[0]);
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[0]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[0]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
current.owner = uuid;
|
current.owner = uuid;
|
||||||
@ -84,7 +84,7 @@ public class SetOwner extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.setSign(world, args[0], plot);
|
MainUtil.setSign(world, args[0], plot);
|
||||||
PlayerFunctions.sendMessage(plr, C.SET_OWNER);
|
BukkitPlayerFunctions.sendMessage(plr, C.SET_OWNER);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ import com.intellectualcrafters.plot.config.ConfigurationNode;
|
|||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.generator.SquarePlotManager;
|
import com.intellectualcrafters.plot.generator.SquarePlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotGenerator;
|
import com.intellectualcrafters.plot.object.PlotGenerator;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class Setup extends SubCommand {
|
public class Setup extends SubCommand {
|
||||||
public final static Map<String, SetupObject> setupMap = new HashMap<>();
|
public final static Map<String, SetupObject> setupMap = new HashMap<>();
|
||||||
@ -93,13 +93,13 @@ public class Setup extends SubCommand {
|
|||||||
updateGenerators();
|
updateGenerators();
|
||||||
final String prefix = "\n&8 - &7";
|
final String prefix = "\n&8 - &7";
|
||||||
sendMessage(plr, C.SETUP_INIT);
|
sendMessage(plr, C.SETUP_INIT);
|
||||||
PlayerFunctions.sendMessage(plr, "&6What generator do you want?" + prefix + StringUtils.join(this.generators.keySet(), prefix).replaceAll("PlotSquared", "&2PlotSquared"));
|
BukkitPlayerFunctions.sendMessage(plr, "&6What generator do you want?" + prefix + StringUtils.join(this.generators.keySet(), prefix).replaceAll("PlotSquared", "&2PlotSquared"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (args[0].equalsIgnoreCase("cancel")) {
|
if (args[0].equalsIgnoreCase("cancel")) {
|
||||||
setupMap.remove(plr.getName());
|
setupMap.remove(plr.getName());
|
||||||
PlayerFunctions.sendMessage(plr, "&aCancelled setup");
|
BukkitPlayerFunctions.sendMessage(plr, "&aCancelled setup");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("back")) {
|
if (args[0].equalsIgnoreCase("back")) {
|
||||||
@ -120,14 +120,14 @@ public class Setup extends SubCommand {
|
|||||||
case 0: { // choose generator
|
case 0: { // choose generator
|
||||||
if ((args.length != 1) || !this.generators.containsKey(args[0])) {
|
if ((args.length != 1) || !this.generators.containsKey(args[0])) {
|
||||||
final String prefix = "\n&8 - &7";
|
final String prefix = "\n&8 - &7";
|
||||||
PlayerFunctions.sendMessage(plr, "&cYou must choose a generator!" + prefix + StringUtils.join(this.generators.keySet(), prefix).replaceAll("PlotSquared", "&2PlotSquared"));
|
BukkitPlayerFunctions.sendMessage(plr, "&cYou must choose a generator!" + prefix + StringUtils.join(this.generators.keySet(), prefix).replaceAll("PlotSquared", "&2PlotSquared"));
|
||||||
sendMessage(plr, C.SETUP_INIT);
|
sendMessage(plr, C.SETUP_INIT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
object.generator = args[0];
|
object.generator = args[0];
|
||||||
object.current++;
|
object.current++;
|
||||||
final String partial = Settings.ENABLE_CLUSTERS ? "\n&8 - &7PARTIAL&8 - &7Vanilla with clusters of plots" : "";
|
final String partial = Settings.ENABLE_CLUSTERS ? "\n&8 - &7PARTIAL&8 - &7Vanilla with clusters of plots" : "";
|
||||||
PlayerFunctions.sendMessage(plr, "&6What world type do you want?" + "\n&8 - &2DEFAULT&8 - &7Standard plot generation" + "\n&8 - &7AUGMENTED&8 - &7Plot generation with terrain" + partial);
|
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);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: { // choose world type
|
case 1: { // choose world type
|
||||||
@ -138,7 +138,7 @@ public class Setup extends SubCommand {
|
|||||||
types = Arrays.asList(new String[] { "default", "augmented" });
|
types = Arrays.asList(new String[] { "default", "augmented" });
|
||||||
}
|
}
|
||||||
if ((args.length != 1) || !types.contains(args[0].toLowerCase())) {
|
if ((args.length != 1) || !types.contains(args[0].toLowerCase())) {
|
||||||
PlayerFunctions.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");
|
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");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
object.type = types.indexOf(args[0].toLowerCase());
|
object.type = types.indexOf(args[0].toLowerCase());
|
||||||
@ -150,7 +150,7 @@ public class Setup extends SubCommand {
|
|||||||
final ConfigurationNode step = object.step[object.setup_index];
|
final ConfigurationNode step = object.step[object.setup_index];
|
||||||
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + "");
|
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + "");
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.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");
|
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");
|
||||||
}
|
}
|
||||||
object.current++;
|
object.current++;
|
||||||
break;
|
break;
|
||||||
@ -158,7 +158,7 @@ public class Setup extends SubCommand {
|
|||||||
case 2: { // Choose terrain
|
case 2: { // Choose terrain
|
||||||
final List<String> terrain = Arrays.asList(new String[] { "none", "ore", "all" });
|
final List<String> terrain = Arrays.asList(new String[] { "none", "ore", "all" });
|
||||||
if ((args.length != 1) || !terrain.contains(args[0].toLowerCase())) {
|
if ((args.length != 1) || !terrain.contains(args[0].toLowerCase())) {
|
||||||
PlayerFunctions.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");
|
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");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
object.terrain = terrain.indexOf(args[0].toLowerCase());
|
object.terrain = terrain.indexOf(args[0].toLowerCase());
|
||||||
@ -172,7 +172,7 @@ public class Setup extends SubCommand {
|
|||||||
}
|
}
|
||||||
case 3: { // world setup
|
case 3: { // world setup
|
||||||
if (object.setup_index == object.step.length) {
|
if (object.setup_index == object.step.length) {
|
||||||
PlayerFunctions.sendMessage(plr, "&6What do you want your world to be called?");
|
BukkitPlayerFunctions.sendMessage(plr, "&6What do you want your world to be called?");
|
||||||
object.setup_index = 0;
|
object.setup_index = 0;
|
||||||
object.current++;
|
object.current++;
|
||||||
return true;
|
return true;
|
||||||
@ -202,11 +202,11 @@ public class Setup extends SubCommand {
|
|||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
PlayerFunctions.sendMessage(plr, "&cYou need to choose a world name!");
|
BukkitPlayerFunctions.sendMessage(plr, "&cYou need to choose a world name!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Bukkit.getWorld(args[0]) != null) {
|
if (Bukkit.getWorld(args[0]) != null) {
|
||||||
PlayerFunctions.sendMessage(plr, "&cThat world name is already taken!");
|
BukkitPlayerFunctions.sendMessage(plr, "&cThat world name is already taken!");
|
||||||
}
|
}
|
||||||
object.world = args[0];
|
object.world = args[0];
|
||||||
setupMap.remove(plr.getName());
|
setupMap.remove(plr.getName());
|
||||||
|
@ -22,7 +22,7 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -144,11 +144,11 @@ public abstract class SubCommand {
|
|||||||
* @param c Caption
|
* @param c Caption
|
||||||
* @param args Arguments (%s's)
|
* @param args Arguments (%s's)
|
||||||
*
|
*
|
||||||
* @see com.intellectualcrafters.plot.util.bukkit.PlayerFunctions#sendMessage(org.bukkit.entity.Player,
|
* @see com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions#sendMessage(org.bukkit.entity.Player,
|
||||||
* com.intellectualcrafters.plot.config.C, String...)
|
* com.intellectualcrafters.plot.config.C, String...)
|
||||||
*/
|
*/
|
||||||
public boolean sendMessage(final PlotPlayer plr, final C c, final String... args) {
|
public boolean sendMessage(final PlotPlayer plr, final C c, final String... args) {
|
||||||
PlayerFunctions.sendMessage(plr, c, args);
|
BukkitPlayerFunctions.sendMessage(plr, c, args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,21 +46,21 @@ public class Swap extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_PLOT_ID);
|
BukkitPlayerFunctions.sendMessage(plr, C.NEED_PLOT_ID);
|
||||||
PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX);
|
BukkitPlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.swap")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.swap")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((plot != null) && plot.settings.isMerged()) {
|
if ((plot != null) && plot.settings.isMerged()) {
|
||||||
PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
|
BukkitPlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String id = args[0];
|
final String id = args[0];
|
||||||
@ -70,25 +70,25 @@ public class Swap extends SubCommand {
|
|||||||
plotid = new PlotId(Integer.parseInt(id.split(";")[0]), Integer.parseInt(id.split(";")[1]));
|
plotid = new PlotId(Integer.parseInt(id.split(";")[0]), Integer.parseInt(id.split(";")[1]));
|
||||||
final Plot plot2 = PlotSquared.getPlots(world).get(plotid);
|
final Plot plot2 = PlotSquared.getPlots(world).get(plotid);
|
||||||
if (((plot2 == null) || !plot2.hasOwner() || (plot2.owner != UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.swap")) {
|
if (((plot2 == null) || !plot2.hasOwner() || (plot2.owner != UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.swap")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE, plotid.toString());
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE, plotid.toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
||||||
PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX);
|
BukkitPlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
if (plot.id.equals(plotid)) {
|
if (plot.id.equals(plotid)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
||||||
PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX);
|
BukkitPlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotSelection.swap(world, plot.id, plotid);
|
PlotSelection.swap(world, plot.id, plotid);
|
||||||
// TODO Requires testing!!
|
// TODO Requires testing!!
|
||||||
DBFunc.dbManager.swapPlots(plot, MainUtil.getPlot(world, plotid));
|
DBFunc.dbManager.swapPlots(plot, MainUtil.getPlot(world, plotid));
|
||||||
// TODO Requires testing!!
|
// TODO Requires testing!!
|
||||||
PlayerFunctions.sendMessage(plr, C.SWAP_SUCCESS);
|
BukkitPlayerFunctions.sendMessage(plr, C.SWAP_SUCCESS);
|
||||||
MainUtil.update(plr.getLocation());
|
MainUtil.update(plr.getLocation());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
@ -43,7 +43,7 @@ public class TP extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_PLOT_ID);
|
BukkitPlayerFunctions.sendMessage(plr, C.NEED_PLOT_ID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String id = args[0];
|
final String id = args[0];
|
||||||
@ -55,7 +55,7 @@ public class TP extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!PlotSquared.isPlotWorld(world)) {
|
if (!PlotSquared.isPlotWorld(world)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Plot temp;
|
Plot temp;
|
||||||
@ -68,7 +68,7 @@ public class TP extends SubCommand {
|
|||||||
PlotSquared.teleportPlayer(plr, plr.getLocation(), MainUtil.getPlot(world, plotid));
|
PlotSquared.teleportPlayer(plr, plr.getLocation(), MainUtil.getPlot(world, plotid));
|
||||||
return true;
|
return true;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.PlotSquared;
|
|||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class Target extends SubCommand {
|
public class Target extends SubCommand {
|
||||||
public Target() {
|
public Target() {
|
||||||
@ -37,21 +37,21 @@ public class Target extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (!PlotSquared.isPlotWorld(plr.getWorld())) {
|
if (!PlotSquared.isPlotWorld(plr.getWorld())) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final PlotId id = MainUtil.parseId(args[1]);
|
final PlotId id = MainUtil.parseId(args[1]);
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Location loc = MainUtil.getPlotHome(plr.getWorld(), id);
|
final Location loc = MainUtil.getPlotHome(plr.getWorld(), id);
|
||||||
plr.setCompassTarget(loc);
|
plr.setCompassTarget(loc);
|
||||||
PlayerFunctions.sendMessage(plr, C.COMPASS_TARGET);
|
BukkitPlayerFunctions.sendMessage(plr, C.COMPASS_TARGET);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot target <X;Z>");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot target <X;Z>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class Template extends SubCommand {
|
public class Template extends SubCommand {
|
||||||
public Template() {
|
public Template() {
|
||||||
@ -42,23 +42,23 @@ public class Template extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|export> <world>");
|
BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|export> <world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final World world = Bukkit.getWorld(args[1]);
|
final World world = Bukkit.getWorld(args[1]);
|
||||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(args[1]);
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(args[1]);
|
||||||
if ((world == null) || (plotworld == null)) {
|
if ((world == null) || (plotworld == null)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "import": {
|
case "import": {
|
||||||
// TODO import template
|
// TODO import template
|
||||||
PlayerFunctions.sendMessage(plr, "TODO");
|
BukkitPlayerFunctions.sendMessage(plr, "TODO");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "export": {
|
case "export": {
|
||||||
PlayerFunctions.sendMessage(plr, "TODO");
|
BukkitPlayerFunctions.sendMessage(plr, "TODO");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO allow world settings (including schematics to be packed into a single file)
|
// TODO allow world settings (including schematics to be packed into a single file)
|
||||||
|
@ -41,7 +41,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.ChunkManager;
|
import com.intellectualcrafters.plot.util.bukkit.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class Trim extends SubCommand {
|
public class Trim extends SubCommand {
|
||||||
public static boolean TASK = false;
|
public static boolean TASK = false;
|
||||||
@ -63,35 +63,35 @@ public class Trim extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (plr != null) {
|
if (plr != null) {
|
||||||
PlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE));
|
BukkitPlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final String arg = args[0].toLowerCase();
|
final String arg = args[0].toLowerCase();
|
||||||
final PlotId id = getId(arg);
|
final PlotId id = getId(arg);
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot trim x;z &l<world>");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot trim x;z &l<world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (arg.equals("all")) {
|
if (arg.equals("all")) {
|
||||||
PlayerFunctions.sendMessage(plr, "/plot trim all &l<world>");
|
BukkitPlayerFunctions.sendMessage(plr, "/plot trim all &l<world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX);
|
BukkitPlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX);
|
BukkitPlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String arg = args[0].toLowerCase();
|
final String arg = args[0].toLowerCase();
|
||||||
if (!arg.equals("all")) {
|
if (!arg.equals("all")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX);
|
BukkitPlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final World world = Bukkit.getWorld(args[1]);
|
final World world = Bukkit.getWorld(args[1]);
|
||||||
if ((world == null) || (PlotSquared.getPlotWorld(world) == null)) {
|
if ((world == null) || (PlotSquared.getPlotWorld(world) == null)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_WORLD);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Trim.TASK) {
|
if (Trim.TASK) {
|
||||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
|
import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -42,20 +42,20 @@ public class Trusted extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
|
BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
|
BukkitPlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !BukkitMain.hasPermission(plr, "plots.admin.command.trusted")) {
|
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !BukkitMain.hasPermission(plr, "plots.admin.command.trusted")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("add")) {
|
if (args[0].equalsIgnoreCase("add")) {
|
||||||
@ -66,12 +66,12 @@ public class Trusted extends SubCommand {
|
|||||||
uuid = UUIDHandler.getUUID(args[1]);
|
uuid = UUIDHandler.getUUID(args[1]);
|
||||||
}
|
}
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]);
|
BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.trusted.contains(uuid)) {
|
if (!plot.trusted.contains(uuid)) {
|
||||||
if (plot.owner.equals(uuid)) {
|
if (plot.owner.equals(uuid)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.helpers.contains(uuid)) {
|
if (plot.helpers.contains(uuid)) {
|
||||||
@ -87,21 +87,21 @@ public class Trusted extends SubCommand {
|
|||||||
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
|
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED);
|
||||||
return true;
|
return true;
|
||||||
} else if (args[0].equalsIgnoreCase("remove")) {
|
} else if (args[0].equalsIgnoreCase("remove")) {
|
||||||
if (args[1].equalsIgnoreCase("*")) {
|
if (args[1].equalsIgnoreCase("*")) {
|
||||||
final UUID uuid = DBFunc.everyone;
|
final UUID uuid = DBFunc.everyone;
|
||||||
if (!plot.trusted.contains(uuid)) {
|
if (!plot.trusted.contains(uuid)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.T_WAS_NOT_ADDED);
|
BukkitPlayerFunctions.sendMessage(plr, C.T_WAS_NOT_ADDED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plot.removeTrusted(uuid);
|
plot.removeTrusted(uuid);
|
||||||
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
|
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
|
||||||
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
|
BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
@ -109,9 +109,9 @@ public class Trusted extends SubCommand {
|
|||||||
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
|
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
|
||||||
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false);
|
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
|
BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
|
BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -4,7 +4,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created 2014-11-09 for PlotSquared
|
* Created 2014-11-09 for PlotSquared
|
||||||
@ -19,12 +19,12 @@ public class Unban extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
return PlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage);
|
return BukkitPlayerFunctions.sendMessage(plr, "&cUsage: &c" + this.usage);
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (!plot.hasRights(plr)) {
|
if (!plot.hasRights(plr)) {
|
||||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class Unclaim extends SubCommand {
|
public class Unclaim extends SubCommand {
|
||||||
@ -41,11 +41,11 @@ public class Unclaim extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
||||||
return !sendMessage(plr, C.UNLINK_REQUIRED);
|
return !sendMessage(plr, C.UNLINK_REQUIRED);
|
||||||
}
|
}
|
||||||
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr)))) && !BukkitMain.hasPermission(plr, "plots.admin.command.unclaim")) {
|
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr)))) && !BukkitMain.hasPermission(plr, "plots.admin.command.unclaim")) {
|
||||||
@ -69,9 +69,9 @@ public class Unclaim extends SubCommand {
|
|||||||
DBFunc.delete(worldname, plot);
|
DBFunc.delete(worldname, plot);
|
||||||
// TODO set wall block
|
// TODO set wall block
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, "Plot removal has been denied.");
|
BukkitPlayerFunctions.sendMessage(plr, "Plot removal has been denied.");
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.UNCLAIM_SUCCESS);
|
BukkitPlayerFunctions.sendMessage(plr, C.UNCLAIM_SUCCESS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,19 +51,19 @@ public class Unlink extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
||||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.unlink")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.unlink")) {
|
||||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
}
|
}
|
||||||
if (PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
if (BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
||||||
return sendMessage(plr, C.UNLINK_IMPOSSIBLE);
|
return sendMessage(plr, C.UNLINK_IMPOSSIBLE);
|
||||||
}
|
}
|
||||||
final World world = plr.getWorld();
|
final World world = plr.getWorld();
|
||||||
if (!unlinkPlot(world, plot)) {
|
if (!unlinkPlot(world, plot)) {
|
||||||
PlayerFunctions.sendMessage(plr, "&cUnlink has been cancelled");
|
BukkitPlayerFunctions.sendMessage(plr, "&cUnlink has been cancelled");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -76,14 +76,14 @@ public class Unlink extends SubCommand {
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, "&6Plots unlinked successfully!");
|
BukkitPlayerFunctions.sendMessage(plr, "&6Plots unlinked successfully!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean unlinkPlot(final World world, final Plot plot) {
|
public static boolean unlinkPlot(final World world, final Plot plot) {
|
||||||
final PlotId pos1 = PlayerFunctions.getBottomPlot(world, plot).id;
|
final PlotId pos1 = BukkitPlayerFunctions.getBottomPlot(world, plot).id;
|
||||||
final PlotId pos2 = PlayerFunctions.getTopPlot(world, plot).id;
|
final PlotId pos2 = BukkitPlayerFunctions.getTopPlot(world, plot).id;
|
||||||
final ArrayList<PlotId> ids = PlayerFunctions.getPlotSelectionIds(pos1, pos2);
|
final ArrayList<PlotId> ids = BukkitPlayerFunctions.getPlotSelectionIds(pos1, pos2);
|
||||||
final PlotUnlinkEvent event = new PlotUnlinkEvent(world, ids);
|
final PlotUnlinkEvent event = new PlotUnlinkEvent(world, ids);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
|
@ -25,7 +25,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.intellectualcrafters.plot.BukkitMain;
|
import com.intellectualcrafters.plot.BukkitMain;
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PWE;
|
import com.intellectualcrafters.plot.util.bukkit.PWE;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class WE_Anywhere extends SubCommand {
|
public class WE_Anywhere extends SubCommand {
|
||||||
public WE_Anywhere() {
|
public WE_Anywhere() {
|
||||||
@ -35,15 +35,15 @@ public class WE_Anywhere extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (PlotSquared.worldEdit == null) {
|
if (PlotSquared.worldEdit == null) {
|
||||||
PlayerFunctions.sendMessage(plr, "&cWorldEdit is not enabled on this server");
|
BukkitPlayerFunctions.sendMessage(plr, "&cWorldEdit is not enabled on this server");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (BukkitMain.hasPermission(plr, "plots.worldedit.bypass") && PWE.hasMask(plr)) {
|
if (BukkitMain.hasPermission(plr, "plots.worldedit.bypass") && PWE.hasMask(plr)) {
|
||||||
PWE.removeMask(plr);
|
PWE.removeMask(plr);
|
||||||
PlayerFunctions.sendMessage(plr, "&6Cleared your WorldEdit mask");
|
BukkitPlayerFunctions.sendMessage(plr, "&6Cleared your WorldEdit mask");
|
||||||
} else {
|
} else {
|
||||||
PWE.setMask(plr, plr.getLocation(), true);
|
PWE.setMask(plr, plr.getLocation(), true);
|
||||||
PlayerFunctions.sendMessage(plr, "&6Updated your WorldEdit mask");
|
BukkitPlayerFunctions.sendMessage(plr, "&6Updated your WorldEdit mask");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.flag.FlagManager;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.util.StringComparison;
|
import com.intellectualcrafters.plot.util.StringComparison;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,7 +65,7 @@ public class list extends SubCommand {
|
|||||||
} else {
|
} else {
|
||||||
builder.append(getArgumentList(new String[] { "all" }));
|
builder.append(getArgumentList(new String[] { "all" }));
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, builder.toString());
|
BukkitPlayerFunctions.sendMessage(plr, builder.toString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("forsale") && (plr != null)) {
|
if (args[0].equalsIgnoreCase("forsale") && (plr != null)) {
|
||||||
@ -83,11 +83,11 @@ public class list extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (idx == 0) {
|
if (idx == 0) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOTS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOTS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "Includes").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots"));
|
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "Includes").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots"));
|
||||||
PlayerFunctions.sendMessage(plr, string.toString());
|
BukkitPlayerFunctions.sendMessage(plr, string.toString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("mine") && (plr != null)) {
|
if (args[0].equalsIgnoreCase("mine") && (plr != null)) {
|
||||||
@ -99,11 +99,11 @@ public class list extends SubCommand {
|
|||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
if (idx == 0) {
|
if (idx == 0) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOTS);
|
BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOTS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "You have").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots"));
|
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "You have").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots"));
|
||||||
PlayerFunctions.sendMessage(plr, string.toString());
|
BukkitPlayerFunctions.sendMessage(plr, string.toString());
|
||||||
return true;
|
return true;
|
||||||
} else if (args[0].equalsIgnoreCase("shared") && (plr != null)) {
|
} else if (args[0].equalsIgnoreCase("shared") && (plr != null)) {
|
||||||
final StringBuilder string = new StringBuilder();
|
final StringBuilder string = new StringBuilder();
|
||||||
@ -114,7 +114,7 @@ public class list extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There are").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots"));
|
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There are").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots"));
|
||||||
PlayerFunctions.sendMessage(plr, string.toString());
|
BukkitPlayerFunctions.sendMessage(plr, string.toString());
|
||||||
return true;
|
return true;
|
||||||
} else if (args[0].equalsIgnoreCase("all")) {
|
} else if (args[0].equalsIgnoreCase("all")) {
|
||||||
// Current page
|
// Current page
|
||||||
@ -152,7 +152,7 @@ public class list extends SubCommand {
|
|||||||
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
|
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
|
||||||
}
|
}
|
||||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots"));
|
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots"));
|
||||||
PlayerFunctions.sendMessage(plr, string.toString());
|
BukkitPlayerFunctions.sendMessage(plr, string.toString());
|
||||||
return true;
|
return true;
|
||||||
} else if (args[0].equalsIgnoreCase("world") && (plr != null)) {
|
} else if (args[0].equalsIgnoreCase("world") && (plr != null)) {
|
||||||
final StringBuilder string = new StringBuilder();
|
final StringBuilder string = new StringBuilder();
|
||||||
@ -162,7 +162,7 @@ public class list extends SubCommand {
|
|||||||
string.append(C.PLOT_LIST_ITEM.s().replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
|
string.append(C.PLOT_LIST_ITEM.s().replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
|
||||||
}
|
}
|
||||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", plots.values().size() + "").replaceAll("%plot%", plots.values().size() == 1 ? "plot" : "plots"));
|
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", plots.values().size() + "").replaceAll("%plot%", plots.values().size() == 1 ? "plot" : "plots"));
|
||||||
PlayerFunctions.sendMessage(plr, string.toString());
|
BukkitPlayerFunctions.sendMessage(plr, string.toString());
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// execute(plr);
|
// execute(plr);
|
||||||
|
@ -31,7 +31,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class plugin extends SubCommand {
|
public class plugin extends SubCommand {
|
||||||
public static String downloads, version;
|
public static String downloads, version;
|
||||||
@ -103,7 +103,7 @@ public class plugin extends SubCommand {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
for (final String s : strings) {
|
for (final String s : strings) {
|
||||||
PlayerFunctions.sendMessage(plr, s);
|
BukkitPlayerFunctions.sendMessage(plr, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -12,7 +12,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.ChunkManager;
|
import com.intellectualcrafters.plot.util.bukkit.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A plot manager with a square grid layout, with square shaped plots
|
* A plot manager with a square grid layout, with square shaped plots
|
||||||
@ -109,38 +109,38 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
final boolean eastWest = (rx <= pathWidthLower) || (rx > end);
|
final boolean eastWest = (rx <= pathWidthLower) || (rx > end);
|
||||||
if (northSouth && eastWest) {
|
if (northSouth && eastWest) {
|
||||||
// This means you are in the intersection
|
// This means you are in the intersection
|
||||||
final PlotId id = PlayerFunctions.getPlotAbs(loc.add(dpw.ROAD_WIDTH, 0, dpw.ROAD_WIDTH));
|
final PlotId id = BukkitPlayerFunctions.getPlotAbs(loc.add(dpw.ROAD_WIDTH, 0, dpw.ROAD_WIDTH));
|
||||||
final Plot plot = PlotSquared.getPlots(loc.getWorld()).get(id);
|
final Plot plot = PlotSquared.getPlots(loc.getWorld()).get(id);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ((plot.settings.getMerged(0) && plot.settings.getMerged(3))) {
|
if ((plot.settings.getMerged(0) && plot.settings.getMerged(3))) {
|
||||||
return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
|
return BukkitPlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (northSouth) {
|
if (northSouth) {
|
||||||
// You are on a road running West to East (yeah, I named the var
|
// You are on a road running West to East (yeah, I named the var
|
||||||
// poorly)
|
// poorly)
|
||||||
final PlotId id = PlayerFunctions.getPlotAbs(loc.add(0, 0, dpw.ROAD_WIDTH));
|
final PlotId id = BukkitPlayerFunctions.getPlotAbs(loc.add(0, 0, dpw.ROAD_WIDTH));
|
||||||
final Plot plot = PlotSquared.getPlots(loc.getWorld()).get(id);
|
final Plot plot = PlotSquared.getPlots(loc.getWorld()).get(id);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (plot.settings.getMerged(0)) {
|
if (plot.settings.getMerged(0)) {
|
||||||
return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
|
return BukkitPlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (eastWest) {
|
if (eastWest) {
|
||||||
// This is the road separating an Eastern and Western plot
|
// This is the road separating an Eastern and Western plot
|
||||||
final PlotId id = PlayerFunctions.getPlotAbs(loc.add(dpw.ROAD_WIDTH, 0, 0));
|
final PlotId id = BukkitPlayerFunctions.getPlotAbs(loc.add(dpw.ROAD_WIDTH, 0, 0));
|
||||||
final Plot plot = PlotSquared.getPlots(loc.getWorld()).get(id);
|
final Plot plot = PlotSquared.getPlots(loc.getWorld()).get(id);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (plot.settings.getMerged(3)) {
|
if (plot.settings.getMerged(3)) {
|
||||||
return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
|
return BukkitPlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
|
return BukkitPlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +34,7 @@ import org.bukkit.util.Vector;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,7 +45,7 @@ public class ForceFieldListener implements Listener {
|
|||||||
final Set<Player> players = new HashSet<>();
|
final Set<Player> players = new HashSet<>();
|
||||||
Player oPlayer;
|
Player oPlayer;
|
||||||
for (final Entity entity : player.getNearbyEntities(5d, 5d, 5d)) {
|
for (final Entity entity : player.getNearbyEntities(5d, 5d, 5d)) {
|
||||||
if (!(entity instanceof Player) || ((oPlayer = (Player) entity) == null) || !PlayerFunctions.isInPlot(oPlayer) || !PlayerFunctions.getCurrentPlot(oPlayer).equals(plot)) {
|
if (!(entity instanceof Player) || ((oPlayer = (Player) entity) == null) || !BukkitPlayerFunctions.isInPlot(oPlayer) || !BukkitPlayerFunctions.getCurrentPlot(oPlayer).equals(plot)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
UUID uuid = UUIDHandler.getUUID(oPlayer);
|
UUID uuid = UUIDHandler.getUUID(oPlayer);
|
||||||
@ -59,7 +59,7 @@ public class ForceFieldListener implements Listener {
|
|||||||
private Player hasNearbyPermitted(final Player player, final Plot plot) {
|
private Player hasNearbyPermitted(final Player player, final Plot plot) {
|
||||||
Player oPlayer;
|
Player oPlayer;
|
||||||
for (final Entity entity : player.getNearbyEntities(5d, 5d, 5d)) {
|
for (final Entity entity : player.getNearbyEntities(5d, 5d, 5d)) {
|
||||||
if (!(entity instanceof Player) || ((oPlayer = (Player) entity) == null) || !PlayerFunctions.isInPlot(oPlayer) || !PlayerFunctions.getCurrentPlot(oPlayer).equals(plot)) {
|
if (!(entity instanceof Player) || ((oPlayer = (Player) entity) == null) || !BukkitPlayerFunctions.isInPlot(oPlayer) || !BukkitPlayerFunctions.getCurrentPlot(oPlayer).equals(plot)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
UUID uuid = UUIDHandler.getUUID(oPlayer);
|
UUID uuid = UUIDHandler.getUUID(oPlayer);
|
||||||
@ -96,10 +96,10 @@ public class ForceFieldListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlotEntry(final PlayerMoveEvent event) {
|
public void onPlotEntry(final PlayerMoveEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (!PlayerFunctions.isInPlot(player)) {
|
if (!BukkitPlayerFunctions.isInPlot(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(player);
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(player);
|
||||||
if ((FlagManager.getPlotFlag(plot, "forcefield") != null) && FlagManager.getPlotFlag(plot, "forcefield").getValue().equals("true")) {
|
if ((FlagManager.getPlotFlag(plot, "forcefield") != null) && FlagManager.getPlotFlag(plot, "forcefield").getValue().equals("true")) {
|
||||||
if (!PlotListener.booleanFlag(plot, "forcefield", false)) {
|
if (!PlotListener.booleanFlag(plot, "forcefield", false)) {
|
||||||
UUID uuid = UUIDHandler.getUUID(player);
|
UUID uuid = UUIDHandler.getUUID(player);
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.event.inventory.InventoryInteractEvent;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.InfoInventory;
|
import com.intellectualcrafters.plot.object.InfoInventory;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created 2014-11-18 for PlotSquared
|
* Created 2014-11-18 for PlotSquared
|
||||||
@ -36,7 +36,7 @@ public class InventoryListener implements Listener {
|
|||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
PlayerFunctions.sendMessage(player, "This is not implemented yet");
|
BukkitPlayerFunctions.sendMessage(player, "This is not implemented yet");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -102,7 +102,7 @@ import com.intellectualcrafters.plot.object.StringWrapper;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -154,7 +154,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
}
|
}
|
||||||
if (Settings.TELEPORT_ON_LOGIN) {
|
if (Settings.TELEPORT_ON_LOGIN) {
|
||||||
BukkitUtil.teleportPlayer(player, MainUtil.getPlotHomeDefault(plot));
|
BukkitUtil.teleportPlayer(player, MainUtil.getPlotHomeDefault(plot));
|
||||||
PlayerFunctions.sendMessage(event.getPlayer(), C.TELEPORTED_TO_ROAD);
|
BukkitPlayerFunctions.sendMessage(event.getPlayer(), C.TELEPORTED_TO_ROAD);
|
||||||
}
|
}
|
||||||
plotEntry(player, plot);
|
plotEntry(player, plot);
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
if (passed) {
|
if (passed) {
|
||||||
PlayerFunctions.sendMessage(player, C.BORDER);
|
BukkitPlayerFunctions.sendMessage(player, C.BORDER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final UUID uuid = UUIDHandler.getUUID(player);
|
final UUID uuid = UUIDHandler.getUUID(player);
|
||||||
if (plot.isDenied(uuid)) {
|
if (plot.isDenied(uuid)) {
|
||||||
if (!BukkitMain.hasPermission(player, "plots.admin.entry.denied")) {
|
if (!BukkitMain.hasPermission(player, "plots.admin.entry.denied")) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.entry.denied");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.entry.denied");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (BukkitMain.hasPermission(player, "plots.admin.destroy.unowned")) {
|
if (BukkitMain.hasPermission(player, "plots.admin.destroy.unowned")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.unowned");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.unowned");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -277,7 +277,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (BukkitMain.hasPermission(event.getPlayer(), "plots.admin.destroy.other")) {
|
if (BukkitMain.hasPermission(event.getPlayer(), "plots.admin.destroy.other")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.other");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.other");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -287,7 +287,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isPlotArea(loc)) {
|
if (isPlotArea(loc)) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.road");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.road");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Location loc = BukkitUtil.getLocation(b.getLocation());
|
final Location loc = BukkitUtil.getLocation(b.getLocation());
|
||||||
if (!isInPlot(loc)) {
|
if (!isInPlot(loc)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.build.road")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.build.road")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Plot plot = getCurrentPlot(loc);
|
final Plot plot = getCurrentPlot(loc);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.build.unowned")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.build.unowned")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -361,7 +361,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (!plot.isAdded(uuid)) {
|
if (!plot.isAdded(uuid)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) {
|
||||||
if (isPlotArea(loc)) {
|
if (isPlotArea(loc)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -527,7 +527,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (BukkitMain.hasPermission(player, "plots.admin.interact.unowned")) {
|
if (BukkitMain.hasPermission(player, "plots.admin.interact.unowned")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -540,7 +540,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (BukkitMain.hasPermission(player, "plots.admin.interact.other")) {
|
if (BukkitMain.hasPermission(player, "plots.admin.interact.other")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.other");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.other");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -550,7 +550,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isPlotArea(loc)) {
|
if (isPlotArea(loc)) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.road");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.road");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -634,7 +634,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
if (!isInPlot(loc)) {
|
if (!isInPlot(loc)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.build.road")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.build.road")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -642,7 +642,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Plot plot = getCurrentPlot(loc);
|
final Plot plot = getCurrentPlot(loc);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.build.unowned")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.build.unowned")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -650,7 +650,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
UUID uuid = UUIDHandler.getUUID(p);
|
UUID uuid = UUIDHandler.getUUID(p);
|
||||||
if (!plot.isAdded(uuid)) if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) {
|
if (!plot.isAdded(uuid)) if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) {
|
||||||
if (isPlotArea(loc)) {
|
if (isPlotArea(loc)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -669,7 +669,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Plot plot = getCurrentPlot(q);
|
final Plot plot = getCurrentPlot(q);
|
||||||
|
|
||||||
if (plot.isDenied(event.getPlayer())) {
|
if (plot.isDenied(event.getPlayer())) {
|
||||||
PlayerFunctions.sendMessage(event.getPlayer(), C.YOU_BE_DENIED);
|
BukkitPlayerFunctions.sendMessage(event.getPlayer(), C.YOU_BE_DENIED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -701,7 +701,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (BukkitMain.hasPermission(p, "plots.admin.build.road")) {
|
if (BukkitMain.hasPermission(p, "plots.admin.build.road")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -710,7 +710,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (BukkitMain.hasPermission(p, "plots.admin.build.unowned")) {
|
if (BukkitMain.hasPermission(p, "plots.admin.build.unowned")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
} else if (!plot.isAdded(e.getPlayer())) {
|
} else if (!plot.isAdded(e.getPlayer())) {
|
||||||
@ -722,7 +722,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isPlotArea(loc)) {
|
if (isPlotArea(loc)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -766,7 +766,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (BukkitMain.hasPermission(p, "plots.admin.build.road")) {
|
if (BukkitMain.hasPermission(p, "plots.admin.build.road")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -775,7 +775,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (BukkitMain.hasPermission(p, "plots.admin.build.unowned")) {
|
if (BukkitMain.hasPermission(p, "plots.admin.build.unowned")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
} else if (!plot.isAdded(e.getPlayer())) {
|
} else if (!plot.isAdded(e.getPlayer())) {
|
||||||
@ -788,7 +788,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isPlotArea(loc)) {
|
if (isPlotArea(loc)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -805,7 +805,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
if (!isInPlot(loc)) {
|
if (!isInPlot(loc)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.build.road")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.build.road")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -813,7 +813,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Plot plot = getCurrentPlot(loc);
|
final Plot plot = getCurrentPlot(loc);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.build.unowned")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.build.unowned")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -823,7 +823,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) {
|
||||||
if (isPlotArea(loc)) {
|
if (isPlotArea(loc)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -842,7 +842,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (isPlotWorld(l)) {
|
if (isPlotWorld(l)) {
|
||||||
if (!isInPlot(l)) {
|
if (!isInPlot(l)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.destroy.road")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.destroy.road")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.road");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.road");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -850,7 +850,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Plot plot = getCurrentPlot(l);
|
final Plot plot = getCurrentPlot(l);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.destroy.unowned")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.destroy.unowned")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.unowned");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.unowned");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -860,7 +860,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.destroy.other")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.destroy.other")) {
|
||||||
if (isPlotArea(l)) {
|
if (isPlotArea(l)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.other");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.destroy.other");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -878,7 +878,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
if (!isInPlot(l)) {
|
if (!isInPlot(l)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.interact.road")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.interact.road")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.road");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.road");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -886,7 +886,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Plot plot = getCurrentPlot(l);
|
final Plot plot = getCurrentPlot(l);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.interact.unowned")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.interact.unowned")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -906,7 +906,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.interact.other")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.interact.other")) {
|
||||||
if (isPlotArea(l)) {
|
if (isPlotArea(l)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -926,7 +926,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final PlotWorld pW = getPlotWorld(l.getWorld());
|
final PlotWorld pW = getPlotWorld(l.getWorld());
|
||||||
if (!isInPlot(l)) {
|
if (!isInPlot(l)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.vehicle.break.road")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.vehicle.break.road")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.road");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.road");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -934,7 +934,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Plot plot = getCurrentPlot(l);
|
final Plot plot = getCurrentPlot(l);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.vehicle.break.unowned")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.vehicle.break.unowned")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.unowned");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.unowned");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -946,7 +946,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.vehicle.break.other")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.vehicle.break.other")) {
|
||||||
if (isPlotArea(l)) {
|
if (isPlotArea(l)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.other");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.vehicle.break.other");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -981,7 +981,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
}
|
}
|
||||||
if (!isInPlot(l)) {
|
if (!isInPlot(l)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.pve.road")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.pve.road")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.road");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.road");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -989,7 +989,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Plot plot = getCurrentPlot(l);
|
final Plot plot = getCurrentPlot(l);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.pve.unowned")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.pve.unowned")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.unowned");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.unowned");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1013,7 +1013,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.pve.other")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.pve.other")) {
|
||||||
if (isPlotArea(l)) {
|
if (isPlotArea(l)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.other");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.pve.other");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1034,7 +1034,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
if (!isInPlot(l)) {
|
if (!isInPlot(l)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.projectile.road")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.projectile.road")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.road");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.road");
|
||||||
e.setHatching(false);
|
e.setHatching(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1042,14 +1042,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Plot plot = getCurrentPlot(l);
|
final Plot plot = getCurrentPlot(l);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.projectile.unowned")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.projectile.unowned")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.unowned");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.unowned");
|
||||||
e.setHatching(false);
|
e.setHatching(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(p)) {
|
} else if (!plot.isAdded(p)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.projectile.other")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.projectile.other")) {
|
||||||
if (isPlotArea(l)) {
|
if (isPlotArea(l)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.other");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.projectile.other");
|
||||||
e.setHatching(false);
|
e.setHatching(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1077,7 +1077,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (BukkitMain.hasPermission(player, "plots.admin.build.unowned")) {
|
if (BukkitMain.hasPermission(player, "plots.admin.build.unowned")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.unowned");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1088,7 +1088,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(player, "plots.admin.build.other")) {
|
if (!BukkitMain.hasPermission(player, "plots.admin.build.other")) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.other");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.other");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1097,7 +1097,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
}
|
}
|
||||||
if (!BukkitMain.hasPermission(player, "plots.admin.build.road")) {
|
if (!BukkitMain.hasPermission(player, "plots.admin.build.road")) {
|
||||||
if (isPlotArea(loc)) {
|
if (isPlotArea(loc)) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.road");
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.road");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import com.intellectualcrafters.plot.object.Location;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||||
@ -25,14 +25,14 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
|||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
if (!isInPlot(l)) {
|
if (!isInPlot(l)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.interact.road")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.interact.road")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.road");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.road");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final Plot plot = MainUtil.getPlot(l);
|
final Plot plot = MainUtil.getPlot(l);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.interact.unowned")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.interact.unowned")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -40,7 +40,7 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
|||||||
if (!plot.isAdded(uuid)) {
|
if (!plot.isAdded(uuid)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.interact.other")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.interact.other")) {
|
||||||
if (isPlotArea(l)) {
|
if (isPlotArea(l)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other");
|
BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ import com.intellectualcrafters.plot.flag.FlagManager;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,12 +108,12 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
final Plot plot = MainUtil.getPlot(BukkitUtil.getLocation(player));
|
final Plot plot = MainUtil.getPlot(BukkitUtil.getLocation(player));
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UUID uuid = UUIDHandler.getUUID(player);
|
UUID uuid = UUIDHandler.getUUID(player);
|
||||||
if (!plot.isAdded(uuid)) {
|
if (!plot.isAdded(uuid)) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PLOT_PERMS);
|
BukkitPlayerFunctions.sendMessage(player, C.NO_PLOT_PERMS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Set<Player> plotPlayers = new HashSet<>();
|
final Set<Player> plotPlayers = new HashSet<>();
|
||||||
@ -135,7 +135,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
for (final Player p : plotPlayers) {
|
for (final Player p : plotPlayers) {
|
||||||
p.playEffect(p.getLocation(), Effect.RECORD_PLAY, meta.getMaterial());
|
p.playEffect(p.getLocation(), Effect.RECORD_PLAY, meta.getMaterial());
|
||||||
PlayerFunctions.sendMessage(p, C.RECORD_PLAY.s().replaceAll("%player", player.getName()).replaceAll("%name", meta.toString()));
|
BukkitPlayerFunctions.sendMessage(p, C.RECORD_PLAY.s().replaceAll("%player", player.getName()).replaceAll("%name", meta.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOTIFY_ENTER.s().replace("%player", trespasser.getName()).replace("%plot", plot.getId().toString()));
|
BukkitPlayerFunctions.sendMessage(player, C.NOTIFY_ENTER.s().replace("%player", trespasser.getName()).replace("%plot", plot.getId().toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
PlayerFunctions.sendMessage(player, C.NOTIFY_LEAVE.s().replace("%player", trespasser.getName()).replace("%plot", plot.getId().toString()));
|
BukkitPlayerFunctions.sendMessage(player, C.NOTIFY_LEAVE.s().replace("%player", trespasser.getName()).replace("%plot", plot.getId().toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PWE;
|
import com.intellectualcrafters.plot.util.bukkit.PWE;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
@ -149,16 +149,16 @@ public class WorldEditListener implements Listener {
|
|||||||
final LocalSession session = PlotSquared.worldEdit.getSession(p);
|
final LocalSession session = PlotSquared.worldEdit.getSession(p);
|
||||||
final Mask mask = session.getMask();
|
final Mask mask = session.getMask();
|
||||||
if (mask == null) {
|
if (mask == null) {
|
||||||
PlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Both points");
|
BukkitPlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Both points");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!mask.test(pos1)) {
|
if (!mask.test(pos1)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
PlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Position 1");
|
BukkitPlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Position 1");
|
||||||
}
|
}
|
||||||
if (!mask.test(pos2)) {
|
if (!mask.test(pos2)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
PlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Position 2");
|
BukkitPlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Position 2");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.SetBlockManager;
|
import com.intellectualcrafters.plot.util.bukkit.SetBlockManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import com.intellectualcrafters.plot.object.BukkitPlayer;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class ExpireManager {
|
public class ExpireManager {
|
||||||
|
@ -43,7 +43,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
|||||||
import com.intellectualcrafters.plot.object.PlotSettings;
|
import com.intellectualcrafters.plot.object.PlotSettings;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.SendChunk;
|
import com.intellectualcrafters.plot.util.bukkit.SendChunk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,191 @@
|
|||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// PlotSquared - A plot manager and world generator for the Bukkit API /
|
||||||
|
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
|
||||||
|
// /
|
||||||
|
// This program is free software; you can redistribute it and/or modify /
|
||||||
|
// it under the terms of the GNU General Public License as published by /
|
||||||
|
// the Free Software Foundation; either version 3 of the License, or /
|
||||||
|
// (at your option) any later version. /
|
||||||
|
// /
|
||||||
|
// This program is distributed in the hope that it will be useful, /
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
|
||||||
|
// GNU General Public License for more details. /
|
||||||
|
// /
|
||||||
|
// You should have received a copy of the GNU General Public License /
|
||||||
|
// along with this program; if not, write to the Free Software Foundation, /
|
||||||
|
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
|
||||||
|
// /
|
||||||
|
// You can contact us via: support@intellectualsites.com /
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
package com.intellectualcrafters.plot.util.bukkit;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.BukkitMain;
|
||||||
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
|
import com.intellectualcrafters.plot.object.BukkitPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
|
|
||||||
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.ChatPaginator;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Functions involving players, plots and locations.
|
||||||
|
*/
|
||||||
|
public class BukkitPlayerFunctions {
|
||||||
|
/**
|
||||||
|
* Clear a plot. Use null player if no player is present
|
||||||
|
* @param player
|
||||||
|
* @param world
|
||||||
|
* @param plot
|
||||||
|
* @param isDelete
|
||||||
|
*/
|
||||||
|
public static void clear(final Player player, final String world, final Plot plot, final boolean isDelete) {
|
||||||
|
final long start = System.currentTimeMillis();
|
||||||
|
Runnable whenDone = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if ((player != null) && player.isOnline()) {
|
||||||
|
MainUtil.sendMessage(new BukkitPlayer(player), C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (!MainUtil.clearAsPlayer(plot, isDelete, whenDone)) {
|
||||||
|
MainUtil.sendMessage(null, C.WAIT_FOR_TIMER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merges all plots in the arraylist (with cost)
|
||||||
|
*
|
||||||
|
* @param plr
|
||||||
|
* @param world
|
||||||
|
* @param plotIds
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean mergePlots(final Player plr, final String world, final ArrayList<PlotId> plotIds) {
|
||||||
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||||
|
if ((PlotSquared.economy != null) && plotworld.USE_ECONOMY) {
|
||||||
|
final double cost = plotIds.size() * plotworld.MERGE_PRICE;
|
||||||
|
if (cost > 0d) {
|
||||||
|
final Economy economy = PlotSquared.economy;
|
||||||
|
if (economy.getBalance(plr) < cost) {
|
||||||
|
MainUtil.sendMessage(new BukkitPlayer(plr), C.CANNOT_AFFORD_MERGE, "" + cost);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
economy.withdrawPlayer(plr, cost);
|
||||||
|
MainUtil.sendMessage(new BukkitPlayer(plr), C.REMOVED_BALANCE, cost + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MainUtil.mergePlots(world, plotIds, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPlayerName(final UUID uuid) {
|
||||||
|
if (uuid == null) {
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
final OfflinePlayer plr = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
||||||
|
if (!plr.hasPlayedBefore()) {
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
return plr.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param player player
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isInPlot(final Player player) {
|
||||||
|
return getCurrentPlot(player) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<PlotId> getMaxPlotSelectionIds(final String world, PlotId pos1, PlotId pos2) {
|
||||||
|
final Plot plot1 = PlotSquared.getPlots(world).get(pos1);
|
||||||
|
final Plot plot2 = PlotSquared.getPlots(world).get(pos2);
|
||||||
|
if (plot1 != null) {
|
||||||
|
pos1 = MainUtil.getBottomPlot(plot1).id;
|
||||||
|
}
|
||||||
|
if (plot2 != null) {
|
||||||
|
pos2 = MainUtil.getTopPlot(world, plot2).id;
|
||||||
|
}
|
||||||
|
final ArrayList<PlotId> myplots = new ArrayList<>();
|
||||||
|
for (int x = pos1.x; x <= pos2.x; x++) {
|
||||||
|
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||||
|
myplots.add(new PlotId(x, y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return myplots;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the plot a player is currently in.
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Plot getCurrentPlot(final Player player) {
|
||||||
|
if (!PlotSquared.isPlotWorld(player.getWorld().getName())) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final PlotId id = MainUtil.getPlotId(BukkitUtil.getLocation(player));
|
||||||
|
final String world = player.getWorld().getName();
|
||||||
|
if (id == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (PlotSquared.getPlots(world).containsKey(id)) {
|
||||||
|
return PlotSquared.getPlots(world).get(id);
|
||||||
|
}
|
||||||
|
return new Plot(id, null, new ArrayList<UUID>(), new ArrayList<UUID>(), world);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plots for a player
|
||||||
|
*
|
||||||
|
* @param plr
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Set<Plot> getPlayerPlots(final String world, final Player plr) {
|
||||||
|
final Set<Plot> p = PlotSquared.getPlots(world, plr.getName());
|
||||||
|
if (p == null) {
|
||||||
|
return new HashSet<>();
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of plots for a player
|
||||||
|
*
|
||||||
|
* @param plr
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int getPlayerPlotCount(final String world, final Player plr) {
|
||||||
|
final UUID uuid = UUIDHandler.getUUID(plr);
|
||||||
|
int count = 0;
|
||||||
|
for (final Plot plot : PlotSquared.getPlots(world).values()) {
|
||||||
|
if (plot.hasOwner() && plot.owner.equals(uuid) && plot.countsTowardsMax) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user