From afd0218f408bcebbcef4257bb956370cc203dc7c Mon Sep 17 00:00:00 2001 From: boy0001 Date: Fri, 20 Feb 2015 22:24:58 +1100 Subject: [PATCH] . --- .../intellectualcrafters/plot/BukkitMain.java | 2 +- .../plot/commands/Auto.java | 24 +-- .../plot/commands/Ban.java | 8 +- .../plot/commands/Buy.java | 12 +- .../plot/commands/Claim.java | 10 +- .../plot/commands/Clear.java | 8 +- .../plot/commands/Clipboard.java | 4 +- .../plot/commands/Cluster.java | 160 +++++++-------- .../plot/commands/Comment.java | 6 +- .../plot/commands/Condense.java | 48 ++--- .../plot/commands/Copy.java | 12 +- .../plot/commands/CreateRoadSchematic.java | 10 +- .../plot/commands/DEOP.java | 8 +- .../plot/commands/Database.java | 6 +- .../plot/commands/Debug.java | 6 +- .../plot/commands/DebugClaimTest.java | 30 +-- .../plot/commands/DebugClear.java | 14 +- .../plot/commands/DebugExec.java | 52 ++--- .../plot/commands/DebugFixFlags.java | 12 +- .../plot/commands/DebugLoadTest.java | 4 +- .../plot/commands/DebugRoadRegen.java | 4 +- .../plot/commands/DebugSaveTest.java | 4 +- .../plot/commands/Delete.java | 10 +- .../plot/commands/Denied.java | 34 ++-- .../plot/commands/FlagCmd.java | 76 +++---- .../plot/commands/Helpers.java | 30 +-- .../plot/commands/Home.java | 10 +- .../plot/commands/Inbox.java | 34 ++-- .../plot/commands/Info.java | 30 +-- .../plot/commands/Kick.java | 18 +- .../plot/commands/MainCommand.java | 14 +- .../plot/commands/Merge.java | 48 ++--- .../plot/commands/Move.java | 14 +- .../plot/commands/MusicSubcommand.java | 6 +- .../plot/commands/OP.java | 8 +- .../plot/commands/Paste.java | 14 +- .../plot/commands/Purge.java | 32 +-- .../plot/commands/Rate.java | 6 +- .../plot/commands/Reload.java | 4 +- .../plot/commands/Schematic.java | 52 ++--- .../plot/commands/Set.java | 62 +++--- .../plot/commands/SetOwner.java | 20 +- .../plot/commands/Setup.java | 22 +- .../plot/commands/SubCommand.java | 6 +- .../plot/commands/Swap.java | 28 +-- .../plot/commands/TP.java | 8 +- .../plot/commands/Target.java | 10 +- .../plot/commands/Template.java | 10 +- .../plot/commands/Trim.java | 16 +- .../plot/commands/Trusted.java | 30 +-- .../plot/commands/Unban.java | 8 +- .../plot/commands/Unclaim.java | 12 +- .../plot/commands/Unlink.java | 18 +- .../plot/commands/WE_Anywhere.java | 8 +- .../plot/commands/list.java | 18 +- .../plot/commands/plugin.java | 4 +- .../plot/generator/SquarePlotManager.java | 16 +- .../plot/listeners/ForceFieldListener.java | 10 +- .../plot/listeners/InventoryListener.java | 4 +- .../plot/listeners/PlayerEvents.java | 88 ++++---- .../plot/listeners/PlayerEvents_1_8.java | 8 +- .../plot/listeners/PlotPlusListener.java | 12 +- .../plot/listeners/WorldEditListener.java | 8 +- .../plot/util/ClusterManager.java | 2 +- .../plot/util/ExpireManager.java | 2 +- .../plot/util/MainUtil.java | 2 +- .../util/bukkit/BukkitPlayerFunctions.java | 191 ++++++++++++++++++ 67 files changed, 849 insertions(+), 658 deletions(-) create mode 100644 PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java index 74228ddac..9a218daab 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java @@ -76,7 +76,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { if (Settings.USE_PLOTME_ALIAS) { player.performCommand(message.replace("/plotme", "plots")); } else { - PlayerFunctions.sendMessage(player, C.NOT_USING_PLOTME); + BukkitPlayerFunctions.sendMessage(player, C.NOT_USING_PLOTME); } event.setCancelled(true); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index 415994b05..1e3912f18 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -38,7 +38,7 @@ import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.MainUtil; 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 Auto() { @@ -87,7 +87,7 @@ public class Auto extends SubCommand { if (PlotSquared.isPlotWorld(plr.getWorld().getName())) { world = plr.getWorld(); } else { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD); return false; } } @@ -98,10 +98,10 @@ public class Auto extends SubCommand { size_x = Integer.parseInt(split[0]); size_z = Integer.parseInt(split[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)) { - PlayerFunctions.sendMessage(plr, "&cError: size>4"); + BukkitPlayerFunctions.sendMessage(plr, "&cError: size>4"); } if (args.length > 1) { schematic = args[1]; @@ -121,15 +121,15 @@ public class Auto extends SubCommand { } } if ((size_x * size_z) > Settings.MAX_AUTO_SIZE) { - 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; } - 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 < 0) { - PlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, (-diff) + ""); + BukkitPlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, (-diff) + ""); } else { - PlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); + BukkitPlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); } return false; } @@ -154,7 +154,7 @@ public class Auto extends SubCommand { return true; } 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; } // } @@ -170,7 +170,7 @@ public class Auto extends SubCommand { final PlotCluster cluster = ClusterManager.getCluster(loc); // Must be standing in a cluster if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); return false; } final PlotId bot = cluster.getP1(); @@ -190,7 +190,7 @@ public class Auto extends SubCommand { id = getNextPlot(id, 1); } // no free plots - PlayerFunctions.sendMessage(plr, C.NO_FREE_PLOTS); + BukkitPlayerFunctions.sendMessage(plr, C.NO_FREE_PLOTS); return false; } boolean br = false; @@ -225,7 +225,7 @@ public class Auto extends SubCommand { 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; } br = true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Ban.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Ban.java index 31c43dcef..b8ea0de8c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Ban.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Ban.java @@ -4,7 +4,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.config.C; 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 @@ -19,12 +19,12 @@ public class Ban extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { 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); } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if (!plot.hasRights(plr)) { return sendMessage(plr, C.NO_PLOT_PERMS); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java index 4a1410b8b..a757c88b1 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java @@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotWorld; 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; /** @@ -64,12 +64,12 @@ public class Buy extends SubCommand { return sendMessage(plr, C.NOT_VALID_PLOT_ID); } } else { - plot = PlayerFunctions.getCurrentPlot(plr); + plot = BukkitPlayerFunctions.getCurrentPlot(plr); } if (plot == null) { 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); } if (!plot.hasOwner()) { @@ -85,8 +85,8 @@ public class Buy extends SubCommand { double initPrice = (double) flag.getValue(); double price = initPrice; final PlotId id = plot.id; - final PlotId id2 = PlayerFunctions.getTopPlot(world, plot).id; - final int size = PlayerFunctions.getPlotSelectionIds(id, id2).size(); + final PlotId id2 = BukkitPlayerFunctions.getTopPlot(world, plot).id; + final int size = BukkitPlayerFunctions.getPlotSelectionIds(id, id2).size(); final PlotWorld plotworld = PlotSquared.getPlotWorld(world); if (plotworld.USE_ECONOMY) { price += plotworld.PLOT_PRICE * size; @@ -108,7 +108,7 @@ public class Buy extends SubCommand { } plot.owner = UUIDHandler.getUUID(plr); DBFunc.setOwner(plot, plot.owner); - PlayerFunctions.sendMessage(plr, C.CLAIMED); + BukkitPlayerFunctions.sendMessage(plr, C.CLAIMED); return true; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index b4aa672bf..32a7f2435 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.SchematicHandler; -import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions; +import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions; /** * @author Citymonstret @@ -57,7 +57,7 @@ public class Claim extends SubCommand { if (!event.isCancelled()) { MainUtil.createPlot(player, plot); MainUtil.setSign(player, plot); - PlayerFunctions.sendMessage(player, C.CLAIMED); + BukkitPlayerFunctions.sendMessage(player, C.CLAIMED); if (teleport) { PlotSquared.teleportPlayer(player, BukkitUtil.getLocation(entity), plot); } @@ -88,13 +88,13 @@ public class Claim extends SubCommand { if (args.length >= 1) { schematic = args[0]; } - if (!PlayerFunctions.isInPlot(plr)) { + if (!BukkitPlayerFunctions.isInPlot(plr)) { 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); } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if (plot.hasOwner()) { return sendMessage(plr, C.PLOT_IS_CLAIMED); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java index 56515a7ec..ef54fc659 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; 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; public class Clear extends SubCommand { @@ -64,11 +64,11 @@ public class Clear extends SubCommand { } return true; } - if (!PlayerFunctions.isInPlot(plr)) { + if (!BukkitPlayerFunctions.isInPlot(plr)) { return sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); - if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { return sendMessage(plr, C.UNLINK_REQUIRED); } if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.clear")) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clipboard.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clipboard.java index 5b25afe0c..4cb00e79b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clipboard.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clipboard.java @@ -24,7 +24,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.config.C; 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 Clipboard() { @@ -42,7 +42,7 @@ public class Clipboard extends SubCommand { final int total = selection.getBlocks().length; String message = C.CLIPBOARD_INFO.s(); message = message.replace("%id", plotId.toString()).replace("%width", width + "").replace("%total", total + ""); - PlayerFunctions.sendMessage(plr, message); + BukkitPlayerFunctions.sendMessage(plr, message); return true; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java index 6a3bed257..4fbedab0c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java @@ -42,7 +42,7 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.ClusterManager; 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; public class Cluster extends SubCommand { @@ -55,7 +55,7 @@ public class Cluster extends SubCommand { // list, create, delete, resize, invite, kick, leave, helpers, tp, sethome if (args.length == 0) { // return arguments - PlayerFunctions.sendMessage(plr, C.CLUSTER_AVAILABLE_ARGS); + BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_AVAILABLE_ARGS); return false; } final String sub = args[0].toLowerCase(); @@ -63,26 +63,26 @@ public class Cluster extends SubCommand { case "l": case "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; } if (args.length != 1) { - PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster list"); + BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster list"); return false; } final HashSet 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) { // Ignore unmanaged clusters final String name = "'" + cluster.getName() + "' : " + cluster.toString(); 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))) { - 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))) { - PlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&9" + name); + BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&9" + name); } else { - PlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, cluster.toString()); + BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, cluster.toString()); } } return true; @@ -90,27 +90,27 @@ public class Cluster extends SubCommand { case "c": case "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; } if (args.length != 4) { final PlotId id = ClusterManager.estimatePlotId(plr.getLocation()); - PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster create "); - PlayerFunctions.sendMessage(plr, C.CLUSTER_CURRENT_PLOTID, "" + id); + BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster create "); + BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_CURRENT_PLOTID, "" + id); return false; } // check pos1 / pos2 final PlotId pos1 = MainUtil.parseId(args[2]); final PlotId pos2 = MainUtil.parseId(args[3]); if ((pos1 == null) || (pos2 == null)) { - PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); return false; } // check if name is taken final String name = args[1]; for (final PlotCluster cluster : ClusterManager.getClusters(plr.getWorld())) { if (name.equals(cluster.getName())) { - PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN); + BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN); return false; } } @@ -118,7 +118,7 @@ public class Cluster extends SubCommand { final PlotClusterId id = new PlotClusterId(pos1, pos2); final HashSet intersects = ClusterManager.getIntersects(plr.getWorld().getName(), id); 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; } // create cluster @@ -142,37 +142,37 @@ public class Cluster extends SubCommand { PlotSquared.config.createSection("worlds." + world); PlotSquared.loadWorld(plr.getWorld()); } - PlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_ADDED); return true; } case "disband": case "del": case "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; } 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; } PlotCluster cluster; if (args.length == 2) { cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); return false; } } else { cluster = ClusterManager.getCluster(plr.getLocation()); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); return false; } } if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) { 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; } } @@ -205,35 +205,35 @@ public class Cluster extends SubCommand { ClusterManager.last = null; ClusterManager.clusters.get(cluster.world).remove(cluster); ClusterManager.regenCluster(cluster); - PlayerFunctions.sendMessage(plr, C.CLUSTER_DELETED); + BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_DELETED); return true; } case "res": case "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; } if (args.length != 3) { - PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster resize "); + BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster resize "); return false; } // check pos1 / pos2 final PlotId pos1 = MainUtil.parseId(args[1]); final PlotId pos2 = MainUtil.parseId(args[2]); if ((pos1 == null) || (pos2 == null)) { - PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); return false; } // check if in cluster final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation()); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); return false; } if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) { 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; } } @@ -241,76 +241,76 @@ public class Cluster extends SubCommand { final PlotClusterId id = new PlotClusterId(pos1, pos2); final HashSet intersects = ClusterManager.getIntersects(plr.getWorld().getName(), id); if (intersects.size() > 1) { - PlayerFunctions.sendMessage(plr, C.CLUSTER_INTERSECTION, (intersects.size() - 1) + ""); + BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_INTERSECTION, (intersects.size() - 1) + ""); return false; } // resize cluster DBFunc.resizeCluster(cluster, id); - PlayerFunctions.sendMessage(plr, C.CLUSTER_RESIZED); + BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_RESIZED); return true; } case "reg": case "regenerate": case "regen": { 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; } 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; } PlotCluster cluster; if (args.length == 2) { cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); return false; } } else { cluster = ClusterManager.getCluster(plr.getLocation()); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); return false; } } if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) { 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; } } ClusterManager.regenCluster(cluster); - PlayerFunctions.sendMessage(plr, C.CLUSTER_REGENERATED); + BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_REGENERATED); return true; } case "add": case "inv": case "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; } if (args.length != 2) { - PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster invite "); + BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster invite "); return false; } // check if in cluster final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation()); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); return false; } if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) { 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; } } // check uuid final UUID uuid = UUIDHandler.getUUID(args[1]); if (uuid == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); return false; } if (!cluster.hasRights(uuid)) { @@ -320,43 +320,43 @@ public class Cluster extends SubCommand { DBFunc.setInvited(world, cluster, uuid); final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid); 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; } case "k": case "remove": case "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; } if (args.length != 2) { - PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster kick "); + BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster kick "); return false; } final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation()); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); return false; } if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) { 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; } } // check uuid final UUID uuid = UUIDHandler.getUUID(args[1]); if (uuid == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); return false; } // Can't kick if the player is yourself, the owner, or not added to the cluster if (uuid.equals(UUIDHandler.getUUID(plr)) || uuid.equals(cluster.owner) || !cluster.hasRights(uuid)) { - PlayerFunctions.sendMessage(plr, C.CANNOT_KICK_PLAYER, cluster.getName()); + BukkitPlayerFunctions.sendMessage(plr, C.CANNOT_KICK_PLAYER, cluster.getName()); return false; } if (cluster.helpers.contains(uuid)) { @@ -367,7 +367,7 @@ public class Cluster extends SubCommand { DBFunc.removeInvited(cluster, uuid); final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid); 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)) { final PlotCluster current = ClusterManager.getCluster(plot); @@ -376,40 +376,40 @@ public class Cluster extends SubCommand { DBFunc.delete(world, plot); } } - PlayerFunctions.sendMessage(plr, C.CLUSTER_KICKED_USER); + BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_KICKED_USER); return true; } case "quit": case "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; } 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; } PlotCluster cluster; if (args.length == 2) { cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); return false; } } else { cluster = ClusterManager.getCluster(plr.getLocation()); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); return false; } } final UUID uuid = UUIDHandler.getUUID(plr); if (!cluster.hasRights(uuid)) { - PlayerFunctions.sendMessage(plr, C.CLUSTER_NOT_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_NOT_ADDED); return false; } if (uuid.equals(cluster.owner)) { - PlayerFunctions.sendMessage(plr, C.CLUSTER_CANNOT_LEAVE); + BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_CANNOT_LEAVE); return false; } if (cluster.helpers.contains(uuid)) { @@ -418,7 +418,7 @@ public class Cluster extends SubCommand { } cluster.invited.remove(uuid); DBFunc.removeInvited(cluster, uuid); - 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)) { final PlotCluster current = ClusterManager.getCluster(plot); if ((current != null) && current.equals(cluster)) { @@ -432,83 +432,83 @@ public class Cluster extends SubCommand { case "helper": case "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; } if (args.length != 3) { - PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers "); + BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers "); return false; } final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation()); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); return false; } final UUID uuid = UUIDHandler.getUUID(args[2]); if (uuid == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); return false; } if (args[1].toLowerCase().equals("add")) { 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")) { 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 "); + BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers "); return false; } case "spawn": case "home": case "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; } if (args.length != 2) { - PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster tp "); + BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster tp "); return false; } final PlotCluster cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); return false; } final UUID uuid = UUIDHandler.getUUID(plr); if (!cluster.hasRights(uuid)) { if (!BukkitMain.hasPermission(plr, "plots.cluster.tp.other")) { - PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp.other"); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp.other"); return false; } } plr.teleport(ClusterManager.getHome(cluster)); - return PlayerFunctions.sendMessage(plr, C.CLUSTER_TELEPORTING); + return BukkitPlayerFunctions.sendMessage(plr, C.CLUSTER_TELEPORTING); } case "i": case "info": case "show": case "information": { 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; } 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; } PlotCluster cluster; if (args.length == 2) { cluster = ClusterManager.getCluster(plr.getWorld().getName(), args[1]); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_CLUSTER, args[1]); return false; } } else { cluster = ClusterManager.getCluster(plr.getLocation()); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); return false; } } @@ -526,28 +526,28 @@ public class Cluster extends SubCommand { message = message.replaceAll("%name%", name); message = message.replaceAll("%size%", size); message = message.replaceAll("%rights%", rights); - PlayerFunctions.sendMessage(plr, message); + BukkitPlayerFunctions.sendMessage(plr, message); return true; } case "sh": case "setspawn": case "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; } 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; } final PlotCluster cluster = ClusterManager.getCluster(plr.getLocation()); if (cluster == null) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_CLUSTER); return false; } if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) { 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; } } @@ -557,10 +557,10 @@ public class Cluster extends SubCommand { final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ()); cluster.settings.setPosition(blockloc); DBFunc.setPosition(cluster, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ()); - return 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; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java index 927a5f2db..a1272e78a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java @@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Plot; 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 Comment() { @@ -40,10 +40,10 @@ public class Comment extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { - if (!PlayerFunctions.isInPlot(plr)) { + if (!BukkitPlayerFunctions.isInPlot(plr)) { return sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if (!plot.hasOwner()) { return sendMessage(plr, C.NOT_IN_PLOT); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Condense.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Condense.java index 177038dee..5b61ac92b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Condense.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Condense.java @@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; 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 static boolean TASK = false; @@ -48,35 +48,35 @@ public class Condense extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { if (plr != null) { - PlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE)); + BukkitPlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE)); return false; } if ((args.length != 2) && (args.length != 3)) { - PlayerFunctions.sendMessage(plr, "/plot condense [radius]"); + BukkitPlayerFunctions.sendMessage(plr, "/plot condense [radius]"); return false; } final String worldname = args[0]; final World world = Bukkit.getWorld(worldname); if ((world == null) || !PlotSquared.isPlotWorld(worldname)) { - PlayerFunctions.sendMessage(plr, "INVALID WORLD"); + BukkitPlayerFunctions.sendMessage(plr, "INVALID WORLD"); return false; } switch (args[1].toLowerCase()) { case "start": { if (args.length == 2) { - PlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " start "); + BukkitPlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " start "); return false; } if (TASK) { - PlayerFunctions.sendMessage(plr, "TASK ALREADY STARTED"); + BukkitPlayerFunctions.sendMessage(plr, "TASK ALREADY STARTED"); return false; } if (args.length == 2) { - PlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " start "); + BukkitPlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " start "); return false; } if (!StringUtils.isNumeric(args[2])) { - PlayerFunctions.sendMessage(plr, "INVALID RADIUS"); + BukkitPlayerFunctions.sendMessage(plr, "INVALID RADIUS"); return false; } final int radius = Integer.parseInt(args[2]); @@ -84,7 +84,7 @@ public class Condense extends SubCommand { final int size = plots.size(); final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1); if (radius < minimum_radius) { - PlayerFunctions.sendMessage(plr, "RADIUS TOO SMALL"); + BukkitPlayerFunctions.sendMessage(plr, "RADIUS TOO SMALL"); return false; } final List to_move = new ArrayList<>(getPlots(plots, radius)); @@ -143,25 +143,25 @@ public class Condense extends SubCommand { } }); TASK = true; - PlayerFunctions.sendMessage(plr, "TASK STARTED..."); + BukkitPlayerFunctions.sendMessage(plr, "TASK STARTED..."); return true; } case "stop": { if (!TASK) { - PlayerFunctions.sendMessage(plr, "TASK ALREADY STOPPED"); + BukkitPlayerFunctions.sendMessage(plr, "TASK ALREADY STOPPED"); return false; } TASK = false; - PlayerFunctions.sendMessage(plr, "TASK STOPPED"); + BukkitPlayerFunctions.sendMessage(plr, "TASK STOPPED"); return true; } case "info": { if (args.length == 2) { - PlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " info "); + BukkitPlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " info "); return false; } if (!StringUtils.isNumeric(args[2])) { - PlayerFunctions.sendMessage(plr, "INVALID RADIUS"); + BukkitPlayerFunctions.sendMessage(plr, "INVALID RADIUS"); return false; } final int radius = Integer.parseInt(args[2]); @@ -169,23 +169,23 @@ public class Condense extends SubCommand { final int size = plots.size(); final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1); if (radius < minimum_radius) { - PlayerFunctions.sendMessage(plr, "RADIUS TOO SMALL"); + BukkitPlayerFunctions.sendMessage(plr, "RADIUS TOO SMALL"); return false; } final int max_move = getPlots(plots, minimum_radius).size(); final int user_move = getPlots(plots, radius).size(); - PlayerFunctions.sendMessage(plr, "=== DEFAULT EVAL ==="); - PlayerFunctions.sendMessage(plr, "MINIMUM RADIUS: " + minimum_radius); - PlayerFunctions.sendMessage(plr, "MAXIMUM MOVES: " + max_move); - PlayerFunctions.sendMessage(plr, "=== INPUT EVAL ==="); - PlayerFunctions.sendMessage(plr, "INPUT RADIUS: " + radius); - PlayerFunctions.sendMessage(plr, "ESTIMATED MOVES: " + user_move); - PlayerFunctions.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, "=== DEFAULT EVAL ==="); + BukkitPlayerFunctions.sendMessage(plr, "MINIMUM RADIUS: " + minimum_radius); + BukkitPlayerFunctions.sendMessage(plr, "MAXIMUM MOVES: " + max_move); + BukkitPlayerFunctions.sendMessage(plr, "=== INPUT EVAL ==="); + BukkitPlayerFunctions.sendMessage(plr, "INPUT RADIUS: " + radius); + BukkitPlayerFunctions.sendMessage(plr, "ESTIMATED MOVES: " + user_move); + BukkitPlayerFunctions.sendMessage(plr, "ESTIMATED TIME: " + "No idea, times will drastically change based on the system performance and load"); + BukkitPlayerFunctions.sendMessage(plr, "&e - Radius is measured in plot width"); return true; } } - PlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " [radius]"); + BukkitPlayerFunctions.sendMessage(plr, "/plot condense " + worldname + " [radius]"); return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java index 9155eb44c..951e55ceb 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java @@ -26,7 +26,7 @@ import com.intellectualcrafters.plot.BukkitMain; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.Plot; 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; public class Copy extends SubCommand { @@ -36,18 +36,18 @@ public class Copy extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { - if (!PlayerFunctions.isInPlot(plr)) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); + if (!BukkitPlayerFunctions.isInPlot(plr)) { + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); 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")) { - PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } assert plot != null; if (plot.settings.isMerged()) { - PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED); + BukkitPlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED); return false; } final int size = (MainUtil.getPlotTopLocAbs(plr.getWorld(), plot.getId()).getBlockX() - MainUtil.getPlotBottomLocAbs(plr.getWorld(), plot.getId()).getBlockX()); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java index 6fe230b68..7542b0f11 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java @@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.generator.HybridPlotManager; import com.intellectualcrafters.plot.generator.HybridPlotWorld; import com.intellectualcrafters.plot.object.Plot; 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 CreateRoadSchematic() { @@ -37,18 +37,18 @@ public class CreateRoadSchematic extends SubCommand { @Override public boolean execute(final Player player, final String... args) { - if (!PlayerFunctions.isInPlot(player)) { - PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT); + if (!BukkitPlayerFunctions.isInPlot(player)) { + BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT); return false; } if (!(PlotSquared.getPlotWorld(player.getWorld()) instanceof HybridPlotWorld)) { 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()); manager.setupRoadSchematic(plot); MainUtil.update(BukkitUtil.getLocation(entity)); - PlayerFunctions.sendMessage(player, "&6Saved new road schematic"); + BukkitPlayerFunctions.sendMessage(player, "&6Saved new road schematic"); return true; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java index 884208be4..bd055260b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java @@ -4,7 +4,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.config.C; 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 @@ -19,12 +19,12 @@ public class DEOP extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { 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); } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if (!plot.hasRights(plr)) { return sendMessage(plr, C.NO_PLOT_PERMS); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Database.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Database.java index a610d6481..b29d9e030 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Database.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Database.java @@ -15,7 +15,7 @@ import com.intellectualcrafters.plot.database.SQLManager; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.util.StringComparison; 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; /** @@ -36,7 +36,7 @@ public class Database extends SubCommand { } else { final Player p = UUIDHandler.uuidWrapper.getPlayer(uuid); if ((p != null) && p.isOnline()) { - return PlayerFunctions.sendMessage(p, msg); + return BukkitPlayerFunctions.sendMessage(p, msg); } else { return sendMessageU(null, msg); } @@ -141,7 +141,7 @@ public class Database extends SubCommand { if (player == null) { PlotSquared.log(msg); } else { - PlayerFunctions.sendMessage(player, msg); + BukkitPlayerFunctions.sendMessage(player, msg); } return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java index 5e8fa1503..65716a4d4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java @@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.util.Lag; import com.intellectualcrafters.plot.util.MainUtil; 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 Debug() { @@ -43,7 +43,7 @@ public class Debug extends SubCommand { for (final C c : C.values()) { msg.append(c.s()).append("\n"); } - PlayerFunctions.sendMessage(plr, msg.toString()); + BukkitPlayerFunctions.sendMessage(plr, msg.toString()); return true; } StringBuilder information; @@ -84,7 +84,7 @@ public class Debug extends SubCommand { information.append(getLine(line, "View all captions", "/plot debug msg")); } { - PlayerFunctions.sendMessage(plr, information.toString()); + BukkitPlayerFunctions.sendMessage(plr, information.toString()); } return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java index b096bf018..92d8db244 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java @@ -42,7 +42,7 @@ import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.StringWrapper; 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; /** @@ -64,7 +64,7 @@ public class DebugClaimTest extends SubCommand { if (!event.isCancelled()) { MainUtil.createPlot(player, plot); MainUtil.setSign(player, plot); - PlayerFunctions.sendMessage(player, C.CLAIMED); + BukkitPlayerFunctions.sendMessage(player, C.CLAIMED); if (teleport) { 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) { if (plr == null) { 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]); if ((world == null) || !PlotSquared.isPlotWorld(world)) { - return !PlayerFunctions.sendMessage(null, "&cInvalid plot world!"); + return !BukkitPlayerFunctions.sendMessage(null, "&cInvalid plot world!"); } PlotId min, max; try { @@ -89,18 +89,18 @@ public class DebugClaimTest extends SubCommand { min = new PlotId(Integer.parseInt(split1[0]), Integer.parseInt(split1[1])); max = new PlotId(Integer.parseInt(split2[0]), Integer.parseInt(split2[1])); } catch (final Exception e) { - return !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..."); - 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: &7Beginning sign to plot conversion. This may take a while..."); + BukkitPlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)"); final PlotManager manager = PlotSquared.getPlotManager(world); final PlotWorld plotworld = PlotSquared.getPlotWorld(world); final ArrayList 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 boolean contains = PlotSquared.getPlots(world).containsKey(plot.id); if (contains) { - PlayerFunctions.sendMessage(null, " - &cDB Already contains: " + plot.id); + BukkitPlayerFunctions.sendMessage(null, " - &cDB Already contains: " + plot.id); continue; } final Location loc = manager.getSignLoc(world, plotworld, plot); @@ -132,30 +132,30 @@ public class DebugClaimTest extends SubCommand { uuid = UUIDHandler.getUUID(line); } if (uuid != null) { - PlayerFunctions.sendMessage(null, " - &aFound plot: " + plot.id + " : " + line); + BukkitPlayerFunctions.sendMessage(null, " - &aFound plot: " + plot.id + " : " + line); plot.owner = uuid; plot.hasChanged = true; plots.add(plot); } else { - PlayerFunctions.sendMessage(null, " - &cInvalid playername: " + plot.id + " : " + line); + BukkitPlayerFunctions.sendMessage(null, " - &cInvalid playername: " + plot.id + " : " + line); } } } } } 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.createAllSettingsAndHelpers(plots); for (final Plot plot : plots) { PlotSquared.updatePlot(plot); } - PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Complete!"); + BukkitPlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Complete!"); } else { - PlayerFunctions.sendMessage(null, "No plots were found for the given search."); + BukkitPlayerFunctions.sendMessage(null, "No plots were found for the given search."); } } 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; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java index fca76528f..7514de024 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java @@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.util.MainUtil; 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; 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 pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id); if (MainUtil.runners.containsKey(plot)) { - PlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER); + BukkitPlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER); return false; } MainUtil.runners.put(plot, 1); @@ -82,11 +82,11 @@ public class DebugClear extends SubCommand { } 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); } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); - if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { return sendMessage(plr, C.UNLINK_REQUIRED); } if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !BukkitMain.hasPermission(plr, "plots.admin.command.debugclear")) { @@ -97,7 +97,7 @@ public class DebugClear extends SubCommand { final Location pos1 = MainUtil.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1); final Location pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id); if (MainUtil.runners.containsKey(plot)) { - PlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER); + BukkitPlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER); return false; } MainUtil.runners.put(plot, 1); @@ -105,7 +105,7 @@ public class DebugClear extends SubCommand { @Override public void run() { MainUtil.runners.remove(plot); - PlayerFunctions.sendMessage(plr, "&aDone!"); + BukkitPlayerFunctions.sendMessage(plr, "&aDone!"); } }); // sign diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java index dbccadcec..0b2d77319 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java @@ -41,7 +41,7 @@ import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.Plot; 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; public class DebugExec extends SubCommand { @@ -59,77 +59,77 @@ public class DebugExec extends SubCommand { if (ExpireManager.task != -1) { Bukkit.getScheduler().cancelTask(ExpireManager.task); } else { - return PlayerFunctions.sendMessage(null, "Task already halted"); + return BukkitPlayerFunctions.sendMessage(null, "Task already halted"); } ExpireManager.task = -1; - return PlayerFunctions.sendMessage(null, "Cancelled task."); + return BukkitPlayerFunctions.sendMessage(null, "Cancelled task."); } case "start-expire": { if (ExpireManager.task == -1) { ExpireManager.runTask(); } 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": { if (args.length > 1) { final World world = Bukkit.getWorld(args[1]); 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]); return true; } - return PlayerFunctions.sendMessage(null, "Use /plot debugexec update-expired "); + return BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec update-expired "); } case "show-expired": { if (args.length > 1) { final World world = Bukkit.getWorld(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 entry : ExpireManager.expiredPlots.get(args[1]).entrySet()) { final Plot plot = entry.getKey(); 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 PlayerFunctions.sendMessage(null, "Use /plot debugexec show-expired "); + return BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec show-expired "); } case "seen": { if (args.length != 2) { - return PlayerFunctions.sendMessage(null, "Use /plot debugexec seen "); + return BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec seen "); } final UUID uuid = UUIDHandler.getUUID(args[1]); 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); 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 Date date = new Date(stamp.getTime()); - PlayerFunctions.sendMessage(null, "PLAYER: " + args[1]); - PlayerFunctions.sendMessage(null, "UUID: " + uuid); - PlayerFunctions.sendMessage(null, "Object: " + date.toGMTString()); - PlayerFunctions.sendMessage(null, "GMT: " + date.toGMTString()); - PlayerFunctions.sendMessage(null, "Local: " + date.toLocaleString()); + BukkitPlayerFunctions.sendMessage(null, "PLAYER: " + args[1]); + BukkitPlayerFunctions.sendMessage(null, "UUID: " + uuid); + BukkitPlayerFunctions.sendMessage(null, "Object: " + date.toGMTString()); + BukkitPlayerFunctions.sendMessage(null, "GMT: " + date.toGMTString()); + BukkitPlayerFunctions.sendMessage(null, "Local: " + date.toLocaleString()); return true; } case "trim-check": { if (args.length != 2) { - PlayerFunctions.sendMessage(null, "Use /plot debugexec trim-check "); - PlayerFunctions.sendMessage(null, "&7 - Generates a list of regions to trim"); - return PlayerFunctions.sendMessage(null, "&7 - Run after plot expiry has run"); + BukkitPlayerFunctions.sendMessage(null, "Use /plot debugexec trim-check "); + BukkitPlayerFunctions.sendMessage(null, "&7 - Generates a list of regions to trim"); + return BukkitPlayerFunctions.sendMessage(null, "&7 - Run after plot expiry has run"); } final World world = Bukkit.getWorld(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 empty = new ArrayList<>(); final boolean result = Trim.getTrimRegions(empty, world, new Runnable() { @@ -160,13 +160,13 @@ public class DebugExec extends SubCommand { } }); if (!result) { - PlayerFunctions.sendMessage(null, "Trim task already started!"); + BukkitPlayerFunctions.sendMessage(null, "Trim task already started!"); } 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; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java index 8f740f6c1..156b96f32 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java @@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.flag.AbstractFlag; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; 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 DebugFixFlags() { @@ -44,19 +44,19 @@ public class DebugFixFlags extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { if (plr != null) { - PlayerFunctions.sendMessage(plr, C.NOT_CONSOLE); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_CONSOLE); return false; } if (args.length != 1) { - PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot debugfixflags "); + BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot debugfixflags "); return false; } final World world = Bukkit.getWorld(args[0]); 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; } - PlayerFunctions.sendMessage(plr, "&8--- &6Starting task &8 ---"); + BukkitPlayerFunctions.sendMessage(plr, "&8--- &6Starting task &8 ---"); for (final Plot plot : PlotSquared.getPlots(world).values()) { final Set flags = plot.settings.flags; final ArrayList toRemove = new ArrayList(); @@ -73,7 +73,7 @@ public class DebugFixFlags extends SubCommand { DBFunc.setFlags(plot.world, plot, plot.settings.flags); } } - PlayerFunctions.sendMessage(plr, "&aDone!"); + BukkitPlayerFunctions.sendMessage(plr, "&aDone!"); return true; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java index 6c2ebfec8..d45698f46 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java @@ -26,7 +26,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions; +import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions; /** * @author Citymonstret @@ -49,7 +49,7 @@ public class DebugLoadTest extends SubCommand { PlotSquared.log("&3===END OF STACKTRACE==="); } } 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; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java index 44119ce2e..8561f4610 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java @@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.generator.HybridPlotManager; 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; public class DebugRoadRegen extends SubCommand { @@ -48,7 +48,7 @@ public class DebugRoadRegen extends SubCommand { if (result) { 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; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java index cfb5816ad..a1d956532 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java @@ -27,7 +27,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Plot; -import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions; +import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions; /** * @author Citymonstret @@ -45,7 +45,7 @@ public class DebugSaveTest extends SubCommand { DBFunc.createPlots(plots); DBFunc.createAllSettingsAndHelpers(plots); } 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; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java index 6083c60b7..b27c20dc2 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java @@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Plot; 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; public class Delete extends SubCommand { @@ -40,11 +40,11 @@ public class Delete extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { - if (!PlayerFunctions.isInPlot(plr)) { + if (!BukkitPlayerFunctions.isInPlot(plr)) { return !sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); - if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { return !sendMessage(plr, C.UNLINK_REQUIRED); } if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.uuidWrapper.getUUID(plr)))) && !BukkitMain.hasPermission(plr, "plots.admin.command.delete")) { @@ -65,7 +65,7 @@ public class Delete extends SubCommand { plot.clear(plr, true); DBFunc.delete(plr.getWorld().getName(), plot); } else { - PlayerFunctions.sendMessage(plr, "Plot deletion has been denied."); + BukkitPlayerFunctions.sendMessage(plr, "Plot deletion has been denied."); } return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java index 26a7980cc..397ffecb7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java @@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent; 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; @SuppressWarnings("deprecation") @@ -42,20 +42,20 @@ public class Denied extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { if (args.length < 2) { - PlayerFunctions.sendMessage(plr, C.DENIED_NEED_ARGUMENT); + BukkitPlayerFunctions.sendMessage(plr, C.DENIED_NEED_ARGUMENT); return true; } - if (!PlayerFunctions.isInPlot(plr)) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); + if (!BukkitPlayerFunctions.isInPlot(plr)) { + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); return true; } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if ((plot == null) || !plot.hasOwner()) { - PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); + BukkitPlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); return false; } 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; } if (args[0].equalsIgnoreCase("add")) { @@ -66,12 +66,12 @@ public class Denied extends SubCommand { uuid = UUIDHandler.getUUID(args[1]); } if (uuid == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); return false; } if (!plot.denied.contains(uuid)) { if (plot.owner.equals(uuid)) { - PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); + BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); return false; } if (plot.trusted.contains(uuid)) { @@ -87,29 +87,29 @@ public class Denied extends SubCommand { final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true); Bukkit.getPluginManager().callEvent(event); } else { - PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_ADDED); return false; } final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid); 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)) { - PlayerFunctions.sendMessage(player, C.YOU_BE_DENIED); + BukkitPlayerFunctions.sendMessage(player, C.YOU_BE_DENIED); player.teleport(player.getWorld().getSpawnLocation()); } } - PlayerFunctions.sendMessage(plr, C.DENIED_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.DENIED_ADDED); return true; } else if (args[0].equalsIgnoreCase("remove")) { if (args[1].equalsIgnoreCase("*")) { final UUID uuid = DBFunc.everyone; if (!plot.denied.contains(uuid)) { - PlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED); return true; } plot.removeDenied(uuid); DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid); - PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED); + BukkitPlayerFunctions.sendMessage(plr, C.DENIED_REMOVED); return true; } final UUID uuid = UUIDHandler.getUUID(args[1]); @@ -117,9 +117,9 @@ public class Denied extends SubCommand { DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid); final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false); Bukkit.getPluginManager().callEvent(event); - PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED); + BukkitPlayerFunctions.sendMessage(plr, C.DENIED_REMOVED); } else { - PlayerFunctions.sendMessage(plr, C.DENIED_NEED_ARGUMENT); + BukkitPlayerFunctions.sendMessage(plr, C.DENIED_NEED_ARGUMENT); return true; } return true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java index 24165dfe2..7baf99bdb 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java @@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagValue; import com.intellectualcrafters.plot.listeners.PlotListener; 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 FlagCmd() { @@ -53,12 +53,12 @@ public class FlagCmd extends SubCommand { * plot flag list */ if (args.length == 0) { - PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag "); + BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag "); return false; } - final Plot plot = PlayerFunctions.getCurrentPlot(player); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(player); if (plot == null) { - PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT); + BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT); return false; } if (!plot.hasOwner()) { @@ -66,88 +66,88 @@ public class FlagCmd extends SubCommand { return false; } 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; } switch (args[0].toLowerCase()) { case "info": { 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; } if (args.length != 2) { - PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info "); + BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info "); return false; } final AbstractFlag af = FlagManager.getFlag(args[1]); if (af == null) { - PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG); - PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info "); + BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG); + BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info "); return false; } // flag key - PlayerFunctions.sendMessage(player, C.FLAG_KEY, af.getKey()); + BukkitPlayerFunctions.sendMessage(player, C.FLAG_KEY, af.getKey()); // 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 - PlayerFunctions.sendMessage(player, C.FLAG_DESC, af.getValueDesc()); - PlayerFunctions.sendMessage(player, "&cNot implemented."); + BukkitPlayerFunctions.sendMessage(player, C.FLAG_DESC, af.getValueDesc()); + BukkitPlayerFunctions.sendMessage(player, "&cNot implemented."); } case "set": { 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; } if (args.length < 3) { - PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag set "); + BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag set "); return false; } final AbstractFlag af = FlagManager.getFlag(args[1].toLowerCase()); if (af == null) { - PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG); + BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG); return false; } 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; } final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " "); final Object parsed = af.parseValueRaw(value); if (parsed == null) { - PlayerFunctions.sendMessage(player, "&c" + af.getValueDesc()); + BukkitPlayerFunctions.sendMessage(player, "&c" + af.getValueDesc()); return false; } final Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), parsed); final boolean result = FlagManager.addPlotFlag(plot, flag); if (!result) { - PlayerFunctions.sendMessage(player, C.FLAG_NOT_ADDED); + BukkitPlayerFunctions.sendMessage(player, C.FLAG_NOT_ADDED); return false; } - PlayerFunctions.sendMessage(player, C.FLAG_ADDED); + BukkitPlayerFunctions.sendMessage(player, C.FLAG_ADDED); PlotListener.plotEntry(player, plot); return true; } case "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; } if ((args.length != 2) && (args.length != 3)) { - PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag remove [values]"); + BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag remove [values]"); return false; } final AbstractFlag af = FlagManager.getFlag(args[1].toLowerCase()); if (af == null) { - PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG); + BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG); return false; } 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; } final Flag flag = FlagManager.getPlotFlagAbs(plot, args[1].toLowerCase()); if (flag == null) { - PlayerFunctions.sendMessage(player, C.FLAG_NOT_IN_PLOT); + BukkitPlayerFunctions.sendMessage(player, C.FLAG_NOT_IN_PLOT); return false; } if ((args.length == 3) && flag.getAbstractFlag().isList()) { @@ -157,36 +157,36 @@ public class FlagCmd extends SubCommand { } else { final boolean result = FlagManager.removePlotFlag(plot, flag.getKey()); if (!result) { - PlayerFunctions.sendMessage(player, C.FLAG_NOT_REMOVED); + BukkitPlayerFunctions.sendMessage(player, C.FLAG_NOT_REMOVED); return false; } } - PlayerFunctions.sendMessage(player, C.FLAG_REMOVED); + BukkitPlayerFunctions.sendMessage(player, C.FLAG_REMOVED); PlotListener.plotEntry(player, plot); return true; } case "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; } if (args.length < 3) { - PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag add "); + BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag add "); return false; } final AbstractFlag af = FlagManager.getFlag(args[1].toLowerCase()); if (af == null) { - PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG); + BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG); return false; } 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; } final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " "); final Object parsed = af.parseValueRaw(value); if (parsed == null) { - PlayerFunctions.sendMessage(player, "&c" + af.getValueDesc()); + BukkitPlayerFunctions.sendMessage(player, "&c" + af.getValueDesc()); return false; } Flag flag = FlagManager.getPlotFlag(plot, args[1].toLowerCase()); @@ -197,21 +197,21 @@ public class FlagCmd extends SubCommand { } final boolean result = FlagManager.addPlotFlag(plot, flag); if (!result) { - PlayerFunctions.sendMessage(player, C.FLAG_NOT_ADDED); + BukkitPlayerFunctions.sendMessage(player, C.FLAG_NOT_ADDED); return false; } DBFunc.setFlags(plot.world, plot, plot.settings.flags); - PlayerFunctions.sendMessage(player, C.FLAG_ADDED); + BukkitPlayerFunctions.sendMessage(player, C.FLAG_ADDED); PlotListener.plotEntry(player, plot); return true; } case "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; } if (args.length != 1) { - PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag list"); + BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag list"); return false; } final HashMap> flags = new HashMap<>(); @@ -228,11 +228,11 @@ public class FlagCmd extends SubCommand { message += prefix + "&6" + flag + ": &7" + StringUtils.join(flags.get(flag), ", "); prefix = "\n"; } - PlayerFunctions.sendMessage(player, message); + BukkitPlayerFunctions.sendMessage(player, message); return true; } } - PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag "); + BukkitPlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag "); return false; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java index 997d847a8..64a8d5c2f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java @@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent; 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; public class Helpers extends SubCommand { @@ -41,20 +41,20 @@ public class Helpers extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { if (args.length < 2) { - PlayerFunctions.sendMessage(plr, C.HELPER_NEED_ARGUMENT); + BukkitPlayerFunctions.sendMessage(plr, C.HELPER_NEED_ARGUMENT); return true; } - if (!PlayerFunctions.isInPlot(plr)) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); + if (!BukkitPlayerFunctions.isInPlot(plr)) { + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); return true; } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if ((plot == null) || !plot.hasOwner()) { - PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); + BukkitPlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); return false; } 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; } if (args[0].equalsIgnoreCase("add")) { @@ -65,12 +65,12 @@ public class Helpers extends SubCommand { uuid = UUIDHandler.getUUID(args[1]); } if (uuid == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); return false; } if (!plot.helpers.contains(uuid)) { if (plot.owner.equals(uuid)) { - PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); + BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); return false; } if (plot.trusted.contains(uuid)) { @@ -86,21 +86,21 @@ public class Helpers extends SubCommand { final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true); Bukkit.getPluginManager().callEvent(event); } else { - PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_ADDED); return false; } - PlayerFunctions.sendMessage(plr, C.HELPER_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.HELPER_ADDED); return true; } else if (args[0].equalsIgnoreCase("remove")) { if (args[1].equalsIgnoreCase("*")) { final UUID uuid = DBFunc.everyone; if (!plot.helpers.contains(uuid)) { - PlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED); return true; } plot.removeHelper(uuid); DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid); - PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED); + BukkitPlayerFunctions.sendMessage(plr, C.HELPER_REMOVED); return true; } final UUID uuid = UUIDHandler.getUUID(args[1]); @@ -108,9 +108,9 @@ public class Helpers extends SubCommand { DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid); final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false); Bukkit.getPluginManager().callEvent(event); - PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED); + BukkitPlayerFunctions.sendMessage(plr, C.HELPER_REMOVED); } else { - PlayerFunctions.sendMessage(plr, C.HELPER_NEED_ARGUMENT); + BukkitPlayerFunctions.sendMessage(plr, C.HELPER_NEED_ARGUMENT); return true; } return true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java index 54a9e19fa..832007503 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java @@ -25,7 +25,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; 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; /** @@ -67,20 +67,20 @@ public class Home extends SubCommand { return true; } } - PlayerFunctions.sendMessage(plr, C.NOT_YOUR_PLOT); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_YOUR_PLOT); return false; } - PlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER); return true; } if ((id > (plots.length)) || (id < 1)) { - PlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER); return false; } teleportPlayer(plr, plots[id - 1]); return true; } else { - PlayerFunctions.sendMessage(plr, C.NO_PLOTS); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOTS); return true; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java index 3e204817b..4fb2cc82c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java @@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Plot; 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; public class Inbox extends SubCommand { @@ -50,13 +50,13 @@ public class Inbox extends SubCommand { report = true; } } - if (!PlayerFunctions.isInPlot(plr) && !report) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); + if (!BukkitPlayerFunctions.isInPlot(plr) && !report) { + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); return false; } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if ((plot != null) && !plot.hasOwner()) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); return false; } Integer tier; @@ -80,7 +80,7 @@ public class Inbox extends SubCommand { if (tier <= 0) { tier = 0; } else { - PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin"); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin"); return false; } break; @@ -88,7 +88,7 @@ public class Inbox extends SubCommand { if (tier <= 1) { tier = 1; } else { - PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.owner"); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.owner"); return false; } break; @@ -96,7 +96,7 @@ public class Inbox extends SubCommand { if (tier <= 2) { tier = 2; } else { - PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.helper"); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.helper"); return false; } break; @@ -104,7 +104,7 @@ public class Inbox extends SubCommand { if (tier <= 3) { tier = 3; } else { - PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.trusted"); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.trusted"); return false; } break; @@ -112,7 +112,7 @@ public class Inbox extends SubCommand { if (tier <= 4) { tier = 4; } else { - PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.everyone"); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.everyone"); return false; } break; @@ -120,12 +120,12 @@ public class Inbox extends SubCommand { if (tier <= 0) { tier = -1; } else { - PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin"); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin"); return false; } break; 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; } } else { @@ -149,7 +149,7 @@ public class Inbox extends SubCommand { if (args.length == 2) { final String[] split = args[1].toLowerCase().split(":"); if (!split[0].equals("clear")) { - PlayerFunctions.sendMessage(plr, "&c/plot inbox [tier] [clear][:#]"); + BukkitPlayerFunctions.sendMessage(plr, "&c/plot inbox [tier] [clear][:#]"); return; } if (split.length > 1) { @@ -158,10 +158,10 @@ public class Inbox extends SubCommand { final PlotComment comment = comments.get(index - 1); DBFunc.removeComment(world, plot, comment); plot.settings.removeComment(comment); - PlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "1 comment"); + BukkitPlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "1 comment"); return; } 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; } } @@ -169,7 +169,7 @@ public class Inbox extends SubCommand { DBFunc.removeComment(world, plot, comment); } 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 { final List recipients = Arrays.asList("A", "O", "H", "T", "E"); int count = 1; @@ -183,7 +183,7 @@ public class Inbox extends SubCommand { if (comments.size() == 0) { message.append("&cNo messages."); } - PlayerFunctions.sendMessage(plr, message.toString()); + BukkitPlayerFunctions.sendMessage(plr, message.toString()); } } }); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java index 68446eb5b..15078754a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java @@ -39,7 +39,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotWorld; 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; /** @@ -58,22 +58,22 @@ public class Info extends SubCommand { if (player != null) { world = player.getWorld(); if (!PlotSquared.isPlotWorld(world)) { - PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT_WORLD); + BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT_WORLD); return false; } - if (!PlayerFunctions.isInPlot(player)) { - PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT); + if (!BukkitPlayerFunctions.isInPlot(player)) { + BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT); return false; } - plot = PlayerFunctions.getCurrentPlot(player); + plot = BukkitPlayerFunctions.getCurrentPlot(player); } else { if (args.length < 2) { - PlayerFunctions.sendMessage(null, C.INFO_SYNTAX_CONSOLE); + BukkitPlayerFunctions.sendMessage(null, C.INFO_SYNTAX_CONSOLE); return false; } final PlotWorld plotworld = PlotSquared.getPlotWorld(args[0]); if (plotworld == null) { - PlayerFunctions.sendMessage(player, C.NOT_VALID_WORLD); + BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_WORLD); return false; } try { @@ -81,7 +81,7 @@ public class Info extends SubCommand { final PlotId id = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1])); plot = MainUtil.getPlot(Bukkit.getWorld(plotworld.worldname), id); if (plot == null) { - PlayerFunctions.sendMessage(player, C.NOT_VALID_PLOT_ID); + BukkitPlayerFunctions.sendMessage(player, C.NOT_VALID_PLOT_ID); return false; } world = Bukkit.getWorld(args[0]); @@ -91,7 +91,7 @@ public class Info extends SubCommand { args = new String[0]; } } catch (final Exception e) { - PlayerFunctions.sendMessage(player, C.INFO_SYNTAX_CONSOLE); + BukkitPlayerFunctions.sendMessage(player, C.INFO_SYNTAX_CONSOLE); return false; } } @@ -109,7 +109,7 @@ public class Info extends SubCommand { } // Unclaimed? 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; } String owner = "none"; @@ -123,13 +123,13 @@ public class Info extends SubCommand { if (args.length == 1) { info = getCaption(args[0].toLowerCase()); 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; } } info = format(info, world, plot, player); - PlayerFunctions.sendMessage(player, C.PLOT_INFO_HEADER); - PlayerFunctions.sendMessage(player, info, false); + BukkitPlayerFunctions.sendMessage(player, C.PLOT_INFO_HEADER); + BukkitPlayerFunctions.sendMessage(player, info, false); 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) { final PlotId id = plot.id; - final PlotId id2 = PlayerFunctions.getTopPlot(world, plot).id; - final int num = PlayerFunctions.getPlotSelectionIds(id, id2).size(); + final PlotId id2 = BukkitPlayerFunctions.getTopPlot(world, plot).id; + final int num = BukkitPlayerFunctions.getPlotSelectionIds(id, id2).size(); final String alias = plot.settings.getAlias().length() > 0 ? plot.settings.getAlias() : "none"; final String biome = getBiomeAt(plot).toString(); final String helpers = getPlayerList(plot.helpers); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java index 410c1c105..7be8d38dd 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java @@ -26,7 +26,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.BukkitMain; import com.intellectualcrafters.plot.config.C; 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; @SuppressWarnings({ "unused", "deprecation", "javadoc" }) @@ -37,26 +37,26 @@ public class Kick extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { - if (!PlayerFunctions.isInPlot(plr)) { - PlayerFunctions.sendMessage(plr, "You're not in a plot."); + if (!BukkitPlayerFunctions.isInPlot(plr)) { + BukkitPlayerFunctions.sendMessage(plr, "You're not in a plot."); 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")) { - PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } if (args.length != 1) { - PlayerFunctions.sendMessage(plr, "&c/plot kick "); + BukkitPlayerFunctions.sendMessage(plr, "&c/plot kick "); return false; } if (Bukkit.getPlayer(args[0]) == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[0]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[0]); return false; } 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)) { - PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER.s().replaceAll("%player%", args[0])); + if (!player.getWorld().equals(plr.getWorld()) || !BukkitPlayerFunctions.isInPlot(player) || (BukkitPlayerFunctions.getCurrentPlot(player) == null) || !BukkitPlayerFunctions.getCurrentPlot(player).equals(plot)) { + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER.s().replaceAll("%player%", args[0])); return false; } player.teleport(player.getWorld().getSpawnLocation()); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index aeabc7fee..85d2b3139 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -25,7 +25,7 @@ import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.PlotPlayer; 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.command.Command; import org.bukkit.command.CommandSender; @@ -52,7 +52,7 @@ public class MainCommand { }; 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; } @@ -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%", "all").replaceAll("%category_desc%", "Display all commands")); - return PlayerFunctions.sendMessage(player, builder.toString()); + return BukkitPlayerFunctions.sendMessage(player, builder.toString()); } final String cat = args[1]; SubCommand.CommandCategory cato = null; @@ -136,7 +136,7 @@ public class MainCommand { 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())); } - return PlayerFunctions.sendMessage(player, builder.toString(), false); + return BukkitPlayerFunctions.sendMessage(player, builder.toString(), false); } final StringBuilder help = new StringBuilder(); int page = 0; @@ -173,21 +173,21 @@ public class MainCommand { if ((player != null) || !command.isPlayer) { return command.execute(player, arguments); } else { - return !PlayerFunctions.sendMessage(null, C.IS_CONSOLE); + return !BukkitPlayerFunctions.sendMessage(null, C.IS_CONSOLE); } } else { 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()]; for (int x = 0; x < subCommands.size(); x++) { commands[x] = subCommands.get(x).cmd; } /* Let's try to get a proper usage string */ 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 // StringComparsion(args[0], commands).getBestMatch()); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index 2971839a8..de582fdf9 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -37,7 +37,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotWorld; 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; /** @@ -75,23 +75,23 @@ public class Merge extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { - if (!PlayerFunctions.isInPlot(plr)) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); + if (!BukkitPlayerFunctions.isInPlot(plr)) { + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); return true; } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if ((plot == null) || !plot.hasOwner()) { - PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); + BukkitPlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); return false; } final boolean admin = BukkitMain.hasPermission(plr, "plots.admin.command.merge"); if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !admin) { - PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } if (args.length < 1) { - PlayerFunctions.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.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s())); + BukkitPlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw()))); return false; } int direction = -1; @@ -102,43 +102,43 @@ public class Merge extends SubCommand { } } if (direction == -1) { - PlayerFunctions.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.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s())); + BukkitPlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw()))); return false; } final World world = plr.getWorld(); - PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id; - PlotId top = PlayerFunctions.getTopPlot(world, plot).id; + PlotId bot = BukkitPlayerFunctions.getBottomPlot(world, plot).id; + PlotId top = BukkitPlayerFunctions.getTopPlot(world, plot).id; ArrayList plots; switch (direction) { 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; 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; 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; 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; default: return false; } final PlotId botId = plots.get(0); final PlotId topId = plots.get(plots.size() - 1); - final PlotId bot1 = PlayerFunctions.getBottomPlot(world, MainUtil.getPlot(world, botId)).id; - final PlotId bot2 = PlayerFunctions.getBottomPlot(world, MainUtil.getPlot(world, topId)).id; - final PlotId top1 = PlayerFunctions.getTopPlot(world, MainUtil.getPlot(world, topId)).id; - final PlotId top2 = PlayerFunctions.getTopPlot(world, MainUtil.getPlot(world, botId)).id; + final PlotId bot1 = BukkitPlayerFunctions.getBottomPlot(world, MainUtil.getPlot(world, botId)).id; + final PlotId bot2 = BukkitPlayerFunctions.getBottomPlot(world, MainUtil.getPlot(world, topId)).id; + final PlotId top1 = BukkitPlayerFunctions.getTopPlot(world, MainUtil.getPlot(world, topId)).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)); 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) { final Plot myplot = PlotSquared.getPlots(world).get(myid); 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; } } @@ -160,10 +160,10 @@ public class Merge extends SubCommand { Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { event.setCancelled(true); - PlayerFunctions.sendMessage(plr, "&cMerge has been cancelled"); + BukkitPlayerFunctions.sendMessage(plr, "&cMerge has been cancelled"); return false; } - PlayerFunctions.sendMessage(plr, "&cPlots have been merged"); + BukkitPlayerFunctions.sendMessage(plr, "&cPlots have been merged"); MainUtil.mergePlots(world, plots, true); MainUtil.setSign(world, UUIDHandler.getName(plot.owner), plot); MainUtil.update(plr.getLocation()); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java index 4209dedd7..485e59fe7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java @@ -25,7 +25,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.object.PlotId; 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 @@ -40,32 +40,32 @@ public class Move extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { if (plr == null) { - PlayerFunctions.sendMessage(plr, "MUST BE EXECUTED BY PLAYER"); + BukkitPlayerFunctions.sendMessage(plr, "MUST BE EXECUTED BY PLAYER"); } if (args.length != 2) { - PlayerFunctions.sendMessage(plr, "/plot move "); + BukkitPlayerFunctions.sendMessage(plr, "/plot move "); return false; } final World world = plr.getWorld(); final PlotId plot1 = MainUtil.parseId(args[0]); final PlotId plot2 = MainUtil.parseId(args[1]); if ((plot1 == null) || (plot2 == null)) { - PlayerFunctions.sendMessage(plr, "INVALID PLOT ID\n/plot move "); + BukkitPlayerFunctions.sendMessage(plr, "INVALID PLOT ID\n/plot move "); return false; } if (plot1 == plot2) { - PlayerFunctions.sendMessage(plr, "DUPLICATE ID"); + BukkitPlayerFunctions.sendMessage(plr, "DUPLICATE ID"); return false; } if (MainUtil.move(world, plot1, plot2, new Runnable() { @Override public void run() { - PlayerFunctions.sendMessage(plr, "MOVE SUCCESS"); + BukkitPlayerFunctions.sendMessage(plr, "MOVE SUCCESS"); } })) { return true; } else { - PlayerFunctions.sendMessage(plr, "MOVE FAILED"); + BukkitPlayerFunctions.sendMessage(plr, "MOVE FAILED"); return false; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java index bb8720c03..a261ef6ed 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java @@ -31,7 +31,7 @@ import org.bukkit.inventory.meta.ItemMeta; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.listeners.PlotPlusListener; 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 MusicSubcommand() { @@ -40,11 +40,11 @@ public class MusicSubcommand extends SubCommand { @Override public boolean execute(final Player player, final String... args) { - if (!PlayerFunctions.isInPlot(player)) { + if (!BukkitPlayerFunctions.isInPlot(player)) { sendMessage(player, C.NOT_IN_PLOT); return true; } - final Plot plot = PlayerFunctions.getCurrentPlot(player); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(player); if (!plot.hasRights(player)) { sendMessage(player, C.NO_PLOT_PERMS); return true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java index 7a7f0f4ae..4dd26c6df 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java @@ -4,7 +4,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.config.C; 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 @@ -19,12 +19,12 @@ public class OP extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { 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); } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if (!plot.hasRights(plr)) { return sendMessage(plr, C.NO_PLOT_PERMS); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java index bd0b84c31..7d165a62f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java @@ -26,7 +26,7 @@ import com.intellectualcrafters.plot.BukkitMain; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.Plot; 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; public class Paste extends SubCommand { @@ -36,17 +36,17 @@ public class Paste extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { - if (!PlayerFunctions.isInPlot(plr)) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); + if (!BukkitPlayerFunctions.isInPlot(plr)) { + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); 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")) { - PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } - if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { - PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED); + if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { + BukkitPlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED); return false; } assert plot != null; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java index 94f078bf5..14baa41c5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java @@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Plot; 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; @SuppressWarnings({ "javadoc" }) @@ -55,47 +55,47 @@ public class Purge extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { if (plr != null) { - PlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE)); + BukkitPlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE)); return false; } if (args.length == 1) { final String arg = args[0].toLowerCase(); final PlotId id = getId(arg); if (id != null) { - PlayerFunctions.sendMessage(plr, "/plot purge x;z &l"); + BukkitPlayerFunctions.sendMessage(plr, "/plot purge x;z &l"); return false; } final UUID uuid = UUIDHandler.getUUID(args[0]); if (uuid != null) { - PlayerFunctions.sendMessage(plr, "/plot purge " + args[0] + " &l"); + BukkitPlayerFunctions.sendMessage(plr, "/plot purge " + args[0] + " &l"); return false; } if (arg.equals("player")) { - PlayerFunctions.sendMessage(plr, "/plot purge &l "); + BukkitPlayerFunctions.sendMessage(plr, "/plot purge &l "); return false; } if (arg.equals("unowned")) { - PlayerFunctions.sendMessage(plr, "/plot purge unowned &l"); + BukkitPlayerFunctions.sendMessage(plr, "/plot purge unowned &l"); return false; } if (arg.equals("unknown")) { - PlayerFunctions.sendMessage(plr, "/plot purge unknown &l"); + BukkitPlayerFunctions.sendMessage(plr, "/plot purge unknown &l"); return false; } if (arg.equals("all")) { - PlayerFunctions.sendMessage(plr, "/plot purge all &l"); + BukkitPlayerFunctions.sendMessage(plr, "/plot purge all &l"); return false; } - PlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX); + BukkitPlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX); return false; } if (args.length != 2) { - PlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX); + BukkitPlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX); return false; } final World world = Bukkit.getWorld(args[1]); if ((world == null) || !PlotSquared.isPlotWorld(world)) { - PlayerFunctions.sendMessage(null, C.NOT_VALID_PLOT_WORLD); + BukkitPlayerFunctions.sendMessage(null, C.NOT_VALID_PLOT_WORLD); return false; } final String worldname = world.getName(); @@ -123,7 +123,7 @@ public class Purge extends SubCommand { if (arg.equals("all")) { final Set ids = PlotSquared.getPlots(world).keySet(); if (ids.size() == 0) { - return PlayerFunctions.sendMessage(null, "&cNo plots found"); + return BukkitPlayerFunctions.sendMessage(null, "&cNo plots found"); } DBFunc.purge(worldname, ids); return finishPurge(ids.size()); @@ -140,7 +140,7 @@ public class Purge extends SubCommand { } } if (ids.size() == 0) { - return PlayerFunctions.sendMessage(null, "&cNo plots found"); + return BukkitPlayerFunctions.sendMessage(null, "&cNo plots found"); } DBFunc.purge(worldname, ids); return finishPurge(ids.size()); @@ -154,17 +154,17 @@ public class Purge extends SubCommand { } } if (ids.size() == 0) { - return PlayerFunctions.sendMessage(null, "&cNo plots found"); + return BukkitPlayerFunctions.sendMessage(null, "&cNo plots found"); } DBFunc.purge(worldname, ids); return finishPurge(ids.size()); } - PlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX); + BukkitPlayerFunctions.sendMessage(plr, C.PURGE_SYNTAX); return false; } private boolean finishPurge(final int amount) { - PlayerFunctions.sendMessage(null, C.PURGE_SUCCESS, amount + ""); + BukkitPlayerFunctions.sendMessage(null, C.PURGE_SUCCESS, amount + ""); return false; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java index a66ed1a45..adf401365 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java @@ -25,7 +25,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; 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; @SuppressWarnings({ "unused", "deprecated", "javadoc" }) @@ -44,11 +44,11 @@ public class Rate extends SubCommand { sendMessage(plr, C.RATING_NOT_VALID); return true; } - if (!PlayerFunctions.isInPlot(plr)) { + if (!BukkitPlayerFunctions.isInPlot(plr)) { sendMessage(plr, C.NOT_IN_PLOT); return true; } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if (!plot.hasOwner()) { sendMessage(plr, C.RATING_NOT_OWNED); return true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java index 9e054c535..945b676f7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java @@ -25,7 +25,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; 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 Reload() { @@ -46,7 +46,7 @@ public class Reload extends SubCommand { } MainUtil.sendMessage(plr, C.RELOADED_CONFIGS); } catch (final Exception e) { - PlayerFunctions.sendMessage(plr, C.RELOAD_FAILED); + BukkitPlayerFunctions.sendMessage(plr, C.RELOAD_FAILED); } return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java index 4b555592f..61920af69 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java @@ -40,7 +40,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler.DataCollection; 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; public class Schematic extends SubCommand { @@ -70,19 +70,19 @@ public class Schematic extends SubCommand { return false; } 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; } if (args.length < 2) { sendMessage(plr, C.SCHEMATIC_MISSING_ARG); break; } - if (!PlayerFunctions.isInPlot(plr)) { + if (!BukkitPlayerFunctions.isInPlot(plr)) { sendMessage(plr, C.NOT_IN_PLOT); break; } if (this.running) { - PlayerFunctions.sendMessage(plr, "&cTask is already running."); + BukkitPlayerFunctions.sendMessage(plr, "&cTask is already running."); return false; } final String file2 = args[1]; @@ -99,7 +99,7 @@ public class Schematic extends SubCommand { } final int x; final int z; - final Plot plot2 = PlayerFunctions.getCurrentPlot(plr); + final Plot plot2 = BukkitPlayerFunctions.getCurrentPlot(plr); final Dimension dem = schematic.getSchematicDimension(); final Location bot = MainUtil.getPlotBottomLoc(plr.getWorld(), plot2.id).add(1, 0, 1); final int length2 = MainUtil.getPlotWidth(plr.getWorld(), plot2.id); @@ -151,7 +151,7 @@ public class Schematic extends SubCommand { return false; } 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; } if (args.length < 2) { @@ -166,7 +166,7 @@ public class Schematic extends SubCommand { } final int l1 = schematic.getSchematicDimension().getX(); 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); if ((l1 < length) || (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 "exportall": if (plr != null) { - PlayerFunctions.sendMessage(plr, C.NOT_CONSOLE); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_CONSOLE); return false; } if (args.length != 2) { - PlayerFunctions.sendMessage(null, "&cNeed world arg. Use &7/plots sch exportall "); + BukkitPlayerFunctions.sendMessage(null, "&cNeed world arg. Use &7/plots sch exportall "); return false; } final HashMap plotmap = PlotSquared.getPlots(args[1]); if ((plotmap == null) || (plotmap.size() == 0)) { - PlayerFunctions.sendMessage(null, "&cInvalid world. Use &7/plots sch exportall "); + BukkitPlayerFunctions.sendMessage(null, "&cInvalid world. Use &7/plots sch exportall "); return false; } if (this.running) { - PlayerFunctions.sendMessage(null, "&cTask is already running."); + BukkitPlayerFunctions.sendMessage(null, "&cTask is already running."); return false; } PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while."); @@ -216,17 +216,17 @@ public class Schematic extends SubCommand { final String o = UUIDHandler.getName(plot.owner); final String owner = o == null ? "unknown" : o; if (sch == null) { - PlayerFunctions.sendMessage(null, "&7 - Skipped plot &c" + plot.id); + BukkitPlayerFunctions.sendMessage(null, "&7 - Skipped plot &c" + plot.id); } else { Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() { @Override 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"); if (!result) { - PlayerFunctions.sendMessage(null, "&7 - Failed to save &c" + plot.id); + BukkitPlayerFunctions.sendMessage(null, "&7 - Failed to save &c" + plot.id); } 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 "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; } if (this.running) { - PlayerFunctions.sendMessage(plr, "&cTask is already running."); + BukkitPlayerFunctions.sendMessage(plr, "&cTask is already running."); return false; } final String world; final Plot p2; if (plr != null) { - if (!PlayerFunctions.isInPlot(plr)) { + if (!BukkitPlayerFunctions.isInPlot(plr)) { sendMessage(plr, C.NOT_IN_PLOT); return false; } - final Plot myplot = PlayerFunctions.getCurrentPlot(plr); + final Plot myplot = BukkitPlayerFunctions.getCurrentPlot(plr); if (!myplot.hasRights(plr)) { sendMessage(plr, C.NO_PLOT_PERMS); return false; @@ -266,16 +266,16 @@ public class Schematic extends SubCommand { final String[] split = args[2].split(";"); final PlotId i = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1])); if ((PlotSquared.getPlots(world) == null) || (PlotSquared.getPlots(world).get(i) == null)) { - PlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save "); + BukkitPlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save "); return false; } p2 = PlotSquared.getPlots(world).get(i); } catch (final Exception e) { - PlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save "); + BukkitPlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save "); return false; } } else { - PlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save "); + BukkitPlayerFunctions.sendMessage(null, "&cInvalid world or id. Use &7/plots sch save "); return false; } } @@ -297,17 +297,17 @@ public class Schematic extends SubCommand { final String o = UUIDHandler.getName(plot.owner); final String owner = o == null ? "unknown" : o; if (sch == null) { - PlayerFunctions.sendMessage(plr, "&7 - Skipped plot &c" + plot.id); + BukkitPlayerFunctions.sendMessage(plr, "&7 - Skipped plot &c" + plot.id); } else { Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() { @Override 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"); if (!result) { - PlayerFunctions.sendMessage(plr, "&7 - Failed to save &c" + plot.id); + BukkitPlayerFunctions.sendMessage(plr, "&7 - Failed to save &c" + plot.id); } else { - PlayerFunctions.sendMessage(plr, "&7 - &aExport success: " + plot.id); + BukkitPlayerFunctions.sendMessage(plr, "&7 - &aExport success: " + plot.id); } } }); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java index 9fc4b40c1..3e142d6d0 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -48,7 +48,7 @@ import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.StringWrapper; import com.intellectualcrafters.plot.util.MainUtil; 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; /** @@ -65,21 +65,21 @@ public class Set extends SubCommand { @SuppressWarnings("deprecation") @Override public boolean execute(final Player plr, final String... args) { - if (!PlayerFunctions.isInPlot(plr)) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); + if (!BukkitPlayerFunctions.isInPlot(plr)) { + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); return false; } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if (!plot.hasOwner()) { sendMessage(plr, C.PLOT_NOT_CLAIMED); return false; } 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; } 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; } for (int i = 0; i < aliases.length; i++) { @@ -91,7 +91,7 @@ public class Set extends SubCommand { /* TODO: Implement option */ // final boolean advanced_permissions = true; 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; } if (args[0].equalsIgnoreCase("flag")) { @@ -104,7 +104,7 @@ public class Set extends SubCommand { 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; } AbstractFlag af; @@ -114,11 +114,11 @@ public class Set extends SubCommand { af = new AbstractFlag(args[1].toLowerCase()); } if (!FlagManager.getFlags().contains(af) && ((PlotSquared.worldGuardListener == null) || !PlotSquared.worldGuardListener.str_flags.contains(args[1].toLowerCase()))) { - PlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG); return false; } if (!BukkitMain.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) { - PlayerFunctions.sendMessage(plr, C.NO_PERMISSION); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PERMISSION); return false; } if (args.length == 2) { @@ -129,15 +129,15 @@ public class Set extends SubCommand { return false; } } - PlayerFunctions.sendMessage(plr, C.FLAG_NOT_IN_PLOT); + BukkitPlayerFunctions.sendMessage(plr, C.FLAG_NOT_IN_PLOT); return false; } final boolean result = FlagManager.removePlotFlag(plot, args[1].toLowerCase()); if (!result) { - PlayerFunctions.sendMessage(plr, C.FLAG_NOT_REMOVED); + BukkitPlayerFunctions.sendMessage(plr, C.FLAG_NOT_REMOVED); return false; } - PlayerFunctions.sendMessage(plr, C.FLAG_REMOVED); + BukkitPlayerFunctions.sendMessage(plr, C.FLAG_REMOVED); PlotListener.plotEntry(plr, plot); return true; } @@ -145,7 +145,7 @@ public class Set extends SubCommand { final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " "); final Object parsed_value = af.parseValueRaw(value); if (parsed_value == null) { - PlayerFunctions.sendMessage(plr, af.getValueDesc()); + BukkitPlayerFunctions.sendMessage(plr, af.getValueDesc()); return false; } if ((FlagManager.getFlag(args[1].toLowerCase()) == null) && (PlotSquared.worldGuardListener != null)) { @@ -155,14 +155,14 @@ public class Set extends SubCommand { final Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), parsed_value); final boolean result = FlagManager.addPlotFlag(plot, flag); if (!result) { - PlayerFunctions.sendMessage(plr, C.FLAG_NOT_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.FLAG_NOT_ADDED); return false; } - PlayerFunctions.sendMessage(plr, C.FLAG_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.FLAG_ADDED); PlotListener.plotEntry(plr, plot); return true; } catch (final Exception e) { - PlayerFunctions.sendMessage(plr, "&c" + e.getMessage()); + BukkitPlayerFunctions.sendMessage(plr, "&c" + e.getMessage()); return false; } } @@ -173,7 +173,7 @@ public class Set extends SubCommand { DBFunc.setPosition(plr.getWorld().getName(), plot, ""); return true; } - return PlayerFunctions.sendMessage(plr, C.HOME_ARGUMENT); + return BukkitPlayerFunctions.sendMessage(plr, C.HOME_ARGUMENT); } //set to current location final World world = plr.getWorld(); @@ -183,35 +183,35 @@ public class Set extends SubCommand { final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ()); plot.settings.setPosition(blockloc); DBFunc.setPosition(plr.getWorld().getName(), plot, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ()); - return PlayerFunctions.sendMessage(plr, C.POSITION_SET); + return BukkitPlayerFunctions.sendMessage(plr, C.POSITION_SET); } if (args[0].equalsIgnoreCase("alias")) { if (args.length < 2) { - PlayerFunctions.sendMessage(plr, C.MISSING_ALIAS); + BukkitPlayerFunctions.sendMessage(plr, C.MISSING_ALIAS); return false; } final String alias = args[1]; if (alias.length() >= 50) { - PlayerFunctions.sendMessage(plr, C.ALIAS_TOO_LONG); + BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_TOO_LONG); return false; } for (final Plot p : PlotSquared.getPlots(plr.getWorld()).values()) { if (p.settings.getAlias().equalsIgnoreCase(alias)) { - PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN); + BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN); return false; } if (UUIDHandler.nameExists(new StringWrapper(alias))) { - PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN); + BukkitPlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN); return false; } } 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; } if (args[0].equalsIgnoreCase("biome")) { if (args.length < 2) { - PlayerFunctions.sendMessage(plr, C.NEED_BIOME); + BukkitPlayerFunctions.sendMessage(plr, C.NEED_BIOME); return true; } if (args[1].length() < 2) { @@ -228,11 +228,11 @@ public class Set extends SubCommand { * } */ if (biome == null) { - PlayerFunctions.sendMessage(plr, getBiomeList(Arrays.asList(Biome.values()))); + BukkitPlayerFunctions.sendMessage(plr, getBiomeList(Arrays.asList(Biome.values()))); return true; } 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; } // Get components @@ -243,7 +243,7 @@ public class Set extends SubCommand { for (final String component : components) { if (component.equalsIgnoreCase(args[0])) { if (args.length < 2) { - PlayerFunctions.sendMessage(plr, C.NEED_BLOCK); + BukkitPlayerFunctions.sendMessage(plr, C.NEED_BLOCK); return true; } PlotBlock[] blocks; @@ -253,12 +253,12 @@ public class Set extends SubCommand { try { blocks = new PlotBlock[] { new PlotBlock((short) getMaterial(args[1], PlotWorld.BLOCKS).getId(), (byte) 0) }; } catch (final Exception e2) { - PlayerFunctions.sendMessage(plr, C.NOT_VALID_BLOCK); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_BLOCK); return false; } } manager.setComponent(world, plotworld, plot.id, component, blocks); - PlayerFunctions.sendMessage(plr, C.GENERATING_COMPONENT); + BukkitPlayerFunctions.sendMessage(plr, C.GENERATING_COMPONENT); return true; } } @@ -280,7 +280,7 @@ public class Set extends SubCommand { 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; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java index 7634e80a7..ddfe50082 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java @@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; 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; public class SetOwner extends SubCommand { @@ -52,28 +52,28 @@ public class SetOwner extends SubCommand { @Override 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)) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); return false; } if (args.length < 1) { - PlayerFunctions.sendMessage(plr, C.NEED_USER); + BukkitPlayerFunctions.sendMessage(plr, C.NEED_USER); return false; } 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; } final World world = plr.getWorld(); - final PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id; - final PlotId top = PlayerFunctions.getTopPlot(world, plot).id; - final ArrayList plots = PlayerFunctions.getPlotSelectionIds(bot, top); + final PlotId bot = BukkitPlayerFunctions.getBottomPlot(world, plot).id; + final PlotId top = BukkitPlayerFunctions.getTopPlot(world, plot).id; + final ArrayList plots = BukkitPlayerFunctions.getPlotSelectionIds(bot, top); for (final PlotId id : plots) { final Plot current = PlotSquared.getPlots(world).get(id); final UUID uuid = getUUID(args[0]); if (uuid == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[0]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[0]); return false; } current.owner = uuid; @@ -84,7 +84,7 @@ public class SetOwner extends SubCommand { } } MainUtil.setSign(world, args[0], plot); - PlayerFunctions.sendMessage(plr, C.SET_OWNER); + BukkitPlayerFunctions.sendMessage(plr, C.SET_OWNER); return true; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java index da4ff9416..64344c33e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java @@ -41,7 +41,7 @@ import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.generator.SquarePlotManager; 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 final static Map setupMap = new HashMap<>(); @@ -93,13 +93,13 @@ public class Setup extends SubCommand { updateGenerators(); final String prefix = "\n&8 - &7"; 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; } if (args.length == 1) { if (args[0].equalsIgnoreCase("cancel")) { setupMap.remove(plr.getName()); - PlayerFunctions.sendMessage(plr, "&aCancelled setup"); + BukkitPlayerFunctions.sendMessage(plr, "&aCancelled setup"); return false; } if (args[0].equalsIgnoreCase("back")) { @@ -120,14 +120,14 @@ public class Setup extends SubCommand { case 0: { // choose generator if ((args.length != 1) || !this.generators.containsKey(args[0])) { final String prefix = "\n&8 - &7"; - 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); return false; } object.generator = args[0]; object.current++; 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; } case 1: { // choose world type @@ -138,7 +138,7 @@ public class Setup extends SubCommand { types = Arrays.asList(new String[] { "default", "augmented" }); } if ((args.length != 1) || !types.contains(args[0].toLowerCase())) { - 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; } object.type = types.indexOf(args[0].toLowerCase()); @@ -150,7 +150,7 @@ public class Setup extends SubCommand { final ConfigurationNode step = object.step[object.setup_index]; sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + ""); } else { - 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++; break; @@ -158,7 +158,7 @@ public class Setup extends SubCommand { case 2: { // Choose terrain final List terrain = Arrays.asList(new String[] { "none", "ore", "all" }); 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; } object.terrain = terrain.indexOf(args[0].toLowerCase()); @@ -172,7 +172,7 @@ public class Setup extends SubCommand { } case 3: { // world setup if (object.setup_index == object.step.length) { - 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.current++; return true; @@ -202,11 +202,11 @@ public class Setup extends SubCommand { } case 4: { 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; } 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]; setupMap.remove(plr.getName()); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java index eca8c3fff..bcfe550a5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java @@ -22,7 +22,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.config.C; 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.Arrays; @@ -144,11 +144,11 @@ public abstract class SubCommand { * @param c Caption * @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...) */ public boolean sendMessage(final PlotPlayer plr, final C c, final String... args) { - PlayerFunctions.sendMessage(plr, c, args); + BukkitPlayerFunctions.sendMessage(plr, c, args); return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java index 8691d4d83..5a71ea0a5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java @@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; 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; /** @@ -46,21 +46,21 @@ public class Swap extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { if (args.length < 1) { - PlayerFunctions.sendMessage(plr, C.NEED_PLOT_ID); - PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX); + BukkitPlayerFunctions.sendMessage(plr, C.NEED_PLOT_ID); + BukkitPlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX); return false; } - if (!PlayerFunctions.isInPlot(plr)) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); + if (!BukkitPlayerFunctions.isInPlot(plr)) { + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); 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")) { - PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } if ((plot != null) && plot.settings.isMerged()) { - PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED); + BukkitPlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED); return false; } 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])); 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")) { - PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE, plotid.toString()); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE, plotid.toString()); return false; } } catch (final Exception e) { - PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); - PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); + BukkitPlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX); return false; } assert plot != null; if (plot.id.equals(plotid)) { - PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); - PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); + BukkitPlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX); return false; } PlotSelection.swap(world, plot.id, plotid); // TODO Requires testing!! DBFunc.dbManager.swapPlots(plot, MainUtil.getPlot(world, plotid)); // TODO Requires testing!! - PlayerFunctions.sendMessage(plr, C.SWAP_SUCCESS); + BukkitPlayerFunctions.sendMessage(plr, C.SWAP_SUCCESS); MainUtil.update(plr.getLocation()); return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java index 7a417e4bc..5dace5842 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java @@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions; +import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions; /** * @author Citymonstret @@ -43,7 +43,7 @@ public class TP extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { if (args.length < 1) { - PlayerFunctions.sendMessage(plr, C.NEED_PLOT_ID); + BukkitPlayerFunctions.sendMessage(plr, C.NEED_PLOT_ID); return false; } final String id = args[0]; @@ -55,7 +55,7 @@ public class TP extends SubCommand { } } if (!PlotSquared.isPlotWorld(world)) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD); return false; } Plot temp; @@ -68,7 +68,7 @@ public class TP extends SubCommand { PlotSquared.teleportPlayer(plr, plr.getLocation(), MainUtil.getPlot(world, plotid)); return true; } catch (final Exception e) { - PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); } return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Target.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Target.java index e94e9dfcc..957aa2f92 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Target.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Target.java @@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.PlotId; 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 Target() { @@ -37,21 +37,21 @@ public class Target extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { if (!PlotSquared.isPlotWorld(plr.getWorld())) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD); return false; } if (args.length == 1) { final PlotId id = MainUtil.parseId(args[1]); if (id == null) { - PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); return false; } final Location loc = MainUtil.getPlotHome(plr.getWorld(), id); plr.setCompassTarget(loc); - PlayerFunctions.sendMessage(plr, C.COMPASS_TARGET); + BukkitPlayerFunctions.sendMessage(plr, C.COMPASS_TARGET); return true; } - PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot target "); + BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot target "); return false; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java index 6b9a4d344..55068666f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java @@ -32,7 +32,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; 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 Template() { @@ -42,23 +42,23 @@ public class Template extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { if (args.length != 2) { - PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template "); + BukkitPlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template "); return false; } final World world = Bukkit.getWorld(args[1]); final PlotWorld plotworld = PlotSquared.getPlotWorld(args[1]); if ((world == null) || (plotworld == null)) { - PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD); return false; } switch (args[0].toLowerCase()) { case "import": { // TODO import template - PlayerFunctions.sendMessage(plr, "TODO"); + BukkitPlayerFunctions.sendMessage(plr, "TODO"); return true; } case "export": { - PlayerFunctions.sendMessage(plr, "TODO"); + BukkitPlayerFunctions.sendMessage(plr, "TODO"); } } // TODO allow world settings (including schematics to be packed into a single file) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java index 5bb545090..d665c91f6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java @@ -41,7 +41,7 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.TaskManager; 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 static boolean TASK = false; @@ -63,35 +63,35 @@ public class Trim extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { if (plr != null) { - PlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE)); + BukkitPlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE)); return false; } if (args.length == 1) { final String arg = args[0].toLowerCase(); final PlotId id = getId(arg); if (id != null) { - PlayerFunctions.sendMessage(plr, "/plot trim x;z &l"); + BukkitPlayerFunctions.sendMessage(plr, "/plot trim x;z &l"); return false; } if (arg.equals("all")) { - PlayerFunctions.sendMessage(plr, "/plot trim all &l"); + BukkitPlayerFunctions.sendMessage(plr, "/plot trim all &l"); return false; } - PlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX); + BukkitPlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX); return false; } if (args.length != 2) { - PlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX); + BukkitPlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX); return false; } final String arg = args[0].toLowerCase(); if (!arg.equals("all")) { - PlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX); + BukkitPlayerFunctions.sendMessage(plr, C.TRIM_SYNTAX); return false; } final World world = Bukkit.getWorld(args[1]); if ((world == null) || (PlotSquared.getPlotWorld(world) == null)) { - PlayerFunctions.sendMessage(plr, C.NOT_VALID_WORLD); + BukkitPlayerFunctions.sendMessage(plr, C.NOT_VALID_WORLD); return false; } if (Trim.TASK) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java index 2258308dc..c91a0df17 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java @@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent; 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; @SuppressWarnings("deprecation") @@ -42,20 +42,20 @@ public class Trusted extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { if (args.length < 2) { - PlayerFunctions.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT); + BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT); return true; } - if (!PlayerFunctions.isInPlot(plr)) { - PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); + if (!BukkitPlayerFunctions.isInPlot(plr)) { + BukkitPlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); return true; } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if ((plot == null) || !plot.hasOwner()) { - PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); + BukkitPlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED); return false; } 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; } if (args[0].equalsIgnoreCase("add")) { @@ -66,12 +66,12 @@ public class Trusted extends SubCommand { uuid = UUIDHandler.getUUID(args[1]); } if (uuid == null) { - PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); + BukkitPlayerFunctions.sendMessage(plr, C.INVALID_PLAYER, args[1]); return false; } if (!plot.trusted.contains(uuid)) { if (plot.owner.equals(uuid)) { - PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); + BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_OWNER); return false; } if (plot.helpers.contains(uuid)) { @@ -87,21 +87,21 @@ public class Trusted extends SubCommand { final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true); Bukkit.getPluginManager().callEvent(event); } else { - PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.ALREADY_ADDED); return false; } - PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED); return true; } else if (args[0].equalsIgnoreCase("remove")) { if (args[1].equalsIgnoreCase("*")) { final UUID uuid = DBFunc.everyone; if (!plot.trusted.contains(uuid)) { - PlayerFunctions.sendMessage(plr, C.T_WAS_NOT_ADDED); + BukkitPlayerFunctions.sendMessage(plr, C.T_WAS_NOT_ADDED); return true; } plot.removeTrusted(uuid); DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid); - PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED); + BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED); return true; } final UUID uuid = UUIDHandler.getUUID(args[1]); @@ -109,9 +109,9 @@ public class Trusted extends SubCommand { DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid); final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false); Bukkit.getPluginManager().callEvent(event); - PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED); + BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED); } else { - PlayerFunctions.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT); + BukkitPlayerFunctions.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT); return true; } return true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java index 0412ee321..e36dc937b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java @@ -4,7 +4,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.config.C; 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 @@ -19,12 +19,12 @@ public class Unban extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { 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); } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); if (!plot.hasRights(plr)) { return sendMessage(plr, C.NO_PLOT_PERMS); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java index b11024293..ea0fe0d55 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java @@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Plot; 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; public class Unclaim extends SubCommand { @@ -41,11 +41,11 @@ public class Unclaim extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { - if (!PlayerFunctions.isInPlot(plr)) { + if (!BukkitPlayerFunctions.isInPlot(plr)) { return !sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); - if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { + final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr); + if (!BukkitPlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { return !sendMessage(plr, C.UNLINK_REQUIRED); } if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr)))) && !BukkitMain.hasPermission(plr, "plots.admin.command.unclaim")) { @@ -69,9 +69,9 @@ public class Unclaim extends SubCommand { DBFunc.delete(worldname, plot); // TODO set wall block } 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; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java index 0569a23ee..0f3159866 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java @@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotWorld; 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; /** @@ -51,19 +51,19 @@ public class Unlink extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { - if (!PlayerFunctions.isInPlot(plr)) { + if (!BukkitPlayerFunctions.isInPlot(plr)) { 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")) { 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); } final World world = plr.getWorld(); if (!unlinkPlot(world, plot)) { - PlayerFunctions.sendMessage(plr, "&cUnlink has been cancelled"); + BukkitPlayerFunctions.sendMessage(plr, "&cUnlink has been cancelled"); return false; } try { @@ -76,14 +76,14 @@ public class Unlink extends SubCommand { ex.printStackTrace(); } } - PlayerFunctions.sendMessage(plr, "&6Plots unlinked successfully!"); + BukkitPlayerFunctions.sendMessage(plr, "&6Plots unlinked successfully!"); return true; } public static boolean unlinkPlot(final World world, final Plot plot) { - final PlotId pos1 = PlayerFunctions.getBottomPlot(world, plot).id; - final PlotId pos2 = PlayerFunctions.getTopPlot(world, plot).id; - final ArrayList ids = PlayerFunctions.getPlotSelectionIds(pos1, pos2); + final PlotId pos1 = BukkitPlayerFunctions.getBottomPlot(world, plot).id; + final PlotId pos2 = BukkitPlayerFunctions.getTopPlot(world, plot).id; + final ArrayList ids = BukkitPlayerFunctions.getPlotSelectionIds(pos1, pos2); final PlotUnlinkEvent event = new PlotUnlinkEvent(world, ids); Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java index 371d53149..33f56eb09 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java @@ -25,7 +25,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.BukkitMain; import com.intellectualcrafters.plot.PlotSquared; 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 WE_Anywhere() { @@ -35,15 +35,15 @@ public class WE_Anywhere extends SubCommand { @Override public boolean execute(final Player plr, final String... args) { 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; } if (BukkitMain.hasPermission(plr, "plots.worldedit.bypass") && PWE.hasMask(plr)) { PWE.removeMask(plr); - PlayerFunctions.sendMessage(plr, "&6Cleared your WorldEdit mask"); + BukkitPlayerFunctions.sendMessage(plr, "&6Cleared your WorldEdit mask"); } else { PWE.setMask(plr, plr.getLocation(), true); - PlayerFunctions.sendMessage(plr, "&6Updated your WorldEdit mask"); + BukkitPlayerFunctions.sendMessage(plr, "&6Updated your WorldEdit mask"); } return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java index 6e0c93330..a614872c7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java @@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; 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; /** @@ -65,7 +65,7 @@ public class list extends SubCommand { } else { builder.append(getArgumentList(new String[] { "all" })); } - PlayerFunctions.sendMessage(plr, builder.toString()); + BukkitPlayerFunctions.sendMessage(plr, builder.toString()); return true; } if (args[0].equalsIgnoreCase("forsale") && (plr != null)) { @@ -83,11 +83,11 @@ public class list extends SubCommand { } } if (idx == 0) { - PlayerFunctions.sendMessage(plr, C.NO_PLOTS); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOTS); return true; } string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "Includes").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots")); - PlayerFunctions.sendMessage(plr, string.toString()); + BukkitPlayerFunctions.sendMessage(plr, string.toString()); return true; } if (args[0].equalsIgnoreCase("mine") && (plr != null)) { @@ -99,11 +99,11 @@ public class list extends SubCommand { idx++; } if (idx == 0) { - PlayerFunctions.sendMessage(plr, C.NO_PLOTS); + BukkitPlayerFunctions.sendMessage(plr, C.NO_PLOTS); return true; } string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "You have").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots")); - PlayerFunctions.sendMessage(plr, string.toString()); + BukkitPlayerFunctions.sendMessage(plr, string.toString()); return true; } else if (args[0].equalsIgnoreCase("shared") && (plr != null)) { final StringBuilder string = new StringBuilder(); @@ -114,7 +114,7 @@ public class list extends SubCommand { } } string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There are").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots")); - PlayerFunctions.sendMessage(plr, string.toString()); + BukkitPlayerFunctions.sendMessage(plr, string.toString()); return true; } else if (args[0].equalsIgnoreCase("all")) { // Current page @@ -152,7 +152,7 @@ public class list extends SubCommand { string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n"); } string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots")); - PlayerFunctions.sendMessage(plr, string.toString()); + BukkitPlayerFunctions.sendMessage(plr, string.toString()); return true; } else if (args[0].equalsIgnoreCase("world") && (plr != null)) { final StringBuilder string = new StringBuilder(); @@ -162,7 +162,7 @@ public class list extends SubCommand { string.append(C.PLOT_LIST_ITEM.s().replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n"); } string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", plots.values().size() + "").replaceAll("%plot%", plots.values().size() == 1 ? "plot" : "plots")); - PlayerFunctions.sendMessage(plr, string.toString()); + BukkitPlayerFunctions.sendMessage(plr, string.toString()); return true; } else { // execute(plr); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java index 5a76e480c..2f3baee99 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java @@ -31,7 +31,7 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; 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 static String downloads, version; @@ -103,7 +103,7 @@ public class plugin extends SubCommand { } }; for (final String s : strings) { - PlayerFunctions.sendMessage(plr, s); + BukkitPlayerFunctions.sendMessage(plr, s); } } }); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java index aced4227a..a46acd270 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java @@ -12,7 +12,7 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.MainUtil; 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 @@ -109,38 +109,38 @@ public abstract class SquarePlotManager extends GridPlotManager { final boolean eastWest = (rx <= pathWidthLower) || (rx > end); if (northSouth && eastWest) { // 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); if (plot == null) { return null; } 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; } if (northSouth) { // You are on a road running West to East (yeah, I named the var // 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); if (plot == null) { return null; } if (plot.settings.getMerged(0)) { - return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id; + return BukkitPlayerFunctions.getBottomPlot(loc.getWorld(), plot).id; } return null; } if (eastWest) { // 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); if (plot == null) { return null; } if (plot.settings.getMerged(3)) { - return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id; + return BukkitPlayerFunctions.getBottomPlot(loc.getWorld(), plot).id; } return null; } @@ -149,7 +149,7 @@ public abstract class SquarePlotManager extends GridPlotManager { if (plot == null) { return id; } - return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id; + return BukkitPlayerFunctions.getBottomPlot(loc.getWorld(), plot).id; } /** diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java index 9d3ac6d03..cf8e23d8e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java @@ -34,7 +34,7 @@ import org.bukkit.util.Vector; import com.intellectualcrafters.plot.flag.FlagManager; 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; /** @@ -45,7 +45,7 @@ public class ForceFieldListener implements Listener { final Set players = new HashSet<>(); Player oPlayer; 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; } UUID uuid = UUIDHandler.getUUID(oPlayer); @@ -59,7 +59,7 @@ public class ForceFieldListener implements Listener { private Player hasNearbyPermitted(final Player player, final Plot plot) { Player oPlayer; 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; } UUID uuid = UUIDHandler.getUUID(oPlayer); @@ -96,10 +96,10 @@ public class ForceFieldListener implements Listener { @EventHandler public void onPlotEntry(final PlayerMoveEvent event) { final Player player = event.getPlayer(); - if (!PlayerFunctions.isInPlot(player)) { + if (!BukkitPlayerFunctions.isInPlot(player)) { 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 (!PlotListener.booleanFlag(plot, "forcefield", false)) { UUID uuid = UUIDHandler.getUUID(player); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/InventoryListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/InventoryListener.java index 33a6a1487..c44248d10 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/InventoryListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/InventoryListener.java @@ -9,7 +9,7 @@ import org.bukkit.event.inventory.InventoryInteractEvent; import org.bukkit.inventory.Inventory; 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 @@ -36,7 +36,7 @@ public class InventoryListener implements Listener { case 4: case 5: case 6: - PlayerFunctions.sendMessage(player, "This is not implemented yet"); + BukkitPlayerFunctions.sendMessage(player, "This is not implemented yet"); break; default: break; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java index 0dba37f39..0938277b4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java @@ -102,7 +102,7 @@ import com.intellectualcrafters.plot.object.StringWrapper; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.TaskManager; 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; /** @@ -154,7 +154,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } if (Settings.TELEPORT_ON_LOGIN) { 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); } @@ -187,7 +187,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi passed = false; } if (passed) { - PlayerFunctions.sendMessage(player, C.BORDER); + BukkitPlayerFunctions.sendMessage(player, C.BORDER); return; } } @@ -197,7 +197,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final UUID uuid = UUIDHandler.getUUID(player); if (plot.isDenied(uuid)) { 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); return; } @@ -263,7 +263,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (BukkitMain.hasPermission(player, "plots.admin.destroy.unowned")) { return; } - PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.unowned"); + BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.unowned"); event.setCancelled(true); return; } @@ -277,7 +277,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (BukkitMain.hasPermission(event.getPlayer(), "plots.admin.destroy.other")) { return; } - PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.other"); + BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.destroy.other"); event.setCancelled(true); return; } @@ -287,7 +287,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi return; } 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); return; } @@ -344,7 +344,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Location loc = BukkitUtil.getLocation(b.getLocation()); if (!isInPlot(loc)) { 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); return; } @@ -352,7 +352,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Plot plot = getCurrentPlot(loc); if ((plot == null) || !plot.hasOwner()) { 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); return; } @@ -361,7 +361,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (!plot.isAdded(uuid)) { if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) { 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); return; } @@ -527,7 +527,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (BukkitMain.hasPermission(player, "plots.admin.interact.unowned")) { return; } - PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.unowned"); + BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.unowned"); event.setCancelled(true); return; } @@ -540,7 +540,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (BukkitMain.hasPermission(player, "plots.admin.interact.other")) { return; } - PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.other"); + BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.interact.other"); event.setCancelled(true); return; } @@ -550,7 +550,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi return; } 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); return; } @@ -634,7 +634,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Player p = e.getPlayer(); if (!isInPlot(loc)) { 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); return; } @@ -642,7 +642,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Plot plot = getCurrentPlot(loc); if ((plot == null) || !plot.hasOwner()) { 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); return; } @@ -650,7 +650,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi UUID uuid = UUIDHandler.getUUID(p); if (!plot.isAdded(uuid)) if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) { 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); return; } @@ -669,7 +669,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Plot plot = getCurrentPlot(q); if (plot.isDenied(event.getPlayer())) { - PlayerFunctions.sendMessage(event.getPlayer(), C.YOU_BE_DENIED); + BukkitPlayerFunctions.sendMessage(event.getPlayer(), C.YOU_BE_DENIED); event.setCancelled(true); return; } else { @@ -701,7 +701,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (BukkitMain.hasPermission(p, "plots.admin.build.road")) { return; } - PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road"); + BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road"); e.setCancelled(true); return; } else { @@ -710,7 +710,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (BukkitMain.hasPermission(p, "plots.admin.build.unowned")) { return; } - PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned"); + BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned"); e.setCancelled(true); return; } else if (!plot.isAdded(e.getPlayer())) { @@ -722,7 +722,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi return; } 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); return; } @@ -766,7 +766,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (BukkitMain.hasPermission(p, "plots.admin.build.road")) { return; } - PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road"); + BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.road"); e.setCancelled(true); return; } else { @@ -775,7 +775,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (BukkitMain.hasPermission(p, "plots.admin.build.unowned")) { return; } - PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned"); + BukkitPlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.unowned"); e.setCancelled(true); return; } else if (!plot.isAdded(e.getPlayer())) { @@ -788,7 +788,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi return; } 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); return; } @@ -805,7 +805,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Player p = e.getPlayer(); if (!isInPlot(loc)) { 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); return; } @@ -813,7 +813,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Plot plot = getCurrentPlot(loc); if ((plot == null) || !plot.hasOwner()) { 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); return; } @@ -823,7 +823,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) { 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); return; } @@ -842,7 +842,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (isPlotWorld(l)) { if (!isInPlot(l)) { 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); return; } @@ -850,7 +850,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Plot plot = getCurrentPlot(l); if ((plot == null) || !plot.hasOwner()) { 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); return; } @@ -860,7 +860,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } if (!BukkitMain.hasPermission(p, "plots.admin.destroy.other")) { 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); return; } @@ -878,7 +878,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Player p = e.getPlayer(); if (!isInPlot(l)) { 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); return; } @@ -886,7 +886,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Plot plot = getCurrentPlot(l); if ((plot == null) || !plot.hasOwner()) { 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); return; } @@ -906,7 +906,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } if (!BukkitMain.hasPermission(p, "plots.admin.interact.other")) { 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); return; } @@ -926,7 +926,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final PlotWorld pW = getPlotWorld(l.getWorld()); if (!isInPlot(l)) { 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); return; } @@ -934,7 +934,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Plot plot = getCurrentPlot(l); if ((plot == null) || !plot.hasOwner()) { 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); return; } @@ -946,7 +946,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } if (!BukkitMain.hasPermission(p, "plots.admin.vehicle.break.other")) { 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); return; } @@ -981,7 +981,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } if (!isInPlot(l)) { 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); return; } @@ -989,7 +989,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Plot plot = getCurrentPlot(l); if ((plot == null) || !plot.hasOwner()) { 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); return; } @@ -1013,7 +1013,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } if (!BukkitMain.hasPermission(p, "plots.admin.pve.other")) { 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); return; } @@ -1034,7 +1034,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Player p = e.getPlayer(); if (!isInPlot(l)) { 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); return; } @@ -1042,14 +1042,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Plot plot = getCurrentPlot(l); if ((plot == null) || !plot.hasOwner()) { 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); return; } } else if (!plot.isAdded(p)) { if (!BukkitMain.hasPermission(p, "plots.admin.projectile.other")) { 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); return; } @@ -1077,7 +1077,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (BukkitMain.hasPermission(player, "plots.admin.build.unowned")) { return; } - PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.unowned"); + BukkitPlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.build.unowned"); event.setCancelled(true); return; } @@ -1088,7 +1088,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi return; } 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); return; } @@ -1097,7 +1097,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } if (!BukkitMain.hasPermission(player, "plots.admin.build.road")) { 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); return; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java index d1d642b60..5f7c23ff0 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java @@ -14,7 +14,7 @@ import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.util.MainUtil; 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; 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(); if (!isInPlot(l)) { 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); } } else { final Plot plot = MainUtil.getPlot(l); if ((plot == null) || !plot.hasOwner()) { 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); } } else { @@ -40,7 +40,7 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener { if (!plot.isAdded(uuid)) { if (!BukkitMain.hasPermission(p, "plots.admin.interact.other")) { 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); } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java index 183ff5d6e..0ff8ee142 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java @@ -54,7 +54,7 @@ import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.util.MainUtil; 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; /** @@ -108,12 +108,12 @@ public class PlotPlusListener extends PlotListener implements Listener { event.setCancelled(true); final Plot plot = MainUtil.getPlot(BukkitUtil.getLocation(player)); if (plot == null) { - PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT); + BukkitPlayerFunctions.sendMessage(player, C.NOT_IN_PLOT); return; } UUID uuid = UUIDHandler.getUUID(player); if (!plot.isAdded(uuid)) { - PlayerFunctions.sendMessage(player, C.NO_PLOT_PERMS); + BukkitPlayerFunctions.sendMessage(player, C.NO_PLOT_PERMS); return; } final Set plotPlayers = new HashSet<>(); @@ -135,7 +135,7 @@ public class PlotPlusListener extends PlotListener implements Listener { } for (final Player p : plotPlayers) { 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; } 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; } 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())); } } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java index a9e85a832..ba8da2423 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java @@ -50,7 +50,7 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; 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.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.LocalSession; @@ -149,16 +149,16 @@ public class WorldEditListener implements Listener { final LocalSession session = PlotSquared.worldEdit.getSession(p); final Mask mask = session.getMask(); if (mask == null) { - PlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Both points"); + BukkitPlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Both points"); return; } if (!mask.test(pos1)) { 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)) { e.setCancelled(true); - PlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Position 2"); + BukkitPlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Position 2"); } } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java index b313f4d8d..33731488c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java @@ -25,7 +25,7 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotWorld; 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.UUIDHandler; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java index e7794a636..974a58b0c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -23,7 +23,7 @@ import com.intellectualcrafters.plot.object.BukkitPlayer; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotManager; 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; public class ExpireManager { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index d08a764f5..344a28fd0 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -43,7 +43,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotSettings; import com.intellectualcrafters.plot.object.PlotWorld; 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; /** diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java new file mode 100644 index 000000000..b59e39b85 --- /dev/null +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java @@ -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 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 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 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(), new ArrayList(), world); + } + + /** + * Get the plots for a player + * + * @param plr + * + * @return + */ + public static Set getPlayerPlots(final String world, final Player plr) { + final Set 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; + } +}