From da58c7b411b52913c2d2e54b1245146837e6d033 Mon Sep 17 00:00:00 2001 From: MattBDev Date: Thu, 2 Jun 2016 11:38:47 -0400 Subject: [PATCH] Beautify code --- .../plot/api/PlotAPI.java | 13 +- .../database/plotme/APlotMeConnector.java | 12 +- .../bukkit/listeners/ChunkListener.java | 13 +- .../bukkit/listeners/ForceFieldListener.java | 33 +- .../bukkit/listeners/PlayerEvents.java | 113 +++---- .../bukkit/listeners/PlayerEvents183.java | 12 +- .../bukkit/object/entity/EntityWrapper.java | 34 +- .../bukkit/util/BukkitChunkManager.java | 10 +- .../bukkit/util/BukkitSetupUtils.java | 4 +- .../plotsquared/bukkit/util/BukkitUtil.java | 32 +- .../plotsquared/bukkit/util/SendChunk.java | 14 +- .../bukkit/util/block/FastQueue_1_8_3.java | 3 +- .../plot/commands/Add.java | 3 +- .../plot/commands/Alias.java | 14 +- .../plot/commands/Auto.java | 58 ++-- .../plot/commands/BO3.java | 24 +- .../plot/commands/Biome.java | 10 +- .../plot/commands/Claim.java | 46 +-- .../plot/commands/Cluster.java | 314 +++++++++--------- .../plot/commands/Condense.java | 56 ++-- .../plot/commands/Confirm.java | 10 +- .../plot/commands/Continue.java | 20 +- .../plot/commands/Copy.java | 24 +- .../plot/commands/Debug.java | 10 +- .../plot/commands/DebugAllowUnsafe.java | 13 +- .../plot/commands/DebugClaimTest.java | 24 +- .../plot/commands/DebugFixFlags.java | 8 +- .../plot/commands/DebugLoadTest.java | 2 +- .../plot/commands/DebugPaste.java | 6 +- .../plot/commands/DebugRoadRegen.java | 14 +- .../plot/commands/DebugSaveTest.java | 6 +- .../plot/commands/Delete.java | 32 +- .../plot/commands/Deny.java | 51 +-- .../plot/commands/Desc.java | 8 +- .../plot/commands/Done.java | 20 +- .../plot/commands/Download.java | 50 +-- .../plot/commands/Grant.java | 15 +- .../plot/commands/Kick.java | 41 +-- .../plot/commands/ListCmd.java | 92 ++--- .../plot/commands/Load.java | 52 +-- .../plot/commands/Merge.java | 78 ++--- .../plot/commands/Move.java | 24 +- .../plot/commands/Owner.java | 20 +- .../plot/commands/PluginCmd.java | 10 +- .../plot/commands/Purge.java | 20 +- .../plot/commands/RegenAllRoads.java | 22 +- .../plot/commands/Reload.java | 6 +- .../plot/commands/Remove.java | 24 +- .../plot/commands/Save.java | 28 +- .../plot/commands/SchematicCmd.java | 78 ++--- .../plot/commands/Set.java | 52 +-- .../plot/commands/SetCommand.java | 26 +- .../plot/commands/SetHome.java | 10 +- .../plot/commands/Setup.java | 92 ++--- .../plot/commands/SubCommand.java | 2 +- .../plot/commands/Swap.java | 24 +- .../plot/commands/Target.java | 20 +- .../plot/commands/Template.java | 34 +- .../plot/commands/Trim.java | 10 +- .../plot/commands/Trust.java | 3 +- .../plot/commands/Unlink.java | 24 +- .../plot/commands/Update.java | 14 +- .../intellectualcrafters/plot/config/C.java | 24 +- .../plot/generator/ClassicPlotManager.java | 279 ++++++++-------- .../plot/generator/GridPlotWorld.java | 8 +- .../plot/generator/HybridPlotManager.java | 40 +-- .../plot/generator/HybridUtils.java | 44 +-- .../plot/generator/PlotGenerator.java | 2 +- .../plot/generator/SquarePlotManager.java | 26 +- .../plot/object/PlotCluster.java | 6 +- .../plot/object/PlotManager.java | 46 +-- .../plot/util/EventUtil.java | 136 ++++---- .../plot/util/MainUtil.java | 38 +-- .../plot/util/Permissions.java | 30 +- .../plot/util/SetupUtils.java | 6 +- .../plotsquared/sponge/SpongeSetupUtils.java | 4 +- .../sponge/util/SpongeSetupUtils.java | 4 +- 77 files changed, 1319 insertions(+), 1311 deletions(-) diff --git a/Bukkit/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java b/Bukkit/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java index 21d26ec84..ef6230c8f 100644 --- a/Bukkit/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java +++ b/Bukkit/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java @@ -28,6 +28,7 @@ import org.bukkit.plugin.java.JavaPlugin; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.UUID; @@ -192,9 +193,9 @@ public class PlotAPI { @Deprecated public String[] getPermissions() { ArrayList perms = new ArrayList<>(); - for (C c : C.values()) { - if ("static.permissions".equals(c.getCategory())) { - perms.add(c.s()); + for (C caption : C.values()) { + if ("static.permissions".equals(caption.getCategory())) { + perms.add(caption.s()); } } return perms.toArray(new String[perms.size()]); @@ -249,7 +250,7 @@ public class PlotAPI { */ public Set getPlotAreas(World world) { if (world == null) { - return new HashSet<>(); + return Collections.emptySet(); } return PS.get().getPlotAreas(world.getName()); } @@ -661,8 +662,8 @@ public class PlotAPI { * */ public int getAllowedPlots(Player player) { - PlotPlayer pp = PlotPlayer.wrap(player); - return pp.getAllowedPlots(); + PlotPlayer plotPlayer = PlotPlayer.wrap(player); + return plotPlayer.getAllowedPlots(); } /** diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/APlotMeConnector.java b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/APlotMeConnector.java index 7bdd9902a..d08880ca3 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/APlotMeConnector.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/APlotMeConnector.java @@ -42,17 +42,17 @@ public abstract class APlotMeConnector { PS.get().config.set("worlds." + actualWorldName + ".wall.height", height); } - public Location getPlotTopLocAbs(int path, int plot, PlotId plotid) { - int px = plotid.x; - int pz = plotid.y; + public Location getPlotTopLocAbs(int path, int plot, PlotId plotId) { + int px = plotId.x; + int pz = plotId.y; int x = px * (path + plot) - (int) Math.floor(path / 2) - 1; int z = pz * (path + plot) - (int) Math.floor(path / 2) - 1; return new Location(null, x, 256, z); } - public Location getPlotBottomLocAbs(int path, int plot, PlotId plotid) { - int px = plotid.x; - int pz = plotid.y; + public Location getPlotBottomLocAbs(int path, int plot, PlotId plotId) { + int px = plotId.x; + int pz = plotId.y; int x = px * (path + plot) - plot - (int) Math.floor(path / 2) - 1; int z = pz * (path + plot) - plot - (int) Math.floor(path / 2) - 1; return new Location(null, x, 1, z); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java index ab68b1adc..94cb85ad0 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java @@ -1,5 +1,7 @@ package com.plotsquared.bukkit.listeners; +import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.Location; @@ -8,8 +10,6 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass; import com.intellectualcrafters.plot.util.ReflectionUtils.RefField; import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod; import com.intellectualcrafters.plot.util.TaskManager; -import java.lang.reflect.Method; -import java.util.HashSet; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Material; @@ -28,8 +28,8 @@ import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkUnloadEvent; - -import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; +import java.lang.reflect.Method; +import java.util.HashSet; public class ChunkListener implements Listener { @@ -134,10 +134,7 @@ public class ChunkListener implements Listener { return true; } plot = new Location(world, x + 7, 1, z + 7).getOwnedPlotAbs(); - if (plot != null && plot.hasOwner()) { - return true; - } - return false; + return plot != null && plot.hasOwner(); } @EventHandler diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ForceFieldListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ForceFieldListener.java index 3c80a7a8c..65e8e2f0f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ForceFieldListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ForceFieldListener.java @@ -13,6 +13,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.util.Vector; + import java.util.HashSet; import java.util.Set; import java.util.UUID; @@ -22,12 +23,12 @@ public class ForceFieldListener implements Listener { private Set getNearbyPlayers(Player player, Plot plot) { Set players = new HashSet<>(); for (Entity entity : player.getNearbyEntities(5d, 5d, 5d)) { - PlotPlayer pp; - if (!(entity instanceof Player) || ((pp = BukkitUtil.getPlayer((Player) entity)) == null) || !plot.equals(pp.getCurrentPlot())) { + PlotPlayer plotPlayer; + if (!(entity instanceof Player) || ((plotPlayer = BukkitUtil.getPlayer((Player) entity)) == null) || !plot.equals(plotPlayer.getCurrentPlot())) { continue; } - if (!plot.isAdded(pp.getUUID())) { - players.add(pp); + if (!plot.isAdded(plotPlayer.getUUID())) { + players.add(plotPlayer); } } return players; @@ -38,22 +39,22 @@ public class ForceFieldListener implements Listener { if (!(entity instanceof Player)) { continue; } - PlotPlayer pp; - if ((pp = BukkitUtil.getPlayer((Player) entity)) == null) { + PlotPlayer plotPlayer; + if ((plotPlayer = BukkitUtil.getPlayer((Player) entity)) == null) { continue; } - if (!plot.equals(pp.getCurrentPlot())) { + if (!plot.equals(plotPlayer.getCurrentPlot())) { continue; } - if (plot.isAdded(pp.getUUID())) { - return pp; + if (plot.isAdded(plotPlayer.getUUID())) { + return plotPlayer; } } return null; } - private Vector calculateVelocity(PlotPlayer pp, PlotPlayer e) { - Location playerLocation = pp.getLocationFull(); + private Vector calculateVelocity(PlotPlayer player, PlotPlayer e) { + Location playerLocation = player.getLocationFull(); Location oPlayerLocation = e.getLocation(); double playerX = playerLocation.getX(); double playerY = playerLocation.getY(); @@ -85,25 +86,25 @@ public class ForceFieldListener implements Listener { @EventHandler public void onPlotEntry(PlayerMoveEvent event) { Player player = event.getPlayer(); - PlotPlayer pp = BukkitUtil.getPlayer(player); - Plot plot = pp.getCurrentPlot(); + PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); + Plot plot = plotPlayer.getCurrentPlot(); if (plot == null) { return; } Optional forcefield = plot.getFlag(Flags.FORCEFIELD); if (forcefield.isPresent() && forcefield.get()) { - UUID uuid = pp.getUUID(); + UUID uuid = plotPlayer.getUUID(); if (plot.isAdded(uuid)) { Set players = getNearbyPlayers(player, plot); for (PlotPlayer oPlayer : players) { - ((BukkitPlayer) oPlayer).player.setVelocity(calculateVelocity(pp, oPlayer)); + ((BukkitPlayer) oPlayer).player.setVelocity(calculateVelocity(plotPlayer, oPlayer)); } } else { PlotPlayer oPlayer = hasNearbyPermitted(player, plot); if (oPlayer == null) { return; } - player.setVelocity(calculateVelocity(oPlayer, pp)); + player.setVelocity(calculateVelocity(oPlayer, plotPlayer)); } } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 382b1d1a5..44375583a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -109,6 +109,7 @@ import org.bukkit.plugin.Plugin; import org.bukkit.projectiles.BlockProjectileSource; import org.bukkit.projectiles.ProjectileSource; import org.bukkit.util.Vector; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -609,44 +610,44 @@ public class PlayerEvents extends PlotListener implements Listener { @EventHandler(priority = EventPriority.LOWEST) public void blockDestroy(BlockBreakEvent event) { Player player = event.getPlayer(); - Location loc = BukkitUtil.getLocation(event.getBlock().getLocation()); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(event.getBlock().getLocation()); + PlotArea area = location.getPlotArea(); if (area == null) { return; } - Plot plot = area.getPlotAbs(loc); + Plot plot = area.getPlotAbs(location); if (plot != null) { - PlotPlayer pp = BukkitUtil.getPlayer(player); + PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); if (event.getBlock().getY() == 0) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL); + if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL); event.setCancelled(true); return; } } if (!plot.hasOwner()) { - if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) { + if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) { return; } - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_UNOWNED); + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_UNOWNED); event.setCancelled(true); return; } - if (!plot.isAdded(pp.getUUID())) { + if (!plot.isAdded(plotPlayer.getUUID())) { Optional> destroy = plot.getFlag(Flags.BREAK); Block block = event.getBlock(); if (destroy.isPresent() && destroy.get() .contains(new PlotBlock((short) block.getTypeId(), block.getData()))) { return; } - if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER)) { + if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) { return; } - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER); + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER); event.setCancelled(true); } else if (Settings.DONE_RESTRICTS_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); + if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); return; } @@ -822,19 +823,19 @@ public class PlayerEvents extends PlotListener implements Listener { return; } if (!plot.hasOwner()) { - PlotPlayer pp = BukkitUtil.getPlayer(player); - if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) { + PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); + if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) { return; } event.setCancelled(true); return; } - PlotPlayer pp = BukkitUtil.getPlayer(player); - if (!plot.isAdded(pp.getUUID())) { + PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); + if (!plot.isAdded(plotPlayer.getUUID())) { Optional> destroy = plot.getFlag(Flags.BREAK); Block block = event.getBlock(); if (destroy.isPresent() && destroy.get().contains(new PlotBlock((short) block.getTypeId(), block.getData())) || Permissions - .hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER)) { + .hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) { return; } event.setCancelled(true); @@ -842,8 +843,8 @@ public class PlayerEvents extends PlotListener implements Listener { } return; } - PlotPlayer pp = BukkitUtil.getPlayer(player); - if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) { + PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); + if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_ROAD)) { return; } event.setCancelled(true); @@ -2169,70 +2170,70 @@ public class PlayerEvents extends PlotListener implements Listener { player = null; } if (player != null) { - PlotPlayer pp = BukkitUtil.getPlayer(player); + PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); if (victim instanceof Hanging) { // hanging - if (plot != null && (plot.getFlag(Flags.HANGING_BREAK, false) || plot.isAdded(pp.getUUID()))) { + if (plot != null && (plot.getFlag(Flags.HANGING_BREAK, false) || plot.isAdded(plotPlayer.getUUID()))) { return true; } - if (!Permissions.hasPermission(pp, "plots.admin.destroy." + stub)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.destroy." + stub); + if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.destroy." + stub); return false; } } else if (victim.getEntityId() == 30) { - if (plot != null && (plot.getFlag(Flags.MISC_BREAK, false) || plot.isAdded(pp.getUUID()))) { + if (plot != null && (plot.getFlag(Flags.MISC_BREAK, false) || plot.isAdded(plotPlayer.getUUID()))) { return true; } - if (!Permissions.hasPermission(pp, "plots.admin.destroy." + stub)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.destroy." + stub); + if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.destroy." + stub); return false; } } else if (victim instanceof Monster || victim instanceof EnderDragon) { // victim is monster if (plot != null && (plot.getFlag(Flags.HOSTILE_ATTACK, false) || plot.getFlag(Flags.PVE, false) || plot - .isAdded(pp.getUUID()))) { + .isAdded(plotPlayer.getUUID()))) { return true; } - if (!Permissions.hasPermission(pp, "plots.admin.pve." + stub)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub); + if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub); return false; } } else if (victim instanceof Tameable) { // victim is tameable - if (plot != null && (plot.getFlag(Flags.TAMED_ATTACK, false) || plot.getFlag(Flags.PVE, false) || plot.isAdded(pp.getUUID()))) { + if (plot != null && (plot.getFlag(Flags.TAMED_ATTACK, false) || plot.getFlag(Flags.PVE, false) || plot.isAdded(plotPlayer.getUUID()))) { return true; } - if (!Permissions.hasPermission(pp, "plots.admin.pve." + stub)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub); + if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub); return false; } } else if (victim instanceof Player) { if (plot != null) { - if (Flags.PVP.isFalse(plot) && !Permissions.hasPermission(pp, "plots.admin.pvp." + stub)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.pvp." + stub); + if (Flags.PVP.isFalse(plot) && !Permissions.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pvp." + stub); return false; } else { return true; } } - if (!Permissions.hasPermission(pp, "plots.admin.pvp." + stub)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.pvp." + stub); + if (!Permissions.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pvp." + stub); return false; } } else if (victim instanceof Creature) { // victim is animal if (plot != null && (plot.getFlag(Flags.ANIMAL_ATTACK, false) || plot.getFlag(Flags.PVE, false) || plot - .isAdded(pp.getUUID()))) { + .isAdded(plotPlayer.getUUID()))) { return true; } - if (!Permissions.hasPermission(pp, "plots.admin.pve." + stub)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub); + if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub); return false; } } else if (victim instanceof Vehicle) { // Vehicles are managed in vehicle destroy event return true; } else { // victim is something else - if (plot != null && (plot.getFlag(Flags.PVE, false) || plot.isAdded(pp.getUUID()))) { + if (plot != null && (plot.getFlag(Flags.PVE, false) || plot.isAdded(plotPlayer.getUUID()))) { return true; } - if (!Permissions.hasPermission(pp, "plots.admin.pve." + stub)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub); + if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub); return false; } } @@ -2249,22 +2250,22 @@ public class PlayerEvents extends PlotListener implements Listener { if (area == null) { return; } - Player p = event.getPlayer(); - PlotPlayer pp = BukkitUtil.getPlayer(p); + Player player = event.getPlayer(); + PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); Plot plot = area.getPlot(l); if (plot == null) { - if (!Permissions.hasPermission(pp, "plots.admin.projectile.road")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.projectile.road"); + if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.road")) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.road"); event.setHatching(false); } } else if (!plot.hasOwner()) { - if (!Permissions.hasPermission(pp, "plots.admin.projectile.unowned")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.projectile.unowned"); + if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.unowned")) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.unowned"); event.setHatching(false); } - } else if (!plot.isAdded(pp.getUUID())) { - if (!Permissions.hasPermission(pp, "plots.admin.projectile.other")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.projectile.other"); + } else if (!plot.isAdded(plotPlayer.getUUID())) { + if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.other")) { + MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.other"); event.setHatching(false); } } @@ -2272,14 +2273,14 @@ public class PlayerEvents extends PlotListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void blockCreate(BlockPlaceEvent event) { - Location loc = BukkitUtil.getLocation(event.getBlock().getLocation()); - PlotArea area = loc.getPlotArea(); + Location location = BukkitUtil.getLocation(event.getBlock().getLocation()); + PlotArea area = location.getPlotArea(); if (area == null) { return; } Player player = event.getPlayer(); PlotPlayer pp = BukkitUtil.getPlayer(player); - Plot plot = area.getPlotAbs(loc); + Plot plot = area.getPlotAbs(location); if (plot != null) { if (!plot.hasOwner()) { if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) { @@ -2313,7 +2314,7 @@ public class PlayerEvents extends PlotListener implements Listener { sendBlockChange(block.getLocation(), block.getType(), block.getData()); } } - if (loc.getY() > area.MAX_BUILD_HEIGHT && loc.getY() < area.MIN_BUILD_HEIGHT && !Permissions + if (location.getY() > area.MAX_BUILD_HEIGHT && location.getY() < area.MIN_BUILD_HEIGHT && !Permissions .hasPermission(pp, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) { event.setCancelled(true); MainUtil.sendMessage(pp, C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents183.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents183.java index ae77d6fea..f58cee225 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents183.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents183.java @@ -18,23 +18,23 @@ public class PlayerEvents183 implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBigBoom(BlockExplodeEvent event) { Block block = event.getBlock(); - Location loc = BukkitUtil.getLocation(block.getLocation()); - String world = loc.getWorld(); + Location location = BukkitUtil.getLocation(block.getLocation()); + String world = location.getWorld(); if (!PS.get().hasPlotArea(world)) { return; } - PlotArea area = loc.getPlotArea(); + PlotArea area = location.getPlotArea(); if (area == null) { Iterator iterator = event.blockList().iterator(); while (iterator.hasNext()) { - loc = BukkitUtil.getLocation(iterator.next().getLocation()); - if (loc.getPlotArea() != null) { + location = BukkitUtil.getLocation(iterator.next().getLocation()); + if (location.getPlotArea() != null) { iterator.remove(); } } return; } - Plot plot = area.getOwnedPlot(loc); + Plot plot = area.getOwnedPlot(location); if (plot == null || !plot.getFlag(Flags.EXPLOSION).or(false)) { event.setCancelled(true); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java b/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java index 4404ca0a4..2322bb49f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java @@ -61,12 +61,12 @@ public class EntityWrapper { public EntityWrapper(Entity entity, short depth) { this.hash = entity.getEntityId(); this.depth = depth; - Location loc = entity.getLocation(); - this.yaw = loc.getYaw(); - this.pitch = loc.getPitch(); - this.x = loc.getX(); - this.y = loc.getY(); - this.z = loc.getZ(); + Location location = entity.getLocation(); + this.yaw = location.getYaw(); + this.pitch = location.getPitch(); + this.x = location.getX(); + this.y = location.getY(); + this.z = location.getZ(); this.type = entity.getType(); if (depth == 0) { return; @@ -376,10 +376,10 @@ public class EntityWrapper { this.lived.persistent = lived.getRemoveWhenFarAway(); this.lived.leashed = lived.isLeashed(); if (this.lived.leashed) { - Location loc = lived.getLeashHolder().getLocation(); - this.lived.leash_x = (short) (this.x - loc.getBlockX()); - this.lived.leash_y = (short) (this.y - loc.getBlockY()); - this.lived.leash_z = (short) (this.z - loc.getBlockZ()); + Location location = lived.getLeashHolder().getLocation(); + this.lived.leash_x = (short) (this.x - location.getBlockX()); + this.lived.leash_y = (short) (this.y - location.getBlockY()); + this.lived.leash_z = (short) (this.z - location.getBlockZ()); } EntityEquipment equipment = lived.getEquipment(); this.lived.equipped = equipment != null; @@ -435,27 +435,27 @@ public class EntityWrapper { } public Entity spawn(World world, int x_offset, int z_offset) { - Location loc = new Location(world, this.x + x_offset, this.y, this.z + z_offset); - loc.setYaw(this.yaw); - loc.setPitch(this.pitch); + Location location = new Location(world, this.x + x_offset, this.y, this.z + z_offset); + location.setYaw(this.yaw); + location.setPitch(this.pitch); if (!this.type.isSpawnable()) { return null; } Entity entity; switch (this.type) { case DROPPED_ITEM: - return world.dropItem(loc, this.stack); + return world.dropItem(location, this.stack); case PLAYER: case LEASH_HITCH: return null; case ITEM_FRAME: - entity = world.spawn(loc, ItemFrame.class); + entity = world.spawn(location, ItemFrame.class); break; case PAINTING: - entity = world.spawn(loc, Painting.class); + entity = world.spawn(location, Painting.class); break; default: - entity = world.spawnEntity(loc, this.type); + entity = world.spawnEntity(location, this.type); break; } if (this.depth == 0) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java index 54769acc1..f5496fedb 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java @@ -376,8 +376,8 @@ public class BukkitChunkManager extends ChunkManager { int tz = pos2.getZ(); for (Entity entity : entities) { if (!(entity instanceof Player)) { - org.bukkit.Location loc = entity.getLocation(); - if (loc.getX() >= bx && loc.getX() <= tx && loc.getZ() >= bz && loc.getZ() <= tz) { + org.bukkit.Location location = entity.getLocation(); + if (location.getX() >= bx && location.getX() <= tx && location.getZ() >= bz && location.getZ() <= tz) { entity.remove(); } } @@ -472,15 +472,15 @@ public class BukkitChunkManager extends ChunkManager { int[] count = new int[6]; if (doWhole) { for (Entity entity : entities) { - org.bukkit.Location loc = entity.getLocation(); - Chunk chunk = loc.getChunk(); + org.bukkit.Location location = entity.getLocation(); + Chunk chunk = location.getChunk(); if (chunks.contains(chunk)) { int X = chunk.getX(); int Z = chunk.getZ(); if (X > bx && X < tx && Z > bz && Z < tz) { count(count, entity); } else { - Plot other = area.getPlot(BukkitUtil.getLocation(loc)); + Plot other = area.getPlot(BukkitUtil.getLocation(location)); if (plot.equals(other)) { count(count, entity); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java index d834052e4..2b05da7cd 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -179,11 +179,11 @@ public class BukkitSetupUtils extends SetupUtils { } @Override - public String getGenerator(PlotArea plotworld) { + public String getGenerator(PlotArea plotArea) { if (SetupUtils.generators.isEmpty()) { updateGenerators(); } - World world = Bukkit.getWorld(plotworld.worldname); + World world = Bukkit.getWorld(plotArea.worldname); if (world == null) { return null; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java index a7b8990d6..1627b1c25 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -43,7 +43,7 @@ public class BukkitUtil extends WorldUtil { private static Player lastPlayer = null; private static PlotPlayer lastPlotPlayer = null; - public static void removePlayer(String plr) { + public static void removePlayer(String player) { lastPlayer = null; lastPlotPlayer = null; } @@ -62,9 +62,9 @@ public class BukkitUtil extends WorldUtil { return lastPlotPlayer; } String name = player.getName(); - PlotPlayer pp = UUIDHandler.getPlayer(name); - if (pp != null) { - return pp; + PlotPlayer plotPlayer = UUIDHandler.getPlayer(name); + if (plotPlayer != null) { + return plotPlayer; } lastPlotPlayer = new BukkitPlayer(player); UUIDHandler.getPlayers().put(name, lastPlotPlayer); @@ -102,15 +102,15 @@ public class BukkitUtil extends WorldUtil { } public static Location getLocation(Entity entity) { - org.bukkit.Location loc = entity.getLocation(); - String world = loc.getWorld().getName(); - return new Location(world, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + org.bukkit.Location location = entity.getLocation(); + String world = location.getWorld().getName(); + return new Location(world, location.getBlockX(), location.getBlockY(), location.getBlockZ()); } public static Location getLocationFull(Entity entity) { - org.bukkit.Location loc = entity.getLocation(); - return new Location(loc.getWorld().getName(), MathMan.roundInt(loc.getX()), MathMan.roundInt(loc.getY()), MathMan.roundInt(loc.getZ()), - loc.getYaw(), loc.getPitch()); + org.bukkit.Location location = entity.getLocation(); + return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()), MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), + location.getYaw(), location.getPitch()); } @Override @@ -158,8 +158,8 @@ public class BukkitUtil extends WorldUtil { } @Override - public Location getSpawn(PlotPlayer pp) { - return getLocation(((BukkitPlayer) pp).player.getBedSpawnLocation()); + public Location getSpawn(PlotPlayer player) { + return getLocation(((BukkitPlayer) player).player.getBedSpawnLocation()); } @Override @@ -190,9 +190,9 @@ public class BukkitUtil extends WorldUtil { } @Override - public int getBiomeFromString(String biomeStr) { + public int getBiomeFromString(String biomeString) { try { - Biome biome = Biome.valueOf(biomeStr.toUpperCase()); + Biome biome = Biome.valueOf(biomeString.toUpperCase()); return Arrays.asList(Biome.values()).indexOf(biome); } catch (IllegalArgumentException ignored) { return -1; @@ -300,9 +300,9 @@ public class BukkitUtil extends WorldUtil { } @Override - public void setBiomes(String worldName, RegionWrapper region, String biomeStr) { + public void setBiomes(String worldName, RegionWrapper region, String biomeString) { World world = getWorld(worldName); - Biome biome = Biome.valueOf(biomeStr.toUpperCase()); + Biome biome = Biome.valueOf(biomeString.toUpperCase()); for (int x = region.minX; x <= region.maxX; x++) { for (int z = region.minZ; z <= region.maxZ; z++) { world.setBiome(x, z, biome); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/SendChunk.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/SendChunk.java index c8e29430e..2016a7177 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/SendChunk.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/SendChunk.java @@ -86,23 +86,23 @@ public class SendChunk { for (Entry entry : UUIDHandler.getPlayers().entrySet()) { PlotPlayer pp = entry.getValue(); Plot plot = pp.getCurrentPlot(); - Location loc = null; + Location location = null; String world; if (plot != null) { world = plot.getArea().worldname; } else { - loc = pp.getLocation(); - world = loc.getWorld(); + location = pp.getLocation(); + world = location.getWorld(); } ArrayList list = map.get(world); if (list == null) { continue; } - if (loc == null) { - loc = pp.getLocation(); + if (location == null) { + location = pp.getLocation(); } - int cx = loc.getX() >> 4; - int cz = loc.getZ() >> 4; + int cx = location.getX() >> 4; + int cz = location.getZ() >> 4; Player player = ((BukkitPlayer) pp).player; Object entity = this.methodGetHandlePlayer.of(player).call(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java index 7f1cb32b9..e04449c35 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java @@ -280,7 +280,6 @@ public class FastQueue_1_8_3 extends SlowQueue { if (fixAll && !(boolean) this.methodAreNeighborsLoaded.of(c).call(1)) { World world = chunk.getWorld(); ChunkWrapper wrapper = bc.getChunkWrapper(); - String worldName = wrapper.world; for (int x = wrapper.x - 1; x <= wrapper.x + 1; x++) { for (int z = wrapper.z - 1; z <= wrapper.z + 1; z++) { if (x != 0 && z != 0) { @@ -288,7 +287,7 @@ public class FastQueue_1_8_3 extends SlowQueue { while (!other.isLoaded()) { other.load(true); } - ChunkManager.manager.loadChunk(worldName, new ChunkLoc(x, z), true); + ChunkManager.manager.loadChunk(wrapper.world, new ChunkLoc(x, z), true); } } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java index e7c539817..94f9089ce 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java @@ -11,6 +11,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.plotsquared.general.commands.Command; import com.plotsquared.general.commands.CommandDeclaration; + import java.util.Iterator; import java.util.Set; import java.util.UUID; @@ -36,7 +37,7 @@ public class Add extends Command { checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.trust"), C.NO_PLOT_PERMS); checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage()); final Set uuids = MainUtil.getUUIDsFromString(args[0]); - checkTrue(uuids != null && !uuids.isEmpty(), C.INVALID_PLAYER, args[0]); + checkTrue(!uuids.isEmpty(), C.INVALID_PLAYER, args[0]); Iterator iter = uuids.iterator(); int size = plot.getTrusted().size() + plot.getMembers().size(); while (iter.hasNext()) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Alias.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Alias.java index a6c4f3f80..5a28761c8 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Alias.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Alias.java @@ -21,31 +21,31 @@ import com.plotsquared.general.commands.CommandDeclaration; public class Alias extends SetCommand { @Override - public boolean set(PlotPlayer plr, Plot plot, String alias) { + public boolean set(PlotPlayer player, Plot plot, String alias) { if (alias.isEmpty()) { - C.COMMAND_SYNTAX.send(plr, getUsage()); + C.COMMAND_SYNTAX.send(player, getUsage()); return false; } if (alias.length() >= 50) { - MainUtil.sendMessage(plr, C.ALIAS_TOO_LONG); + MainUtil.sendMessage(player, C.ALIAS_TOO_LONG); return false; } if (alias.contains(" ") || !StringMan.isAsciiPrintable(alias)) { - C.NOT_VALID_VALUE.send(plr); + C.NOT_VALID_VALUE.send(player); return false; } for (Plot p : PS.get().getPlots(plot.getArea())) { if (p.getAlias().equalsIgnoreCase(alias)) { - MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN); + MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN); return false; } } if (UUIDHandler.nameExists(new StringWrapper(alias)) || PS.get().hasPlotArea(alias)) { - MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN); + MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN); return false; } plot.setAlias(alias); - MainUtil.sendMessage(plr, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias)); + MainUtil.sendMessage(player, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias)); return true; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index 041368a0f..7d8c8a1c7 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -51,23 +51,23 @@ public class Auto extends SubCommand { } @Override - public boolean onCommand(PlotPlayer plr, String[] args) { - PlotArea plotarea = plr.getApplicablePlotArea(); + public boolean onCommand(PlotPlayer player, String[] args) { + PlotArea plotarea = player.getApplicablePlotArea(); if (plotarea == null) { - MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD); + MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD); return false; } int size_x = 1; int size_z = 1; String schematic = null; if (args.length > 0) { - if (Permissions.hasPermission(plr, "plots.auto.mega")) { + if (Permissions.hasPermission(player, "plots.auto.mega")) { try { String[] split = args[0].split(",|;"); size_x = Integer.parseInt(split[0]); size_z = Integer.parseInt(split[1]); if (size_x < 1 || size_z < 1) { - MainUtil.sendMessage(plr, "&cError: size<=0"); + MainUtil.sendMessage(player, "&cError: size<=0"); } if (args.length > 1) { schematic = args[1]; @@ -87,31 +87,31 @@ public class Auto extends SubCommand { } } if (size_x * size_z > Settings.MAX_AUTO_SIZE) { - MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.MAX_AUTO_SIZE + ""); + MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.MAX_AUTO_SIZE + ""); return false; } - int currentPlots = Settings.GLOBAL_LIMIT ? plr.getPlotCount() : plr.getPlotCount(plotarea.worldname); - int diff = currentPlots - plr.getAllowedPlots(); + int currentPlots = Settings.GLOBAL_LIMIT ? player.getPlotCount() : player.getPlotCount(plotarea.worldname); + int diff = currentPlots - player.getAllowedPlots(); if (diff + size_x * size_z > 0) { if (diff < 0) { - MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, -diff + ""); + MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS_NUM, -diff + ""); return false; - } else if (plr.hasPersistentMeta("grantedPlots")) { - int grantedPlots = ByteArrayUtilities.bytesToInteger(plr.getPersistentMeta("grantedPlots")); + } else if (player.hasPersistentMeta("grantedPlots")) { + int grantedPlots = ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots")); if (grantedPlots - diff < size_x * size_z) { - plr.removePersistentMeta("grantedPlots"); - return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); + player.removePersistentMeta("grantedPlots"); + return sendMessage(player, C.CANT_CLAIM_MORE_PLOTS); } else { int left = grantedPlots - diff - size_x * size_z; if (left == 0) { - plr.removePersistentMeta("grantedPlots"); + player.removePersistentMeta("grantedPlots"); } else { - plr.setPersistentMeta("grantedPlots", ByteArrayUtilities.integerToBytes(left)); + player.setPersistentMeta("grantedPlots", ByteArrayUtilities.integerToBytes(left)); } - sendMessage(plr, C.REMOVED_GRANTED_PLOT, "" + left, "" + (grantedPlots - left)); + sendMessage(player, C.REMOVED_GRANTED_PLOT, "" + left, "" + (grantedPlots - left)); } } else { - MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); + MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS); return false; } } @@ -119,21 +119,21 @@ public class Auto extends SubCommand { double cost = plotarea.PRICES.get("claim"); cost = (size_x * size_z) * cost; if (cost > 0d) { - if (EconHandler.manager.getMoney(plr) < cost) { - sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost); + if (EconHandler.manager.getMoney(player) < cost) { + sendMessage(player, C.CANNOT_AFFORD_PLOT, "" + cost); return true; } - EconHandler.manager.withdrawMoney(plr, cost); - sendMessage(plr, C.REMOVED_BALANCE, cost + ""); + EconHandler.manager.withdrawMoney(player, cost); + sendMessage(player, C.REMOVED_BALANCE, cost + ""); } } if (schematic != null && !schematic.isEmpty()) { if (!plotarea.SCHEMATICS.contains(schematic.toLowerCase())) { - sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic); + sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic); return true; } - if (!Permissions.hasPermission(plr, "plots.claim." + schematic) && !Permissions.hasPermission(plr, "plots.admin.command.schematic")) { - MainUtil.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic); + if (!Permissions.hasPermission(player, "plots.claim." + schematic) && !Permissions.hasPermission(player, "plots.admin.command.schematic")) { + MainUtil.sendMessage(player, C.NO_SCHEMATIC_PERMISSION, schematic); return true; } } @@ -149,14 +149,14 @@ public class Auto extends SubCommand { for (int i = 0; i <= max; i++) { PlotId currentId = new PlotId(origin.x + id.x, origin.y + id.y); Plot current = plotarea.getPlotAbs(currentId); - if (current.canClaim(plr)) { - current.claim(plr, true, null); + if (current.canClaim(player)) { + current.claim(player, true, null); return true; } id = getNextPlotId(id, 1); } // no free plots - MainUtil.sendMessage(plr, C.NO_FREE_PLOTS); + MainUtil.sendMessage(player, C.NO_FREE_PLOTS); return false; } plotarea.setMeta("lastPlot", new PlotId(0, 0)); @@ -164,12 +164,12 @@ public class Auto extends SubCommand { PlotId start = getNextPlotId(getLastPlotId(plotarea), 1); PlotId end = new PlotId(start.x + size_x - 1, start.y + size_z - 1); plotarea.setMeta("lastPlot", start); - if (plotarea.canClaim(plr, start, end)) { + if (plotarea.canClaim(player, start, end)) { for (int i = start.x; i <= end.x; i++) { for (int j = start.y; j <= end.y; j++) { Plot plot = plotarea.getPlotAbs(new PlotId(i, j)); boolean teleport = i == end.x && j == end.y; - plot.claim(plr, teleport, null); + plot.claim(player, teleport, null); } } if (size_x != 1 || size_z != 1) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/BO3.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/BO3.java index a5a54b483..cf92211e1 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/BO3.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/BO3.java @@ -17,40 +17,40 @@ import com.plotsquared.general.commands.CommandDeclaration; requiredType = RequiredType.NONE) public class BO3 extends SubCommand { - public void noArgs(PlotPlayer plr) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot bo3 export [category] [alias] [-r]"); - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot bo3 import "); + public void noArgs(PlotPlayer player) { + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot bo3 export [category] [alias] [-r]"); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot bo3 import "); } @Override - public boolean onCommand(PlotPlayer plr, String[] args) { - Location loc = plr.getLocation(); + public boolean onCommand(PlotPlayer player, String[] args) { + Location loc = player.getLocation(); Plot plot = loc.getPlotAbs(); if (plot == null || !plot.hasOwner()) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } - if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.bo3")) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.bo3")) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } if (args.length == 0) { - noArgs(plr); + noArgs(player); return false; } switch (args[0].toLowerCase()) { case "output": case "save": case "export": - return BO3Handler.saveBO3(plr, plot); + return BO3Handler.saveBO3(player, plot); case "paste": case "load": case "import": case "input": // TODO NOT IMPLEMENTED YET - MainUtil.sendMessage(plr, "NOT IMPLEMENTED YET!!!"); + MainUtil.sendMessage(player, "NOT IMPLEMENTED YET!!!"); return false; default: - noArgs(plr); + noArgs(player); return false; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Biome.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Biome.java index 04339d2b6..b43ad37ec 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Biome.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Biome.java @@ -19,16 +19,16 @@ import com.plotsquared.general.commands.CommandDeclaration; public class Biome extends SetCommand { @Override - public boolean set(final PlotPlayer plr, final Plot plot, final String value) { + public boolean set(final PlotPlayer player, final Plot plot, final String value) { int biome = WorldUtil.IMP.getBiomeFromString(value); if (biome == -1) { String biomes = StringMan.join(WorldUtil.IMP.getBiomeList(), C.BLOCK_LIST_SEPARATER.s()); - C.NEED_BIOME.send(plr); - MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes); + C.NEED_BIOME.send(player); + MainUtil.sendMessage(player, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); return false; } plot.addRunning(); @@ -36,7 +36,7 @@ public class Biome extends SetCommand { @Override public void run() { plot.removeRunning(); - MainUtil.sendMessage(plr, C.BIOME_SET_TO.s() + value.toLowerCase()); + MainUtil.sendMessage(player, C.BIOME_SET_TO.s() + value.toLowerCase()); } }); return true; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index 4d148a9cd..08c8afdab 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -20,61 +20,61 @@ import com.plotsquared.general.commands.CommandDeclaration; public class Claim extends SubCommand { @Override - public boolean onCommand(PlotPlayer plr, String[] args) { + public boolean onCommand(PlotPlayer player, String[] args) { String schematic = ""; if (args.length >= 1) { schematic = args[0]; } - Location loc = plr.getLocation(); + Location loc = player.getLocation(); Plot plot = loc.getPlotAbs(); if (plot == null) { - return sendMessage(plr, C.NOT_IN_PLOT); + return sendMessage(player, C.NOT_IN_PLOT); } - int currentPlots = Settings.GLOBAL_LIMIT ? plr.getPlotCount() : plr.getPlotCount(loc.getWorld()); + int currentPlots = Settings.GLOBAL_LIMIT ? player.getPlotCount() : player.getPlotCount(loc.getWorld()); int grants = 0; - if (currentPlots >= plr.getAllowedPlots()) { - if (plr.hasPersistentMeta("grantedPlots")) { - grants = ByteArrayUtilities.bytesToInteger(plr.getPersistentMeta("grantedPlots")); + if (currentPlots >= player.getAllowedPlots()) { + if (player.hasPersistentMeta("grantedPlots")) { + grants = ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots")); if (grants <= 0) { - plr.removePersistentMeta("grantedPlots"); - return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); + player.removePersistentMeta("grantedPlots"); + return sendMessage(player, C.CANT_CLAIM_MORE_PLOTS); } } else { - return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); + return sendMessage(player, C.CANT_CLAIM_MORE_PLOTS); } } - if (!plot.canClaim(plr)) { - return sendMessage(plr, C.PLOT_IS_CLAIMED); + if (!plot.canClaim(player)) { + return sendMessage(player, C.PLOT_IS_CLAIMED); } PlotArea world = plot.getArea(); if ((EconHandler.manager != null) && world.USE_ECONOMY) { double cost = world.PRICES.get("claim"); if (cost > 0d) { - if (EconHandler.manager.getMoney(plr) < cost) { - return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost); + if (EconHandler.manager.getMoney(player) < cost) { + return sendMessage(player, C.CANNOT_AFFORD_PLOT, "" + cost); } - EconHandler.manager.withdrawMoney(plr, cost); - sendMessage(plr, C.REMOVED_BALANCE, cost + ""); + EconHandler.manager.withdrawMoney(player, cost); + sendMessage(player, C.REMOVED_BALANCE, cost + ""); } } if (grants > 0) { if (grants == 1) { - plr.removePersistentMeta("grantedPlots"); + player.removePersistentMeta("grantedPlots"); } else { - plr.setPersistentMeta("grantedPlots", ByteArrayUtilities.integerToBytes(grants - 1)); + player.setPersistentMeta("grantedPlots", ByteArrayUtilities.integerToBytes(grants - 1)); } - sendMessage(plr, C.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1)); + sendMessage(player, C.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1)); } if (!schematic.isEmpty()) { if (world.SCHEMATIC_CLAIM_SPECIFY) { if (!world.SCHEMATICS.contains(schematic.toLowerCase())) { - return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic); + return sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic); } - if (!Permissions.hasPermission(plr, "plots.claim." + schematic) && !Permissions.hasPermission(plr, "plots.admin.command.schematic")) { - return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic); + if (!Permissions.hasPermission(player, "plots.claim." + schematic) && !Permissions.hasPermission(player, "plots.admin.command.schematic")) { + return sendMessage(player, C.NO_SCHEMATIC_PERMISSION, schematic); } } } - return plot.claim(plr, false, schematic) || sendMessage(plr, C.PLOT_NOT_CLAIMED); + return plot.claim(player, false, schematic) || sendMessage(player, C.PLOT_NOT_CLAIMED); } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java index 42cc84335..0dcf4e5ff 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java @@ -30,74 +30,74 @@ import java.util.UUID; public class Cluster extends SubCommand { @Override - public boolean onCommand(PlotPlayer plr, String[] args) { + public boolean onCommand(PlotPlayer player, String[] args) { // list, create, delete, resize, invite, kick, leave, helpers, tp, sethome if (args.length == 0) { // return arguments - MainUtil.sendMessage(plr, C.CLUSTER_AVAILABLE_ARGS); + MainUtil.sendMessage(player, C.CLUSTER_AVAILABLE_ARGS); return false; } String sub = args[0].toLowerCase(); switch (sub) { case "l": case "list": { - if (!Permissions.hasPermission(plr, "plots.cluster.list")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.list"); + if (!Permissions.hasPermission(player, "plots.cluster.list")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.list"); return false; } if (args.length != 1) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster list"); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster list"); return false; } - PlotArea area = plr.getApplicablePlotArea(); + PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(plr); + C.NOT_IN_PLOT_WORLD.send(player); return false; } Set clusters = area.getClusters(); - MainUtil.sendMessage(plr, C.CLUSTER_LIST_HEADING, clusters.size() + ""); + MainUtil.sendMessage(player, C.CLUSTER_LIST_HEADING, clusters.size() + ""); for (PlotCluster cluster : clusters) { // Ignore unmanaged clusters String name = "'" + cluster.getName() + "' : " + cluster.toString(); - if (plr.getUUID().equals(cluster.owner)) { - MainUtil.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&a" + name); - } else if (cluster.helpers.contains(plr.getUUID())) { - MainUtil.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&3" + name); - } else if (cluster.invited.contains(plr.getUUID())) { - MainUtil.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, "&9" + name); + if (player.getUUID().equals(cluster.owner)) { + MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, "&a" + name); + } else if (cluster.helpers.contains(player.getUUID())) { + MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, "&3" + name); + } else if (cluster.invited.contains(player.getUUID())) { + MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, "&9" + name); } else { - MainUtil.sendMessage(plr, C.CLUSTER_LIST_ELEMENT, cluster.toString()); + MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, cluster.toString()); } } return true; } case "c": case "create": { - if (!Permissions.hasPermission(plr, "plots.cluster.create")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.create"); + if (!Permissions.hasPermission(player, "plots.cluster.create")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.create"); return false; } - PlotArea area = plr.getApplicablePlotArea(); + PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(plr); + C.NOT_IN_PLOT_WORLD.send(player); return false; } if (args.length != 4) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster create "); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster create "); return false; } // check pos1 / pos2 PlotId pos1 = PlotId.fromString(args[2]); PlotId pos2 = PlotId.fromString(args[3]); if (pos1 == null || pos2 == null) { - MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID); + MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID); return false; } // check if name is taken String name = args[1]; if (area.getCluster(name) != null) { - MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN); + MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN); return false; } if (pos2.x < pos1.x || pos2.y < pos1.y) { @@ -108,33 +108,33 @@ public class Cluster extends SubCommand { //check if overlap PlotCluster cluster = area.getFirstIntersectingCluster(pos1, pos2); if (cluster != null) { - MainUtil.sendMessage(plr, C.CLUSTER_INTERSECTION, cluster.getName()); + MainUtil.sendMessage(player, C.CLUSTER_INTERSECTION, cluster.getName()); return false; } // Check if it occupies existing plots Set plots = area.getPlotSelectionOwned(pos1, pos2); if (!plots.isEmpty()) { - if (!Permissions.hasPermission(plr, "plots.cluster.create.other")) { - UUID uuid = plr.getUUID(); + if (!Permissions.hasPermission(player, "plots.cluster.create.other")) { + UUID uuid = player.getUUID(); for (Plot plot : plots) { if (!plot.isOwner(uuid)) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.create.other"); + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.create.other"); return false; } } } } // Check allowed cluster size - cluster = new PlotCluster(area, pos1, pos2, plr.getUUID()); + cluster = new PlotCluster(area, pos1, pos2, player.getUUID()); int current; if (Settings.GLOBAL_LIMIT) { - current = plr.getPlayerClusterCount(); + current = player.getPlayerClusterCount(); } else { - current = plr.getPlayerClusterCount(plr.getLocation().getWorld()); + current = player.getPlayerClusterCount(player.getLocation().getWorld()); } - int allowed = Permissions.hasPermissionRange(plr, "plots.cluster", Settings.MAX_PLOTS); + int allowed = Permissions.hasPermissionRange(player, "plots.cluster", Settings.MAX_PLOTS); if (current + cluster.getArea() > allowed) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster." + (current + cluster.getArea())); + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster." + (current + cluster.getArea())); return false; } // create cluster @@ -150,64 +150,64 @@ public class Cluster extends SubCommand { } } } - MainUtil.sendMessage(plr, C.CLUSTER_ADDED); + MainUtil.sendMessage(player, C.CLUSTER_ADDED); return true; } case "disband": case "del": case "delete": { - if (!Permissions.hasPermission(plr, "plots.cluster.delete")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete"); + if (!Permissions.hasPermission(player, "plots.cluster.delete")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.delete"); return false; } if (args.length != 1 && args.length != 2) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster delete [name]"); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster delete [name]"); return false; } - PlotArea area = plr.getApplicablePlotArea(); + PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(plr); + C.NOT_IN_PLOT_WORLD.send(player); return false; } PlotCluster cluster; if (args.length == 2) { cluster = area.getCluster(args[1]); if (cluster == null) { - MainUtil.sendMessage(plr, C.INVALID_CLUSTER, args[1]); + MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]); return false; } } else { - cluster = area.getCluster(plr.getLocation()); + cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); return false; } } - if (!cluster.owner.equals(plr.getUUID())) { - if (!Permissions.hasPermission(plr, "plots.cluster.delete.other")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete.other"); + if (!cluster.owner.equals(player.getUUID())) { + if (!Permissions.hasPermission(player, "plots.cluster.delete.other")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.delete.other"); return false; } } DBFunc.delete(cluster); - MainUtil.sendMessage(plr, C.CLUSTER_DELETED); + MainUtil.sendMessage(player, C.CLUSTER_DELETED); return true; } case "res": case "resize": { - if (!Permissions.hasPermission(plr, "plots.cluster.resize")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize"); + if (!Permissions.hasPermission(player, "plots.cluster.resize")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.resize"); return false; } if (args.length != 3) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster resize "); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster resize "); return false; } // check pos1 / pos2 PlotId pos1 = PlotId.fromString(args[1]); PlotId pos2 = PlotId.fromString(args[2]); if (pos1 == null || pos2 == null) { - MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID); + MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID); return false; } if (pos2.x < pos1.x || pos2.y < pos1.y) { @@ -215,26 +215,26 @@ public class Cluster extends SubCommand { pos2 = new PlotId(Math.max(pos1.x, pos2.x), Math.max(pos1.y, pos2.y)); } // check if in cluster - PlotArea area = plr.getApplicablePlotArea(); + PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(plr); + C.NOT_IN_PLOT_WORLD.send(player); return false; } - PlotCluster cluster = area.getCluster(plr.getLocation()); + PlotCluster cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); return false; } - if (!cluster.hasHelperRights(plr.getUUID())) { - if (!Permissions.hasPermission(plr, "plots.cluster.resize.other")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize.other"); + if (!cluster.hasHelperRights(player.getUUID())) { + if (!Permissions.hasPermission(player, "plots.cluster.resize.other")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.resize.other"); return false; } } //check if overlap PlotCluster intersect = area.getFirstIntersectingCluster(pos1, pos2); if (intersect != null) { - MainUtil.sendMessage(plr, C.CLUSTER_INTERSECTION, intersect.getName()); + MainUtil.sendMessage(player, C.CLUSTER_INTERSECTION, intersect.getName()); return false; } HashSet existing = area.getPlotSelectionOwned(cluster.getP1(), cluster.getP2()); @@ -243,116 +243,116 @@ public class Cluster extends SubCommand { removed.removeAll(newPlots); // Check expand / shrink if (!removed.isEmpty()) { - if (!Permissions.hasPermission(plr, "plots.cluster.resize.shrink")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize.shrink"); + if (!Permissions.hasPermission(player, "plots.cluster.resize.shrink")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.resize.shrink"); return false; } } newPlots.removeAll(existing); if (!newPlots.isEmpty()) { - if (!Permissions.hasPermission(plr, "plots.cluster.resize.expand")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize.expand"); + if (!Permissions.hasPermission(player, "plots.cluster.resize.expand")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.resize.expand"); return false; } } // Check allowed cluster size int current; if (Settings.GLOBAL_LIMIT) { - current = plr.getPlayerClusterCount(); + current = player.getPlayerClusterCount(); } else { - current = plr.getPlayerClusterCount(plr.getLocation().getWorld()); + current = player.getPlayerClusterCount(player.getLocation().getWorld()); } current -= cluster.getArea() + (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y); - int allowed = Permissions.hasPermissionRange(plr, "plots.cluster", Settings.MAX_PLOTS); + int allowed = Permissions.hasPermissionRange(player, "plots.cluster", Settings.MAX_PLOTS); if (current + cluster.getArea() > allowed) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster." + (current + cluster.getArea())); + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster." + (current + cluster.getArea())); return false; } // resize cluster DBFunc.resizeCluster(cluster, pos1, pos2); - MainUtil.sendMessage(plr, C.CLUSTER_RESIZED); + MainUtil.sendMessage(player, C.CLUSTER_RESIZED); return true; } case "add": case "inv": case "invite": { - if (!Permissions.hasPermission(plr, "plots.cluster.invite")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite"); + if (!Permissions.hasPermission(player, "plots.cluster.invite")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.invite"); return false; } if (args.length != 2) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster invite "); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster invite "); return false; } // check if in cluster - PlotArea area = plr.getApplicablePlotArea(); + PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(plr); + C.NOT_IN_PLOT_WORLD.send(player); } - PlotCluster cluster = area.getCluster(plr.getLocation()); + PlotCluster cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); return false; } - if (!cluster.hasHelperRights(plr.getUUID())) { - if (!Permissions.hasPermission(plr, "plots.cluster.invite.other")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite.other"); + if (!cluster.hasHelperRights(player.getUUID())) { + if (!Permissions.hasPermission(player, "plots.cluster.invite.other")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.invite.other"); return false; } } // check uuid UUID uuid = UUIDHandler.getUUID(args[1], null); if (uuid == null) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[2]); + MainUtil.sendMessage(player, C.INVALID_PLAYER, args[2]); return false; } if (!cluster.isAdded(uuid)) { // add the user if not added cluster.invited.add(uuid); DBFunc.setInvited(cluster, uuid); - PlotPlayer player = UUIDHandler.getPlayer(uuid); - if (player != null) { - MainUtil.sendMessage(player, C.CLUSTER_INVITED, cluster.getName()); + PlotPlayer player2 = UUIDHandler.getPlayer(uuid); + if (player2 != null) { + MainUtil.sendMessage(player2, C.CLUSTER_INVITED, cluster.getName()); } } - MainUtil.sendMessage(plr, C.CLUSTER_ADDED_USER); + MainUtil.sendMessage(player, C.CLUSTER_ADDED_USER); return true; } case "k": case "remove": case "kick": { - if (!Permissions.hasPermission(plr, "plots.cluster.kick")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick"); + if (!Permissions.hasPermission(player, "plots.cluster.kick")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.kick"); return false; } if (args.length != 2) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster kick "); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster kick "); return false; } - PlotArea area = plr.getApplicablePlotArea(); + PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(plr); + C.NOT_IN_PLOT_WORLD.send(player); } - PlotCluster cluster = area.getCluster(plr.getLocation()); + PlotCluster cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); return false; } - if (!cluster.hasHelperRights(plr.getUUID())) { - if (!Permissions.hasPermission(plr, "plots.cluster.kick.other")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick.other"); + if (!cluster.hasHelperRights(player.getUUID())) { + if (!Permissions.hasPermission(player, "plots.cluster.kick.other")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.kick.other"); return false; } } // check uuid UUID uuid = UUIDHandler.getUUID(args[1], null); if (uuid == null) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[1]); + MainUtil.sendMessage(player, 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(plr.getUUID()) || uuid.equals(cluster.owner) || !cluster.isAdded(uuid)) { - MainUtil.sendMessage(plr, C.CANNOT_KICK_PLAYER, cluster.getName()); + if (uuid.equals(player.getUUID()) || uuid.equals(cluster.owner) || !cluster.isAdded(uuid)) { + MainUtil.sendMessage(player, C.CANNOT_KICK_PLAYER, cluster.getName()); return false; } if (cluster.helpers.contains(uuid)) { @@ -361,54 +361,54 @@ public class Cluster extends SubCommand { } cluster.invited.remove(uuid); DBFunc.removeInvited(cluster, uuid); - PlotPlayer player = UUIDHandler.getPlayer(uuid); - if (player != null) { - MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName()); + PlotPlayer player2 = UUIDHandler.getPlayer(uuid); + if (player2 != null) { + MainUtil.sendMessage(player2, C.CLUSTER_REMOVED, cluster.getName()); } - for (Plot plot : new ArrayList<>(PS.get().getPlots(plr.getLocation().getWorld(), uuid))) { + for (Plot plot : new ArrayList<>(PS.get().getPlots(player2.getLocation().getWorld(), uuid))) { PlotCluster current = plot.getCluster(); if (current != null && current.equals(cluster)) { plot.unclaim(); } } - MainUtil.sendMessage(plr, C.CLUSTER_KICKED_USER); + MainUtil.sendMessage(player2, C.CLUSTER_KICKED_USER); return true; } case "quit": case "leave": { - if (!Permissions.hasPermission(plr, "plots.cluster.leave")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.leave"); + if (!Permissions.hasPermission(player, "plots.cluster.leave")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.leave"); return false; } if (args.length != 1 && args.length != 2) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster leave [name]"); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster leave [name]"); return false; } - PlotArea area = plr.getApplicablePlotArea(); + PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(plr); + C.NOT_IN_PLOT_WORLD.send(player); } PlotCluster cluster; if (args.length == 2) { cluster = area.getCluster(args[1]); if (cluster == null) { - MainUtil.sendMessage(plr, C.INVALID_CLUSTER, args[1]); + MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]); return false; } } else { - cluster = area.getCluster(plr.getLocation()); + cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); return false; } } - UUID uuid = plr.getUUID(); + UUID uuid = player.getUUID(); if (!cluster.isAdded(uuid)) { - MainUtil.sendMessage(plr, C.CLUSTER_NOT_ADDED); + MainUtil.sendMessage(player, C.CLUSTER_NOT_ADDED); return false; } if (uuid.equals(cluster.owner)) { - MainUtil.sendMessage(plr, C.CLUSTER_CANNOT_LEAVE); + MainUtil.sendMessage(player, C.CLUSTER_CANNOT_LEAVE); return false; } if (cluster.helpers.contains(uuid)) { @@ -417,11 +417,11 @@ public class Cluster extends SubCommand { } cluster.invited.remove(uuid); DBFunc.removeInvited(cluster, uuid); - MainUtil.sendMessage(plr, C.CLUSTER_REMOVED, cluster.getName()); - for (Plot plot : new ArrayList<>(PS.get().getPlots(plr.getLocation().getWorld(), uuid))) { + MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName()); + for (Plot plot : new ArrayList<>(PS.get().getPlots(player.getLocation().getWorld(), uuid))) { PlotCluster current = plot.getCluster(); if (current != null && current.equals(cluster)) { - plr.getLocation().getWorld(); + player.getLocation().getWorld(); plot.unclaim(); } } @@ -430,99 +430,99 @@ public class Cluster extends SubCommand { case "admin": case "helper": case "helpers": { - if (!Permissions.hasPermission(plr, "plots.cluster.helpers")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.helpers"); + if (!Permissions.hasPermission(player, "plots.cluster.helpers")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.helpers"); return false; } if (args.length != 3) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers "); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster helpers "); return false; } - PlotArea area = plr.getApplicablePlotArea(); + PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(plr); + C.NOT_IN_PLOT_WORLD.send(player); } - PlotCluster cluster = area.getCluster(plr.getLocation()); + PlotCluster cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); return false; } UUID uuid = UUIDHandler.getUUID(args[2], null); if (uuid == null) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[2]); + MainUtil.sendMessage(player, C.INVALID_PLAYER, args[2]); return false; } if (args[1].equalsIgnoreCase("add")) { cluster.helpers.add(uuid); DBFunc.setHelper(cluster, uuid); - return MainUtil.sendMessage(plr, C.CLUSTER_ADDED_HELPER); + return MainUtil.sendMessage(player, C.CLUSTER_ADDED_HELPER); } if (args[1].equalsIgnoreCase("remove")) { cluster.helpers.remove(uuid); DBFunc.removeHelper(cluster, uuid); - return MainUtil.sendMessage(plr, C.CLUSTER_REMOVED_HELPER); + return MainUtil.sendMessage(player, C.CLUSTER_REMOVED_HELPER); } - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers "); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster helpers "); return false; } case "spawn": case "home": case "tp": { - if (!Permissions.hasPermission(plr, "plots.cluster.tp")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp"); + if (!Permissions.hasPermission(player, "plots.cluster.tp")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.tp"); return false; } if (args.length != 2) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster tp "); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster tp "); return false; } - PlotArea area = plr.getApplicablePlotArea(); + PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(plr); + C.NOT_IN_PLOT_WORLD.send(player); return false; } PlotCluster cluster = area.getCluster(args[1]); if (cluster == null) { - MainUtil.sendMessage(plr, C.INVALID_CLUSTER, args[1]); + MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]); return false; } - UUID uuid = plr.getUUID(); + UUID uuid = player.getUUID(); if (!cluster.isAdded(uuid)) { - if (!Permissions.hasPermission(plr, "plots.cluster.tp.other")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp.other"); + if (!Permissions.hasPermission(player, "plots.cluster.tp.other")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.tp.other"); return false; } } - plr.teleport(cluster.getHome()); - return MainUtil.sendMessage(plr, C.CLUSTER_TELEPORTING); + player.teleport(cluster.getHome()); + return MainUtil.sendMessage(player, C.CLUSTER_TELEPORTING); } case "i": case "info": case "show": case "information": { - if (!Permissions.hasPermission(plr, "plots.cluster.info")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.info"); + if (!Permissions.hasPermission(player, "plots.cluster.info")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.info"); return false; } if (args.length != 1 && args.length != 2) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster info [name]"); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster info [name]"); return false; } - PlotArea area = plr.getApplicablePlotArea(); + PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(plr); + C.NOT_IN_PLOT_WORLD.send(player); } PlotCluster cluster; if (args.length == 2) { cluster = area.getCluster(args[1]); if (cluster == null) { - MainUtil.sendMessage(plr, C.INVALID_CLUSTER, args[1]); + MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]); return false; } } else { - cluster = area.getCluster(plr.getLocation()); + cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); return false; } } @@ -533,50 +533,50 @@ public class Cluster extends SubCommand { } String name = cluster.getName(); String size = (cluster.getP2().x - cluster.getP1().x + 1) + "x" + (cluster.getP2().y - cluster.getP1().y + 1); - String rights = cluster.isAdded(plr.getUUID()) + ""; + String rights = cluster.isAdded(player.getUUID()) + ""; String message = C.CLUSTER_INFO.s(); message = message.replaceAll("%id%", id); message = message.replaceAll("%owner%", owner); message = message.replaceAll("%name%", name); message = message.replaceAll("%size%", size); message = message.replaceAll("%rights%", rights); - MainUtil.sendMessage(plr, message); + MainUtil.sendMessage(player, message); return true; } case "sh": case "setspawn": case "sethome": - if (!Permissions.hasPermission(plr, "plots.cluster.sethome")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome"); + if (!Permissions.hasPermission(player, "plots.cluster.sethome")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.sethome"); return false; } if (args.length != 1 && args.length != 2) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster sethome"); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster sethome"); return false; } - PlotArea area = plr.getApplicablePlotArea(); + PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(plr); + C.NOT_IN_PLOT_WORLD.send(player); } - PlotCluster cluster = area.getCluster(plr.getLocation()); + PlotCluster cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(plr, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); return false; } - if (!cluster.hasHelperRights(plr.getUUID())) { - if (!Permissions.hasPermission(plr, "plots.cluster.sethome.other")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome.other"); + if (!cluster.hasHelperRights(player.getUUID())) { + if (!Permissions.hasPermission(player, "plots.cluster.sethome.other")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.sethome.other"); return false; } } Location base = cluster.getClusterBottom(); - Location relative = plr.getLocation().subtract(base.getX(), 0, base.getZ()); + Location relative = player.getLocation().subtract(base.getX(), 0, base.getZ()); BlockLoc blockloc = new BlockLoc(relative.getX(), relative.getY(), relative.getZ()); cluster.settings.setPosition(blockloc); DBFunc.setPosition(cluster, relative.getX() + "," + relative.getY() + "," + relative.getZ()); - return MainUtil.sendMessage(plr, C.POSITION_SET); + return MainUtil.sendMessage(player, C.POSITION_SET); } - MainUtil.sendMessage(plr, C.CLUSTER_AVAILABLE_ARGS); + MainUtil.sendMessage(player, C.CLUSTER_AVAILABLE_ARGS); return false; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Condense.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Condense.java index 3c0b15a95..17586dc82 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Condense.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Condense.java @@ -29,28 +29,28 @@ public class Condense extends SubCommand { public static boolean TASK = false; @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { + public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length != 2 && args.length != 3) { - MainUtil.sendMessage(plr, "/plot condense [radius]"); + MainUtil.sendMessage(player, "/plot condense [radius]"); return false; } PlotArea area = PS.get().getPlotAreaByString(args[0]); if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) { - MainUtil.sendMessage(plr, "INVALID AREA"); + MainUtil.sendMessage(player, "INVALID AREA"); return false; } switch (args[1].toLowerCase()) { case "start": { if (args.length == 2) { - MainUtil.sendMessage(plr, "/plot condense " + area.toString() + " start "); + MainUtil.sendMessage(player, "/plot condense " + area.toString() + " start "); return false; } if (Condense.TASK) { - MainUtil.sendMessage(plr, "TASK ALREADY STARTED"); + MainUtil.sendMessage(player, "TASK ALREADY STARTED"); return false; } if (!MathMan.isInteger(args[2])) { - MainUtil.sendMessage(plr, "INVALID RADIUS"); + MainUtil.sendMessage(player, "INVALID RADIUS"); return false; } int radius = Integer.parseInt(args[2]); @@ -93,7 +93,7 @@ public class Condense extends SubCommand { int size = allPlots.size(); int minimumRadius = (int) Math.ceil(Math.sqrt(size) / 2 + 1); if (radius < minimumRadius) { - MainUtil.sendMessage(plr, "RADIUS TOO SMALL"); + MainUtil.sendMessage(player, "RADIUS TOO SMALL"); return false; } List toMove = new ArrayList<>(getPlots(allPlots, radius)); @@ -107,19 +107,19 @@ public class Condense extends SubCommand { start = Auto.getNextPlotId(start, 1); } if (free.isEmpty() || toMove.isEmpty()) { - MainUtil.sendMessage(plr, "NO FREE PLOTS FOUND"); + MainUtil.sendMessage(player, "NO FREE PLOTS FOUND"); return false; } - MainUtil.sendMessage(plr, "TASK STARTED..."); + MainUtil.sendMessage(player, "TASK STARTED..."); Runnable run = new Runnable() { @Override public void run() { if (!Condense.TASK) { - MainUtil.sendMessage(plr, "TASK CANCELLED."); + MainUtil.sendMessage(player, "TASK CANCELLED."); } if (allPlots.isEmpty()) { Condense.TASK = false; - MainUtil.sendMessage(plr, "TASK COMPLETE. PLEASE VERIFY THAT NO NEW PLOTS HAVE BEEN CLAIMED DURING TASK."); + MainUtil.sendMessage(player, "TASK COMPLETE. PLEASE VERIFY THAT NO NEW PLOTS HAVE BEEN CLAIMED DURING TASK."); return; } final Runnable task = this; @@ -137,7 +137,7 @@ public class Condense extends SubCommand { @Override public void run() { if (result.get()) { - MainUtil.sendMessage(plr, "Moving: " + origin + " -> " + possible); + MainUtil.sendMessage(player, "Moving: " + origin + " -> " + possible); TaskManager.runTaskLater(task, 1); } } @@ -148,11 +148,11 @@ public class Condense extends SubCommand { } if (free.isEmpty()) { Condense.TASK = false; - MainUtil.sendMessage(plr, "TASK FAILED. NO FREE PLOTS FOUND!"); + MainUtil.sendMessage(player, "TASK FAILED. NO FREE PLOTS FOUND!"); return; } if (i >= free.size()) { - MainUtil.sendMessage(plr, "SKIPPING COMPLEX PLOT: " + origin); + MainUtil.sendMessage(player, "SKIPPING COMPLEX PLOT: " + origin); } } }; @@ -162,19 +162,19 @@ public class Condense extends SubCommand { } case "stop": if (!Condense.TASK) { - MainUtil.sendMessage(plr, "TASK ALREADY STOPPED"); + MainUtil.sendMessage(player, "TASK ALREADY STOPPED"); return false; } Condense.TASK = false; - MainUtil.sendMessage(plr, "TASK STOPPED"); + MainUtil.sendMessage(player, "TASK STOPPED"); return true; case "info": if (args.length == 2) { - MainUtil.sendMessage(plr, "/plot condense " + area.toString() + " info "); + MainUtil.sendMessage(player, "/plot condense " + area.toString() + " info "); return false; } if (!MathMan.isInteger(args[2])) { - MainUtil.sendMessage(plr, "INVALID RADIUS"); + MainUtil.sendMessage(player, "INVALID RADIUS"); return false; } int radius = Integer.parseInt(args[2]); @@ -182,22 +182,22 @@ public class Condense extends SubCommand { int size = plots.size(); int minimumRadius = (int) Math.ceil(Math.sqrt(size) / 2 + 1); if (radius < minimumRadius) { - MainUtil.sendMessage(plr, "RADIUS TOO SMALL"); + MainUtil.sendMessage(player, "RADIUS TOO SMALL"); return false; } int maxMove = getPlots(plots, minimumRadius).size(); int userMove = getPlots(plots, radius).size(); - MainUtil.sendMessage(plr, "=== DEFAULT EVAL ==="); - MainUtil.sendMessage(plr, "MINIMUM RADIUS: " + minimumRadius); - MainUtil.sendMessage(plr, "MAXIMUM MOVES: " + maxMove); - MainUtil.sendMessage(plr, "=== INPUT EVAL ==="); - MainUtil.sendMessage(plr, "INPUT RADIUS: " + radius); - MainUtil.sendMessage(plr, "ESTIMATED MOVES: " + userMove); - MainUtil.sendMessage(plr, "ESTIMATED TIME: No idea, times will drastically change based on the system performance and load"); - MainUtil.sendMessage(plr, "&e - Radius is measured in plot width"); + MainUtil.sendMessage(player, "=== DEFAULT EVAL ==="); + MainUtil.sendMessage(player, "MINIMUM RADIUS: " + minimumRadius); + MainUtil.sendMessage(player, "MAXIMUM MOVES: " + maxMove); + MainUtil.sendMessage(player, "=== INPUT EVAL ==="); + MainUtil.sendMessage(player, "INPUT RADIUS: " + radius); + MainUtil.sendMessage(player, "ESTIMATED MOVES: " + userMove); + MainUtil.sendMessage(player, "ESTIMATED TIME: No idea, times will drastically change based on the system performance and load"); + MainUtil.sendMessage(player, "&e - Radius is measured in plot width"); return true; } - MainUtil.sendMessage(plr, "/plot condense " + area.worldname + " [radius]"); + MainUtil.sendMessage(player, "/plot condense " + area.worldname + " [radius]"); return false; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java index 4a164d2f1..4b57f5d36 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java @@ -15,15 +15,15 @@ import com.plotsquared.general.commands.CommandDeclaration; public class Confirm extends SubCommand { @Override - public boolean onCommand(PlotPlayer plr, String[] args) { - CmdInstance command = CmdConfirm.getPending(plr); + public boolean onCommand(PlotPlayer player, String[] args) { + CmdInstance command = CmdConfirm.getPending(player); if (command == null) { - MainUtil.sendMessage(plr, C.FAILED_CONFIRM); + MainUtil.sendMessage(player, C.FAILED_CONFIRM); return false; } - CmdConfirm.removePending(plr); + CmdConfirm.removePending(player); if ((System.currentTimeMillis() - command.timestamp) > 20000) { - MainUtil.sendMessage(plr, C.FAILED_CONFIRM); + MainUtil.sendMessage(player, C.FAILED_CONFIRM); return false; } TaskManager.runTask(command.command); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Continue.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Continue.java index afe6e71fc..a0f16f0b4 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Continue.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Continue.java @@ -18,30 +18,30 @@ import com.plotsquared.general.commands.CommandDeclaration; public class Continue extends SubCommand { @Override - public boolean onCommand(PlotPlayer plr, String[] args) { - Plot plot = plr.getCurrentPlot(); + public boolean onCommand(PlotPlayer player, String[] args) { + Plot plot = player.getCurrentPlot(); if ((plot == null) || !plot.hasOwner()) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } - if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.continue")) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.continue")) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } if (!plot.hasFlag(Flags.DONE)) { - MainUtil.sendMessage(plr, C.DONE_NOT_DONE); + MainUtil.sendMessage(player, C.DONE_NOT_DONE); return false; } int size = plot.getConnectedPlots().size(); - if (Settings.DONE_COUNTS_TOWARDS_LIMIT && (plr.getAllowedPlots() < plr.getPlotCount() + size)) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.continue"); + if (Settings.DONE_COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots() < player.getPlotCount() + size)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.admin.command.continue"); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); return false; } plot.removeFlag(Flags.DONE); - MainUtil.sendMessage(plr, C.DONE_REMOVED); + MainUtil.sendMessage(player, C.DONE_REMOVED); return true; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Copy.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Copy.java index 66593cc7e..99849f926 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Copy.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Copy.java @@ -19,42 +19,42 @@ import com.plotsquared.general.commands.CommandDeclaration; public class Copy extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { - Location loc = plr.getLocation(); + public boolean onCommand(final PlotPlayer player, String[] args) { + Location loc = player.getLocation(); Plot plot1 = loc.getPlotAbs(); if (plot1 == null) { - return !MainUtil.sendMessage(plr, C.NOT_IN_PLOT); + return !MainUtil.sendMessage(player, C.NOT_IN_PLOT); } - if (!plot1.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, C.PERMISSION_ADMIN.s())) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot1.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN.s())) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } if (args.length != 1) { - C.COMMAND_SYNTAX.send(plr, getUsage()); + C.COMMAND_SYNTAX.send(player, getUsage()); return false; } - Plot plot2 = MainUtil.getPlotFromString(plr, args[0], true); + Plot plot2 = MainUtil.getPlotFromString(player, args[0], true); if (plot2 == null) { return false; } if (plot1.equals(plot2)) { - MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID); - C.COMMAND_SYNTAX.send(plr, getUsage()); + MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID); + C.COMMAND_SYNTAX.send(player, getUsage()); return false; } if (!plot1.getArea().isCompatible(plot2.getArea())) { - C.PLOTWORLD_INCOMPATIBLE.send(plr); + C.PLOTWORLD_INCOMPATIBLE.send(player); return false; } if (plot1.copy(plot2, new Runnable() { @Override public void run() { - MainUtil.sendMessage(plr, C.COPY_SUCCESS); + MainUtil.sendMessage(player, C.COPY_SUCCESS); } })) { return true; } else { - MainUtil.sendMessage(plr, C.REQUIRES_UNOWNED); + MainUtil.sendMessage(player, C.REQUIRES_UNOWNED); return false; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Debug.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Debug.java index 46d4322c9..ccc4ad95b 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Debug.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Debug.java @@ -15,13 +15,13 @@ import com.plotsquared.general.commands.CommandDeclaration; public class Debug extends SubCommand { @Override - public boolean onCommand(PlotPlayer plr, String[] args) { + public boolean onCommand(PlotPlayer player, String[] args) { if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) { StringBuilder msg = new StringBuilder(); - for (C c : C.values()) { - msg.append(c.s()).append("\n"); + for (C caption : C.values()) { + msg.append(caption.s()).append("\n"); } - MainUtil.sendMessage(plr, msg.toString()); + MainUtil.sendMessage(player, msg.toString()); return true; } StringBuilder information = new StringBuilder(); @@ -35,7 +35,7 @@ public class Debug extends SubCommand { information.append(getSection(section, "Messages")); information.append(getLine(line, "Total Messages", C.values().length)); information.append(getLine(line, "View all captions", "/plot debug msg")); - MainUtil.sendMessage(plr, information.toString()); + MainUtil.sendMessage(player, information.toString()); return true; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java index 28f2b1d04..9e0ee7653 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java @@ -3,6 +3,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.PlotPlayer; import com.plotsquared.general.commands.CommandDeclaration; + import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -19,14 +20,14 @@ public class DebugAllowUnsafe extends SubCommand { public static final List unsafeAllowed = new ArrayList<>(); @Override - public boolean onCommand(PlotPlayer plr, String[] args) { + public boolean onCommand(PlotPlayer player, String[] args) { - if (unsafeAllowed.contains(plr.getUUID())) { - unsafeAllowed.remove(plr.getUUID()); - sendMessage(plr, C.DEBUGALLOWUNSAFE_OFF); + if (unsafeAllowed.contains(player.getUUID())) { + unsafeAllowed.remove(player.getUUID()); + sendMessage(player, C.DEBUGALLOWUNSAFE_OFF); } else { - unsafeAllowed.add(plr.getUUID()); - sendMessage(plr, C.DEBUGALLOWUNSAFE_ON); + unsafeAllowed.add(player.getUUID()); + sendMessage(player, C.DEBUGALLOWUNSAFE_ON); } return true; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java index 35b4591a8..66e8da6ae 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java @@ -32,7 +32,7 @@ import java.util.UUID; public class DebugClaimTest extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { + public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length < 3) { return !MainUtil .sendMessage( @@ -42,7 +42,7 @@ public class DebugClaimTest extends SubCommand { } PlotArea area = PS.get().getPlotAreaByString(args[0]); if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) { - C.NOT_VALID_PLOT_WORLD.send(plr, args[0]); + C.NOT_VALID_PLOT_WORLD.send(player, args[0]); return false; } PlotId min, max; @@ -52,18 +52,18 @@ public class DebugClaimTest extends SubCommand { min = PlotId.fromString(args[1]); max = PlotId.fromString(args[2]); } catch (Exception ignored) { - return !MainUtil.sendMessage(plr, + return !MainUtil.sendMessage(player, "&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."); } - MainUtil.sendMessage(plr, "&3Sign Block&8->&3PlotSquared&8: &7Beginning sign to plot conversion. This may take a while..."); - MainUtil.sendMessage(plr, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)"); + MainUtil.sendMessage(player, "&3Sign Block&8->&3PlotSquared&8: &7Beginning sign to plot conversion. This may take a while..."); + MainUtil.sendMessage(player, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)"); PlotManager manager = area.getPlotManager(); ArrayList plots = new ArrayList<>(); for (PlotId id : MainUtil.getPlotSelectionIds(min, max)) { Plot plot = area.getPlotAbs(id); if (plot.hasOwner()) { - MainUtil.sendMessage(plr, " - &cDB Already contains: " + plot.getId()); + MainUtil.sendMessage(player, " - &cDB Already contains: " + plot.getId()); continue; } Location loc = manager.getSignLoc(area, plot); @@ -91,29 +91,29 @@ public class DebugClaimTest extends SubCommand { uuid = UUIDHandler.getUUID(line, null); } if (uuid != null) { - MainUtil.sendMessage(plr, " - &aFound plot: " + plot.getId() + " : " + line); + MainUtil.sendMessage(player, " - &aFound plot: " + plot.getId() + " : " + line); plot.setOwner(uuid); plots.add(plot); } else { - MainUtil.sendMessage(plr, " - &cInvalid PlayerName: " + plot.getId() + " : " + line); + MainUtil.sendMessage(player, " - &cInvalid PlayerName: " + plot.getId() + " : " + line); } } } } if (!plots.isEmpty()) { - MainUtil.sendMessage(plr, "&3Sign Block&8->&3PlotSquared&8: &7Updating '" + plots.size() + "' plots!"); + MainUtil.sendMessage(player, "&3Sign Block&8->&3PlotSquared&8: &7Updating '" + plots.size() + "' plots!"); DBFunc.createPlotsAndData(plots, new Runnable() { @Override public void run() { - MainUtil.sendMessage(plr, "&6Database update finished!"); + MainUtil.sendMessage(player, "&6Database update finished!"); } }); for (Plot plot : plots) { plot.create(); } - MainUtil.sendMessage(plr, "&3Sign Block&8->&3PlotSquared&8: &7Complete!"); + MainUtil.sendMessage(player, "&3Sign Block&8->&3PlotSquared&8: &7Complete!"); } else { - MainUtil.sendMessage(plr, "No plots were found for the given search."); + MainUtil.sendMessage(player, "No plots were found for the given search."); } return true; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java index b62e9e4fd..b12c1cb40 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java @@ -30,13 +30,13 @@ public class DebugFixFlags extends SubCommand { } @Override - public boolean onCommand(PlotPlayer plr, String[] args) { + public boolean onCommand(PlotPlayer player, String[] args) { PlotArea area = PS.get().getPlotAreaByString(args[0]); if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) { - MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]); + MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[0]); return false; } - MainUtil.sendMessage(plr, "&8--- &6Starting task &8 ---"); + MainUtil.sendMessage(player, "&8--- &6Starting task &8 ---"); for (Plot plot : area.getPlots()) { HashMap, Object> flags = plot.getFlags(); Iterator, Object>> i = flags.entrySet().iterator(); @@ -51,7 +51,7 @@ public class DebugFixFlags extends SubCommand { DBFunc.setFlags(plot, plot.getFlags()); } } - MainUtil.sendMessage(plr, "&aDone!"); + MainUtil.sendMessage(player, "&aDone!"); return true; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java index c01e847f7..00aa74d31 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java @@ -15,7 +15,7 @@ import com.plotsquared.general.commands.CommandDeclaration; public class DebugLoadTest extends SubCommand { @Override - public boolean onCommand(PlotPlayer plr, String[] args) { + public boolean onCommand(PlotPlayer player, String[] args) { PS.get().plots_tmp = DBFunc.getPlots(); return true; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugPaste.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugPaste.java index 960998945..b7e0737c4 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugPaste.java @@ -21,7 +21,7 @@ import java.io.IOException; public class DebugPaste extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { + public boolean onCommand(final PlotPlayer player, String[] args) { TaskManager.runTaskAsync(new Runnable() { @Override public void run() { @@ -31,7 +31,7 @@ public class DebugPaste extends SubCommand { try { latestLOG = HastebinUtility.upload(new File(PS.get().IMP.getDirectory(), "../../logs/latest.log")); } catch (IOException ignored) { - MainUtil.sendMessage(plr, "&clatest.log is too big to be pasted, will ignore"); + MainUtil.sendMessage(player, "&clatest.log is too big to be pasted, will ignore"); latestLOG = "too big :("; } StringBuilder b = new StringBuilder(); @@ -68,7 +68,7 @@ public class DebugPaste extends SubCommand { b.append("\n# You can do so at https://github.com/IntellectualSites/PlotSquared/issues"); String link = HastebinUtility.upload(b.toString()); - plr.sendMessage(C.DEBUG_REPORT_CREATED.s().replace("%url%", link)); + player.sendMessage(C.DEBUG_REPORT_CREATED.s().replace("%url%", link)); } catch (IOException e) { e.printStackTrace(); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java index 141f71315..914eab1d3 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java @@ -25,8 +25,8 @@ public class DebugRoadRegen extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { Location loc = player.getLocation(); - PlotArea plotworld = loc.getPlotArea(); - if (!(plotworld instanceof HybridPlotWorld)) { + PlotArea plotArea = loc.getPlotArea(); + if (!(plotArea instanceof HybridPlotWorld)) { return sendMessage(player, C.NOT_IN_PLOT_WORLD); } Plot plot = player.getCurrentPlot(); @@ -43,15 +43,15 @@ public class DebugRoadRegen extends SubCommand { } } } - boolean result = HybridUtils.manager.regenerateRoad(plotworld, chunk, extend); + boolean result = HybridUtils.manager.regenerateRoad(plotArea, chunk, extend); MainUtil.sendMessage(player, "&6Regenerating chunk: " + chunk.x + ',' + chunk.z + "\n&6 - Result: " + (result ? "&aSuccess" : "&cFailed")); MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads"); } else { - HybridPlotManager manager = (HybridPlotManager) plotworld.getPlotManager(); - manager.createRoadEast(plotworld, plot); - manager.createRoadSouth(plotworld, plot); - manager.createRoadSouthEast(plotworld, plot); + HybridPlotManager manager = (HybridPlotManager) plotArea.getPlotManager(); + manager.createRoadEast(plotArea, plot); + manager.createRoadSouth(plotArea, plot); + manager.createRoadSouthEast(plotArea, plot); MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.getId() + "\n&6 - Result: &aSuccess"); MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads"); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java index a015d4786..4684cdd39 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java @@ -19,14 +19,14 @@ import java.util.ArrayList; public class DebugSaveTest extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { + public boolean onCommand(final PlotPlayer player, String[] args) { ArrayList plots = new ArrayList(); plots.addAll(PS.get().getPlots()); - MainUtil.sendMessage(plr, "&6Starting `DEBUGSAVETEST`"); + MainUtil.sendMessage(player, "&6Starting `DEBUGSAVETEST`"); DBFunc.createPlotsAndData(plots, new Runnable() { @Override public void run() { - MainUtil.sendMessage(plr, "&6Database sync finished!"); + MainUtil.sendMessage(player, "&6Database sync finished!"); } }); return true; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Delete.java index e1377b49a..389771eb1 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Delete.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Delete.java @@ -24,26 +24,26 @@ import com.plotsquared.general.commands.CommandDeclaration; public class Delete extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { + public boolean onCommand(final PlotPlayer player, String[] args) { - Location loc = plr.getLocation(); + Location loc = player.getLocation(); final Plot plot = loc.getPlotAbs(); if (plot == null) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } if (!plot.hasOwner()) { - return !sendMessage(plr, C.PLOT_UNOWNED); + return !sendMessage(player, C.PLOT_UNOWNED); } - if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.delete")) { - return !sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.delete")) { + return !sendMessage(player, C.NO_PLOT_PERMS); } - final PlotArea plotworld = plot.getArea(); + final PlotArea plotArea = plot.getArea(); final java.util.Set plots = plot.getConnectedPlots(); Runnable run = new Runnable() { @Override public void run() { if (plot.getRunning() > 0) { - MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); return; } final long start = System.currentTimeMillis(); @@ -51,25 +51,25 @@ public class Delete extends SubCommand { @Override public void run() { plot.removeRunning(); - if ((EconHandler.manager != null) && plotworld.USE_ECONOMY) { - double value = plotworld.PRICES.get("sell") * plots.size(); + if ((EconHandler.manager != null) && plotArea.USE_ECONOMY) { + double value = plotArea.PRICES.get("sell") * plots.size(); if (value > 0d) { - EconHandler.manager.depositMoney(plr, value); - sendMessage(plr, C.ADDED_BALANCE, String.valueOf(value)); + EconHandler.manager.depositMoney(player, value); + sendMessage(player, C.ADDED_BALANCE, String.valueOf(value)); } } - MainUtil.sendMessage(plr, C.CLEARING_DONE, System.currentTimeMillis() - start); + MainUtil.sendMessage(player, C.CLEARING_DONE, System.currentTimeMillis() - start); } }); if (result) { plot.addRunning(); } else { - MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); } } }; - if (hasConfirmation(plr)) { - CmdConfirm.addPending(plr, getCommandString() + ' ' + plot.getId(), run); + if (hasConfirmation(player)) { + CmdConfirm.addPending(player, getCommandString() + ' ' + plot.getId(), run); } else { TaskManager.runTask(run); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Deny.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Deny.java index c9d8db9b5..b58b44f1d 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Deny.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Deny.java @@ -14,8 +14,9 @@ import com.intellectualcrafters.plot.util.WorldUtil; import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.CommandDeclaration; -import java.util.*; +import java.util.Iterator; import java.util.Set; +import java.util.UUID; @CommandDeclaration(command = "deny", aliases = {"d", "ban"}, @@ -30,74 +31,74 @@ public class Deny extends SubCommand { } @Override - public boolean onCommand(PlotPlayer plr, String[] args) { + public boolean onCommand(PlotPlayer player, String[] args) { - Location location = plr.getLocation(); + Location location = player.getLocation(); Plot plot = location.getPlotAbs(); if (plot == null) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(plr, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.deny")) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.deny")) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return true; } Set uuids = MainUtil.getUUIDsFromString(args[0]); - if (uuids == null || uuids.isEmpty()) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); + if (uuids.isEmpty()) { + MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]); return false; } Iterator iter = uuids.iterator(); while (iter.hasNext()) { UUID uuid = iter.next(); - if (uuid == DBFunc.everyone && !(Permissions.hasPermission(plr, "plots.deny.everyone") || Permissions.hasPermission(plr, "plots.admin.command.deny"))) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, MainUtil.getName(uuid)); + if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, "plots.deny.everyone") || Permissions.hasPermission(player, "plots.admin.command.deny"))) { + MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid)); continue; } if (plot.isOwner(uuid)) { - MainUtil.sendMessage(plr, C.ALREADY_OWNER, MainUtil.getName(uuid)); + MainUtil.sendMessage(player, C.ALREADY_OWNER, MainUtil.getName(uuid)); return false; } if (plot.getDenied().contains(uuid)) { - MainUtil.sendMessage(plr, C.ALREADY_ADDED, MainUtil.getName(uuid)); + MainUtil.sendMessage(player, C.ALREADY_ADDED, MainUtil.getName(uuid)); return false; } plot.removeMember(uuid); plot.removeTrusted(uuid); plot.addDenied(uuid); - EventUtil.manager.callDenied(plr, plot, uuid, true); + EventUtil.manager.callDenied(player, plot, uuid, true); if (!uuid.equals(DBFunc.everyone)) { handleKick(UUIDHandler.getPlayer(uuid), plot); } else { - for (PlotPlayer pp : plot.getPlayersInPlot()) { - handleKick(pp, plot); + for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) { + handleKick(plotPlayer, plot); } } } if (!uuids.isEmpty()) { - MainUtil.sendMessage(plr, C.DENIED_ADDED); + MainUtil.sendMessage(player, C.DENIED_ADDED); } return true; } - private void handleKick(PlotPlayer pp, Plot plot) { - if (pp == null) { + private void handleKick(PlotPlayer player, Plot plot) { + if (player == null) { return; } - if (!plot.equals(pp.getCurrentPlot())) { + if (!plot.equals(player.getCurrentPlot())) { return; } - if (pp.hasPermission("plots.admin.entry.denied")) { + if (player.hasPermission("plots.admin.entry.denied")) { return; } - if (pp.getGameMode() == PlotGameMode.SPECTATOR) { - pp.stopSpectating(); + if (player.getGameMode() == PlotGameMode.SPECTATOR) { + player.stopSpectating(); } - pp.teleport(WorldUtil.IMP.getSpawn(pp.getLocation().getWorld())); - MainUtil.sendMessage(pp, C.YOU_GOT_DENIED); + player.teleport(WorldUtil.IMP.getSpawn(player.getLocation().getWorld())); + MainUtil.sendMessage(player, C.YOU_GOT_DENIED); } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Desc.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Desc.java index d85c7555d..550dfc397 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Desc.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Desc.java @@ -19,18 +19,18 @@ import com.plotsquared.general.commands.CommandDeclaration; public class Desc extends SetCommand { @Override - public boolean set(PlotPlayer plr, Plot plot, String desc) { + public boolean set(PlotPlayer player, Plot plot, String desc) { if (desc.isEmpty()) { plot.removeFlag(Flags.DESCRIPTION); - MainUtil.sendMessage(plr, C.DESC_UNSET); + MainUtil.sendMessage(player, C.DESC_UNSET); return true; } boolean result = FlagManager.addPlotFlag(plot, Flags.DESCRIPTION, desc); if (!result) { - MainUtil.sendMessage(plr, C.FLAG_NOT_ADDED); + MainUtil.sendMessage(player, C.FLAG_NOT_ADDED); return false; } - MainUtil.sendMessage(plr, C.DESC_SET); + MainUtil.sendMessage(player, C.DESC_SET); return true; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Done.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Done.java index 4df2939cc..d2987059f 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Done.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Done.java @@ -22,26 +22,26 @@ import com.plotsquared.general.commands.CommandDeclaration; public class Done extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { - Location loc = plr.getLocation(); + public boolean onCommand(final PlotPlayer player, String[] args) { + Location loc = player.getLocation(); final Plot plot = loc.getPlotAbs(); if ((plot == null) || !plot.hasOwner()) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } - if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.done")) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.done")) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } if (plot.hasFlag(Flags.DONE)) { - MainUtil.sendMessage(plr, C.DONE_ALREADY_DONE); + MainUtil.sendMessage(player, C.DONE_ALREADY_DONE); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); return false; } plot.addRunning(); - MainUtil.sendMessage(plr, C.GENERATING_LINK); + MainUtil.sendMessage(player, C.GENERATING_LINK); HybridUtils.manager.analyzePlot(plot, new RunnableVal() { @Override public void run(PlotAnalysis value) { @@ -49,9 +49,9 @@ public class Done extends SubCommand { if ((value == null) || (value.getComplexity() >= Settings.CLEAR_THRESHOLD)) { long flagValue = System.currentTimeMillis() / 1000; plot.setFlag(Flags.DONE,flagValue); - MainUtil.sendMessage(plr, C.DONE_SUCCESS); + MainUtil.sendMessage(player, C.DONE_SUCCESS); } else { - MainUtil.sendMessage(plr, C.DONE_INSUFFICIENT_COMPLEXITY); + MainUtil.sendMessage(player, C.DONE_INSUFFICIENT_COMPLEXITY); } } }); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java index ff96c96bd..fd0583350 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java @@ -28,30 +28,30 @@ import java.net.URL; public class Download extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { - String world = plr.getLocation().getWorld(); + public boolean onCommand(final PlotPlayer player, String[] args) { + String world = player.getLocation().getWorld(); if (!PS.get().hasPlotArea(world)) { - return !sendMessage(plr, C.NOT_IN_PLOT_WORLD); + return !sendMessage(player, C.NOT_IN_PLOT_WORLD); } - final Plot plot = plr.getCurrentPlot(); + final Plot plot = player.getCurrentPlot(); if (plot == null) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(plr, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } if ((Settings.DOWNLOAD_REQUIRES_DONE && (!plot.getFlag(Flags.DONE).isPresent())) && !Permissions - .hasPermission(plr, "plots.admin.command.download")) { - MainUtil.sendMessage(plr, C.DONE_NOT_DONE); + .hasPermission(player, "plots.admin.command.download")) { + MainUtil.sendMessage(player, C.DONE_NOT_DONE); return false; } - if ((!plot.isOwner(plr.getUUID()))) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if ((!plot.isOwner(player.getUUID()))) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); return false; } if (args.length == 0 || (args.length == 1 && StringMan.isEqualIgnoreCaseToAny(args[0], "sch", "schem", "schematic"))) { @@ -64,20 +64,20 @@ public class Download extends SubCommand { @Override public void run(URL url) { if (url == null) { - MainUtil.sendMessage(plr, C.GENERATING_LINK_FAILED); + MainUtil.sendMessage(player, C.GENERATING_LINK_FAILED); return; } - MainUtil.sendMessage(plr, url.toString()); + MainUtil.sendMessage(player, url.toString()); } }); } }); } else if (args.length == 1 && StringMan.isEqualIgnoreCaseToAny(args[0], "bo3", "bo2", "b03", "b02")) { - if (!Permissions.hasPermission(plr, "plots.download.bo3")) { - C.NO_PERMISSION.send(plr, "plots.download.bo3"); + if (!Permissions.hasPermission(player, "plots.download.bo3")) { + C.NO_PERMISSION.send(player, "plots.download.bo3"); } if (plot.getVolume() > 128d * 128d * 256) { - C.SCHEMATIC_TOO_LARGE.send(plr); + C.SCHEMATIC_TOO_LARGE.send(player); return false; } plot.addRunning(); @@ -86,34 +86,34 @@ public class Download extends SubCommand { public void run(URL url) { plot.removeRunning(); if (url == null) { - MainUtil.sendMessage(plr, C.GENERATING_LINK_FAILED); + MainUtil.sendMessage(player, C.GENERATING_LINK_FAILED); return; } - MainUtil.sendMessage(plr, url.toString()); + MainUtil.sendMessage(player, url.toString()); } }); } else if (args.length == 1 && StringMan.isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) { - if (!Permissions.hasPermission(plr, "plots.download.world")) { - C.NO_PERMISSION.send(plr, "plots.download.world"); + if (!Permissions.hasPermission(player, "plots.download.world")) { + C.NO_PERMISSION.send(player, "plots.download.world"); } - MainUtil.sendMessage(plr, "&cNote: The `.mca` files are 512x512"); + MainUtil.sendMessage(player, "&cNote: The `.mca` files are 512x512"); plot.addRunning(); WorldUtil.IMP.upload(plot, null, null, new RunnableVal() { @Override public void run(URL url) { plot.removeRunning(); if (url == null) { - MainUtil.sendMessage(plr, C.GENERATING_LINK_FAILED); + MainUtil.sendMessage(player, C.GENERATING_LINK_FAILED); return; } - MainUtil.sendMessage(plr, url.toString()); + MainUtil.sendMessage(player, url.toString()); } }); } else { - C.COMMAND_SYNTAX.send(plr, getUsage()); + C.COMMAND_SYNTAX.send(player, getUsage()); return false; } - MainUtil.sendMessage(plr, C.GENERATING_LINK); + MainUtil.sendMessage(player, C.GENERATING_LINK); return true; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Grant.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Grant.java index 052707bc8..8e4316370 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Grant.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Grant.java @@ -9,6 +9,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.UUIDHandler; import com.plotsquared.general.commands.CommandDeclaration; + import java.util.UUID; @CommandDeclaration( @@ -20,21 +21,21 @@ import java.util.UUID; public class Grant extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { + public boolean onCommand(final PlotPlayer player, String[] args) { final String arg0 = args[0].toLowerCase(); switch (arg0) { case "add": case "check": - if (Permissions.hasPermission(plr, "plots.grant." + arg0)) { - C.NO_PERMISSION.send(plr, "plots.grant." + arg0); + if (Permissions.hasPermission(player, "plots.grant." + arg0)) { + C.NO_PERMISSION.send(player, "plots.grant." + arg0); return false; } if (args.length > 2) { break; } - final UUID uuid = args.length == 2 ? UUIDHandler.getUUIDFromString(args[1]) : plr.getUUID(); + final UUID uuid = args.length == 2 ? UUIDHandler.getUUIDFromString(args[1]) : player.getUUID(); if (uuid == null) { - C.INVALID_PLAYER.send(plr, args[1]); + C.INVALID_PLAYER.send(player, args[1]); return false; } MainUtil.getPersistentMeta(uuid, "grantedPlots", new RunnableVal() { @@ -42,7 +43,7 @@ public class Grant extends SubCommand { public void run(byte[] array) { if (arg0.equals("check")) { // check int granted = array == null ? 0 : ByteArrayUtilities.bytesToInteger(array); - C.GRANTED_PLOTS.send(plr, granted); + C.GRANTED_PLOTS.send(player, granted); } else { // add int amount = 1 + (array == null ? 0 : ByteArrayUtilities.bytesToInteger(array)); boolean replace = array != null; @@ -52,7 +53,7 @@ public class Grant extends SubCommand { }); return true; } - C.COMMAND_SYNTAX.send(plr, getUsage()); + C.COMMAND_SYNTAX.send(player, getUsage()); return false; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Kick.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Kick.java index 150c53e28..3f86017f0 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Kick.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Kick.java @@ -11,6 +11,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.WorldUtil; import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.CommandDeclaration; + import java.util.HashSet; import java.util.Set; import java.util.UUID; @@ -29,19 +30,19 @@ public class Kick extends SubCommand { } @Override - public boolean onCommand(PlotPlayer plr, String[] args) { - Location location = plr.getLocation(); + public boolean onCommand(PlotPlayer player, String[] args) { + Location location = player.getLocation(); Plot plot = location.getPlot(); if (plot == null) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } - if ((!plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.kick")) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions.hasPermission(player, "plots.admin.command.kick")) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } Set uuids = MainUtil.getUUIDsFromString(args[0]); - if (uuids == null) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); + if (uuids.isEmpty()) { + MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]); return false; } Set players = new HashSet<>(); @@ -55,33 +56,33 @@ public class Kick extends SubCommand { players.add(pp); } } - players.remove(plr); // Don't ever kick the calling player + players.remove(player); // Don't ever kick the calling player if (players.isEmpty()) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); + MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]); return false; } - for (PlotPlayer player : players) { - Location location2 = player.getLocation(); - if (!plr.getLocation().getWorld().equals(location2.getWorld()) || !plot.equals(location2.getPlot())) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); + for (PlotPlayer player2 : players) { + Location location2 = player2.getLocation(); + if (!player2.getLocation().getWorld().equals(location2.getWorld()) || !plot.equals(location2.getPlot())) { + MainUtil.sendMessage(player2, C.INVALID_PLAYER, args[0]); return false; } - if (player.hasPermission("plots.admin.entry.denied")) { - C.CANNOT_KICK_PLAYER.send(plr, player.getName()); + if (player2.hasPermission("plots.admin.entry.denied")) { + C.CANNOT_KICK_PLAYER.send(player2, player2.getName()); return false; } Location spawn = WorldUtil.IMP.getSpawn(location.getWorld()); - C.YOU_GOT_KICKED.send(player); + C.YOU_GOT_KICKED.send(player2); if (plot.equals(spawn.getPlot())) { - Location newSpawn = WorldUtil.IMP.getSpawn(player); + Location newSpawn = WorldUtil.IMP.getSpawn(player2); if (plot.equals(newSpawn.getPlot())) { // Kick from server if you can't be teleported to spawn - player.kick(C.YOU_GOT_KICKED.s()); + player2.kick(C.YOU_GOT_KICKED.s()); } else { - player.teleport(newSpawn); + player2.teleport(newSpawn); } } else { - player.teleport(spawn); + player2.teleport(spawn); } } return true; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java index ebaa625e5..d6f2d52d9 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java @@ -83,14 +83,14 @@ public class ListCmd extends SubCommand { return args.toArray(new String[args.size()]); } - public void noArgs(PlotPlayer plr) { - MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + Arrays.toString(getArgumentList(plr))); + public void noArgs(PlotPlayer player) { + MainUtil.sendMessage(player, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + Arrays.toString(getArgumentList(player))); } @Override - public boolean onCommand(PlotPlayer plr, String[] args) { + public boolean onCommand(PlotPlayer player, String[] args) { if (args.length < 1) { - noArgs(plr); + noArgs(player); return false; } int page = 0; @@ -108,70 +108,70 @@ public class ListCmd extends SubCommand { List plots = null; - String world = plr.getLocation().getWorld(); - PlotArea area = plr.getApplicablePlotArea(); + String world = player.getLocation().getWorld(); + PlotArea area = player.getApplicablePlotArea(); String arg = args[0].toLowerCase(); boolean sort = true; switch (arg) { case "mine": - if (!Permissions.hasPermission(plr, "plots.list.mine")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.mine"); + if (!Permissions.hasPermission(player, "plots.list.mine")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.mine"); return false; } sort = false; - plots = PS.get().sortPlotsByTemp(PS.get().getBasePlots(plr)); + plots = PS.get().sortPlotsByTemp(PS.get().getBasePlots(player)); break; case "shared": - if (!Permissions.hasPermission(plr, "plots.list.shared")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.shared"); + if (!Permissions.hasPermission(player, "plots.list.shared")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.shared"); return false; } plots = new ArrayList<>(); for (Plot plot : PS.get().getPlots()) { - if (plot.getTrusted().contains(plr.getUUID()) || plot.getMembers().contains(plr.getUUID())) { + if (plot.getTrusted().contains(player.getUUID()) || plot.getMembers().contains(player.getUUID())) { plots.add(plot); } } break; case "world": - if (!Permissions.hasPermission(plr, "plots.list.world")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world"); + if (!Permissions.hasPermission(player, "plots.list.world")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world"); return false; } - if (!Permissions.hasPermission(plr, "plots.list.world." + world)) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world." + world); + if (!Permissions.hasPermission(player, "plots.list.world." + world)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world." + world); return false; } plots = new ArrayList<>(PS.get().getPlots(world)); break; case "expired": - if (!Permissions.hasPermission(plr, "plots.list.expired")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.expired"); + if (!Permissions.hasPermission(player, "plots.list.expired")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.expired"); return false; } plots = ExpireManager.IMP == null ? new ArrayList() : new ArrayList<>(ExpireManager.IMP.getPendingExpired()); break; case "area": - if (!Permissions.hasPermission(plr, "plots.list.area")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.area"); + if (!Permissions.hasPermission(player, "plots.list.area")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.area"); return false; } - if (!Permissions.hasPermission(plr, "plots.list.world." + world)) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world." + world); + if (!Permissions.hasPermission(player, "plots.list.world." + world)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world." + world); return false; } plots = area == null ? new ArrayList() : new ArrayList<>(area.getPlots()); break; case "all": - if (!Permissions.hasPermission(plr, "plots.list.all")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.all"); + if (!Permissions.hasPermission(player, "plots.list.all")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.all"); return false; } plots = new ArrayList<>(PS.get().getPlots()); break; case "done": - if (!Permissions.hasPermission(plr, "plots.list.done")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.done"); + if (!Permissions.hasPermission(player, "plots.list.done")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.done"); return false; } plots = new ArrayList<>(); @@ -199,8 +199,8 @@ public class ListCmd extends SubCommand { sort = false; break; case "top": - if (!Permissions.hasPermission(plr, "plots.list.top")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.top"); + if (!Permissions.hasPermission(player, "plots.list.top")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.top"); return false; } plots = new ArrayList<>(PS.get().getPlots()); @@ -236,8 +236,8 @@ public class ListCmd extends SubCommand { sort = false; break; case "forsale": - if (!Permissions.hasPermission(plr, "plots.list.forsale")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.forsale"); + if (!Permissions.hasPermission(player, "plots.list.forsale")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.forsale"); return false; } if (EconHandler.manager == null) { @@ -252,8 +252,8 @@ public class ListCmd extends SubCommand { } break; case "unowned": - if (!Permissions.hasPermission(plr, "plots.list.unowned")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.unowned"); + if (!Permissions.hasPermission(player, "plots.list.unowned")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.unowned"); return false; } plots = new ArrayList<>(); @@ -264,8 +264,8 @@ public class ListCmd extends SubCommand { } break; case "unknown": - if (!Permissions.hasPermission(plr, "plots.list.unknown")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.unknown"); + if (!Permissions.hasPermission(player, "plots.list.unknown")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.unknown"); return false; } plots = new ArrayList<>(); @@ -279,12 +279,12 @@ public class ListCmd extends SubCommand { } break; case "fuzzy": - if (!Permissions.hasPermission(plr, "plots.list.fuzzy")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.fuzzy"); + if (!Permissions.hasPermission(player, "plots.list.fuzzy")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.fuzzy"); return false; } if (args.length < (page == -1 ? 2 : 3)) { - C.COMMAND_SYNTAX.send(plr, "/plot list fuzzy [#]"); + C.COMMAND_SYNTAX.send(player, "/plot list fuzzy [#]"); return false; } String term; @@ -298,12 +298,12 @@ public class ListCmd extends SubCommand { break; default: if (PS.get().hasPlotArea(args[0])) { - if (!Permissions.hasPermission(plr, "plots.list.world")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world"); + if (!Permissions.hasPermission(player, "plots.list.world")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world"); return false; } - if (!Permissions.hasPermission(plr, "plots.list.world." + args[0])) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world." + args[0]); + if (!Permissions.hasPermission(player, "plots.list.world." + args[0])) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world." + args[0]); return false; } plots = new ArrayList<>(PS.get().getPlots(args[0])); @@ -316,8 +316,8 @@ public class ListCmd extends SubCommand { } catch (Exception ignored) {} } if (uuid != null) { - if (!Permissions.hasPermission(plr, "plots.list.player")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.player"); + if (!Permissions.hasPermission(player, "plots.list.player")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.player"); return false; } sort = false; @@ -327,15 +327,15 @@ public class ListCmd extends SubCommand { } if (plots == null) { - sendMessage(plr, C.DID_YOU_MEAN, new StringComparison<>(args[0], new String[]{"mine", "shared", "world", "all"}).getBestMatch()); + sendMessage(player, C.DID_YOU_MEAN, new StringComparison<>(args[0], new String[]{"mine", "shared", "world", "all"}).getBestMatch()); return false; } if (plots.isEmpty()) { - MainUtil.sendMessage(plr, C.FOUND_NO_PLOTS); + MainUtil.sendMessage(player, C.FOUND_NO_PLOTS); return false; } - displayPlots(plr, plots, 12, page, area, args, sort); + displayPlots(player, plots, 12, page, area, args, sort); return true; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java index 7334a11f3..706228dec 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java @@ -29,40 +29,40 @@ import java.util.List; public class Load extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { + public boolean onCommand(final PlotPlayer player, String[] args) { if (!Settings.METRICS) { - MainUtil.sendMessage(plr, + MainUtil.sendMessage(player, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service"); return false; } - String world = plr.getLocation().getWorld(); + String world = player.getLocation().getWorld(); if (!PS.get().hasPlotArea(world)) { - return !sendMessage(plr, C.NOT_IN_PLOT_WORLD); + return !sendMessage(player, C.NOT_IN_PLOT_WORLD); } - final Plot plot = plr.getCurrentPlot(); + final Plot plot = player.getCurrentPlot(); if (plot == null) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(plr, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.load")) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.load")) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); return false; } if (args.length != 0) { if (args.length == 1) { - List schematics = plr.getMeta("plot_schematics"); + List schematics = player.getMeta("plot_schematics"); if (schematics == null) { // No schematics found: - MainUtil.sendMessage(plr, C.LOAD_NULL); + MainUtil.sendMessage(player, C.LOAD_NULL); return false; } String schematic; @@ -70,26 +70,26 @@ public class Load extends SubCommand { schematic = schematics.get(Integer.parseInt(args[0]) - 1); } catch (NumberFormatException ignored) { // use /plot load - MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER, "(1, " + schematics.size() + ')'); + MainUtil.sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + schematics.size() + ')'); return false; } final URL url; try { - url = new URL(Settings.WEB_URL + "saves/" + plr.getUUID() + '/' + schematic + ".schematic"); + url = new URL(Settings.WEB_URL + "saves/" + player.getUUID() + '/' + schematic + ".schematic"); } catch (MalformedURLException e) { e.printStackTrace(); - MainUtil.sendMessage(plr, C.LOAD_FAILED); + MainUtil.sendMessage(player, C.LOAD_FAILED); return false; } plot.addRunning(); - MainUtil.sendMessage(plr, C.GENERATING_COMPONENT); + MainUtil.sendMessage(player, C.GENERATING_COMPONENT); TaskManager.runTaskAsync(new Runnable() { @Override public void run() { Schematic schematic = SchematicHandler.manager.getSchematic(url); if (schematic == null) { plot.removeRunning(); - sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent or not in gzip format"); + sendMessage(player, C.SCHEMATIC_INVALID, "non-existent or not in gzip format"); return; } SchematicHandler.manager.paste(schematic, plot, 0, 0, 0, true, new RunnableVal() { @@ -97,9 +97,9 @@ public class Load extends SubCommand { public void run(Boolean value) { plot.removeRunning(); if (value) { - sendMessage(plr, C.SCHEMATIC_PASTE_SUCCESS); + sendMessage(player, C.SCHEMATIC_PASTE_SUCCESS); } else { - sendMessage(plr, C.SCHEMATIC_PASTE_FAILED); + sendMessage(player, C.SCHEMATIC_PASTE_FAILED); } } }); @@ -108,30 +108,30 @@ public class Load extends SubCommand { return true; } plot.removeRunning(); - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot load "); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot load "); return false; } // list schematics - List schematics = plr.getMeta("plot_schematics"); + List schematics = player.getMeta("plot_schematics"); if (schematics == null) { plot.addRunning(); TaskManager.runTaskAsync(new Runnable() { @Override public void run() { - List schematics = SchematicHandler.manager.getSaves(plr.getUUID()); + List schematics = SchematicHandler.manager.getSaves(player.getUUID()); plot.removeRunning(); if ((schematics == null) || schematics.isEmpty()) { - MainUtil.sendMessage(plr, C.LOAD_FAILED); + MainUtil.sendMessage(player, C.LOAD_FAILED); return; } - plr.setMeta("plot_schematics", schematics); - displaySaves(plr); + player.setMeta("plot_schematics", schematics); + displaySaves(player); } }); } else { - displaySaves(plr); + displaySaves(player); } return true; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index d10c3887e..29848f6ce 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -51,40 +51,40 @@ public class Merge extends SubCommand { } @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { - Location loc = plr.getLocationFull(); + public boolean onCommand(final PlotPlayer player, String[] args) { + Location loc = player.getLocationFull(); final Plot plot = loc.getPlotAbs(); if (plot == null) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(plr, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - UUID uuid = plr.getUUID(); + UUID uuid = player.getUUID(); if (!plot.isOwner(uuid)) { - if (!Permissions.hasPermission(plr, "plots.admin.command.merge")) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!Permissions.hasPermission(player, "plots.admin.command.merge")) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } else { uuid = plot.owner; } } - final PlotArea plotworld = plot.getArea(); - final double price = plotworld.PRICES.containsKey("merge") ? plotworld.PRICES.get("merge") : 0; - if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d && EconHandler.manager.getMoney(plr) < price) { - sendMessage(plr, C.CANNOT_AFFORD_MERGE, String.valueOf(price)); + final PlotArea plotArea = plot.getArea(); + final double price = plotArea.PRICES.containsKey("merge") ? plotArea.PRICES.get("merge") : 0; + if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d && EconHandler.manager.getMoney(player) < price) { + sendMessage(player, C.CANNOT_AFFORD_MERGE, String.valueOf(price)); return false; } final int size = plot.getConnectedPlots().size(); - final int maxSize = Permissions.hasPermissionRange(plr, "plots.merge", Settings.MAX_PLOTS); + final int maxSize = Permissions.hasPermissionRange(player, "plots.merge", Settings.MAX_PLOTS); if (size - 1 > maxSize) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.merge." + (size + 1)); + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.merge." + (size + 1)); return false; } int direction = -1; if (args.length == 0) { - switch (direction(plr.getLocationFull().getYaw())) { + switch (direction(player.getLocationFull().getYaw())) { case "NORTH": direction = 0; break; @@ -105,14 +105,14 @@ public class Merge extends SubCommand { terrain = "true".equalsIgnoreCase(args[1]); } if (plot.autoMerge(-1, maxSize, uuid, terrain)) { - if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d) { - EconHandler.manager.withdrawMoney(plr, price); - sendMessage(plr, C.REMOVED_BALANCE, String.valueOf(price)); + if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) { + EconHandler.manager.withdrawMoney(player, price); + sendMessage(player, C.REMOVED_BALANCE, String.valueOf(price)); } - MainUtil.sendMessage(plr, C.SUCCESS_MERGE); + MainUtil.sendMessage(player, C.SUCCESS_MERGE); return true; } - MainUtil.sendMessage(plr, C.NO_AVAILABLE_AUTOMERGE); + MainUtil.sendMessage(player, C.NO_AVAILABLE_AUTOMERGE); return false; } @@ -124,8 +124,8 @@ public class Merge extends SubCommand { } } if (direction == -1) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + "> [removeroads]"); - MainUtil.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw()))); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + "> [removeroads]"); + MainUtil.sendMessage(player, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw()))); return false; } final boolean terrain; @@ -135,20 +135,20 @@ public class Merge extends SubCommand { terrain = Settings.MERGE_REMOVES_ROADS; } if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) { - if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d) { - EconHandler.manager.withdrawMoney(plr, price); - sendMessage(plr, C.REMOVED_BALANCE, String.valueOf(price)); + if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) { + EconHandler.manager.withdrawMoney(player, price); + sendMessage(player, C.REMOVED_BALANCE, String.valueOf(price)); } - MainUtil.sendMessage(plr, C.SUCCESS_MERGE); + MainUtil.sendMessage(player, C.SUCCESS_MERGE); return true; } Plot adjacent = plot.getRelative(direction); if (adjacent == null || !adjacent.hasOwner() || adjacent.getMerged((direction + 2) % 4) || adjacent.isOwner(uuid)) { - MainUtil.sendMessage(plr, C.NO_AVAILABLE_AUTOMERGE); + MainUtil.sendMessage(player, C.NO_AVAILABLE_AUTOMERGE); return false; } - if (!Permissions.hasPermission(plr, C.PERMISSION_MERGE_OTHER)) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, C.PERMISSION_MERGE_OTHER); + if (!Permissions.hasPermission(player, C.PERMISSION_MERGE_OTHER)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_MERGE_OTHER); return false; } java.util.Set uuids = adjacent.getOwners(); @@ -165,33 +165,33 @@ public class Merge extends SubCommand { public void run() { MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED); plot.autoMerge(dir, maxSize - size, owner, terrain); - PlotPlayer pp = UUIDHandler.getPlayer(plr.getUUID()); + PlotPlayer pp = UUIDHandler.getPlayer(player.getUUID()); if (pp == null) { sendMessage(accepter, C.MERGE_NOT_VALID); return; } - if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d) { - if (EconHandler.manager.getMoney(plr) < price) { - sendMessage(plr, C.CANNOT_AFFORD_MERGE, String.valueOf(price)); + if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) { + if (EconHandler.manager.getMoney(player) < price) { + sendMessage(player, C.CANNOT_AFFORD_MERGE, String.valueOf(price)); return; } - EconHandler.manager.withdrawMoney(plr, price); - sendMessage(plr, C.REMOVED_BALANCE, String.valueOf(price)); + EconHandler.manager.withdrawMoney(player, price); + sendMessage(player, C.REMOVED_BALANCE, String.valueOf(price)); } - MainUtil.sendMessage(plr, C.SUCCESS_MERGE); + MainUtil.sendMessage(player, C.SUCCESS_MERGE); } }; - if (hasConfirmation(plr)) { - CmdConfirm.addPending(accepter, C.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", plr.getName()), run); + if (hasConfirmation(player)) { + CmdConfirm.addPending(accepter, C.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", player.getName()), run); } else { run.run(); } } if (!isOnline) { - MainUtil.sendMessage(plr, C.NO_AVAILABLE_AUTOMERGE); + MainUtil.sendMessage(player, C.NO_AVAILABLE_AUTOMERGE); return false; } - MainUtil.sendMessage(plr, C.MERGE_REQUESTED); + MainUtil.sendMessage(player, C.MERGE_REQUESTED); return true; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Move.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Move.java index d3218dc3e..905ff9140 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Move.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Move.java @@ -19,42 +19,42 @@ import com.plotsquared.general.commands.CommandDeclaration; public class Move extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { - Location loc = plr.getLocation(); + public boolean onCommand(final PlotPlayer player, String[] args) { + Location loc = player.getLocation(); Plot plot1 = loc.getPlotAbs(); if (plot1 == null) { - return !MainUtil.sendMessage(plr, C.NOT_IN_PLOT); + return !MainUtil.sendMessage(player, C.NOT_IN_PLOT); } - if (!plot1.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, C.PERMISSION_ADMIN.s())) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot1.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN.s())) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } if (args.length != 1) { - C.COMMAND_SYNTAX.send(plr, getUsage()); + C.COMMAND_SYNTAX.send(player, getUsage()); return false; } - Plot plot2 = MainUtil.getPlotFromString(plr, args[0], true); + Plot plot2 = MainUtil.getPlotFromString(player, args[0], true); if (plot2 == null) { return false; } if (plot1.equals(plot2)) { - MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID); - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy "); + MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot copy "); return false; } if (!plot1.getArea().isCompatible(plot2.getArea())) { - C.PLOTWORLD_INCOMPATIBLE.send(plr); + C.PLOTWORLD_INCOMPATIBLE.send(player); return false; } if (plot1.move(plot2, new Runnable() { @Override public void run() { - MainUtil.sendMessage(plr, C.MOVE_SUCCESS); + MainUtil.sendMessage(player, C.MOVE_SUCCESS); } }, false)) { return true; } else { - MainUtil.sendMessage(plr, C.REQUIRES_UNOWNED); + MainUtil.sendMessage(player, C.REQUIRES_UNOWNED); return false; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java index 08400128e..05cba4c0a 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java @@ -26,7 +26,7 @@ import java.util.UUID; public class Owner extends SetCommand { @Override - public boolean set(final PlotPlayer plr, final Plot plot, String value) { + public boolean set(final PlotPlayer player, final Plot plot, String value) { Set plots = plot.getConnectedPlots(); UUID uuid = null; String name = null; @@ -48,26 +48,26 @@ public class Owner extends SetCommand { current.unclaim(); current.removeSign(); } - MainUtil.sendMessage(plr, C.SET_OWNER); + MainUtil.sendMessage(player, C.SET_OWNER); return true; } - C.INVALID_PLAYER.send(plr, value); + C.INVALID_PLAYER.send(player, value); return false; } if (plot.isOwner(uuid)) { - C.ALREADY_OWNER.send(plr); + C.ALREADY_OWNER.send(player); return false; } final PlotPlayer other = UUIDHandler.getPlayer(uuid); - if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) { + if (!Permissions.hasPermission(player, "plots.admin.command.setowner")) { if (other == null) { - C.INVALID_PLAYER_OFFLINE.send(plr, value); + C.INVALID_PLAYER_OFFLINE.send(player, value); return false; } int size = plots.size(); int currentPlots = (Settings.GLOBAL_LIMIT ? other.getPlotCount() : other.getPlotCount(plot.getArea().worldname)) + size; if (currentPlots > other.getAllowedPlots()) { - sendMessage(plr, C.CANT_TRANSFER_MORE_PLOTS); + sendMessage(player, C.CANT_TRANSFER_MORE_PLOTS); return false; } } @@ -78,14 +78,14 @@ public class Owner extends SetCommand { public void run() { plot.setOwner(finalUUID); plot.setSign(finalName); - MainUtil.sendMessage(plr, C.SET_OWNER); + MainUtil.sendMessage(player, C.SET_OWNER); if (other != null) { MainUtil.sendMessage(other, C.NOW_OWNER, plot.getArea() + ";" + plot.getId()); } } }; - if (hasConfirmation(plr)) { - CmdConfirm.addPending(plr, "/plot set owner " + value, run); + if (hasConfirmation(player)) { + CmdConfirm.addPending(player, "/plot set owner " + value, run); } else { TaskManager.runTask(run); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/PluginCmd.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/PluginCmd.java index 99351dd66..3c89c7c01 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/PluginCmd.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/PluginCmd.java @@ -16,11 +16,11 @@ import com.plotsquared.general.commands.CommandDeclaration; public class PluginCmd extends SubCommand { @Override - public boolean onCommand(PlotPlayer plr, String[] args) { - MainUtil.sendMessage(plr, String.format("$2>> $1&lPlotSquared $2($1Version$2: $1%s$2)", StringMan.join(PS.get().getVersion(), "."))); - MainUtil.sendMessage(plr, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev"); - MainUtil.sendMessage(plr, "$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki"); - MainUtil.sendMessage(plr, "$2>> $1&lNewest Version$2: $1" + getNewestVersionString()); + public boolean onCommand(PlotPlayer player, String[] args) { + MainUtil.sendMessage(player, String.format("$2>> $1&lPlotSquared $2($1Version$2: $1%s$2)", StringMan.join(PS.get().getVersion(), "."))); + MainUtil.sendMessage(player, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev"); + MainUtil.sendMessage(player, "$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki"); + MainUtil.sendMessage(player, "$2>> $1&lNewest Version$2: $1" + getNewestVersionString()); return true; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Purge.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Purge.java index 73eb77d90..eb964e43a 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Purge.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Purge.java @@ -29,7 +29,7 @@ import java.util.UUID; public class Purge extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { + public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length == 0) { return false; } @@ -43,7 +43,7 @@ public class Purge extends SubCommand { for (String arg : args) { String[] split = arg.split(":"); if (split.length != 2) { - C.COMMAND_SYNTAX.send(plr, getUsage()); + C.COMMAND_SYNTAX.send(player, getUsage()); return false; } switch (split[0].toLowerCase()) { @@ -55,7 +55,7 @@ public class Purge extends SubCommand { case "a": area = PS.get().getPlotAreaByString(split[1]); if (area == null) { - C.NOT_VALID_PLOT_WORLD.send(plr, split[1]); + C.NOT_VALID_PLOT_WORLD.send(player, split[1]); return false; } break; @@ -63,7 +63,7 @@ public class Purge extends SubCommand { case "id": id = PlotId.fromString(split[1]); if (id == null) { - C.NOT_VALID_PLOT_ID.send(plr, split[1]); + C.NOT_VALID_PLOT_ID.send(player, split[1]); return false; } break; @@ -71,7 +71,7 @@ public class Purge extends SubCommand { case "o": owner = UUIDHandler.getUUID(split[1], null); if (owner == null) { - C.INVALID_PLAYER.send(plr, split[1]); + C.INVALID_PLAYER.send(player, split[1]); return false; } break; @@ -79,7 +79,7 @@ public class Purge extends SubCommand { case "s": added = UUIDHandler.getUUID(split[1], null); if (added == null) { - C.INVALID_PLAYER.send(plr, split[1]); + C.INVALID_PLAYER.send(player, split[1]); return false; } break; @@ -139,7 +139,7 @@ public class Purge extends SubCommand { } } if (toDelete.isEmpty()) { - C.FOUND_NO_PLOTS.send(plr); + C.FOUND_NO_PLOTS.send(player); return false; } String cmd = "/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)"; @@ -158,11 +158,11 @@ public class Purge extends SubCommand { } } DBFunc.purgeIds(ids); - C.PURGE_SUCCESS.send(plr, ids.size() + "/" + toDelete.size()); + C.PURGE_SUCCESS.send(player, ids.size() + "/" + toDelete.size()); } }; - if (hasConfirmation(plr)) { - CmdConfirm.addPending(plr, cmd, run); + if (hasConfirmation(player)) { + CmdConfirm.addPending(player, cmd, run); } else { run.run(); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java index dd578c76f..56df1618b 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java @@ -26,39 +26,39 @@ import java.util.Set; public class RegenAllRoads extends SubCommand { @Override - public boolean onCommand(PlotPlayer plr, String[] args) { + public boolean onCommand(PlotPlayer player, String[] args) { int height = 0; if (args.length == 2) { try { height = Integer.parseInt(args[1]); } catch (NumberFormatException ignored) { - MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER, "(0, 256)"); - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot regenallroads [height]"); + MainUtil.sendMessage(player, C.NOT_VALID_NUMBER, "(0, 256)"); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot regenallroads [height]"); return false; } } else if (args.length != 1) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot regenallroads [height]"); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot regenallroads [height]"); return false; } PlotArea area = PS.get().getPlotAreaByString(args[0]); if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) { - C.NOT_VALID_PLOT_WORLD.send(plr, args[0]); + C.NOT_VALID_PLOT_WORLD.send(player, args[0]); return false; } String name = args[0]; PlotManager manager = area.getPlotManager(); if (!(manager instanceof HybridPlotManager)) { - MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD); + MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD); return false; } Set chunks = ChunkManager.manager.getChunkChunks(name); - MainUtil.sendMessage(plr, "&cIf no schematic is set, the following will not do anything"); - MainUtil.sendMessage(plr, "&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic"); - MainUtil.sendMessage(plr, "&6Potential chunks to update: &7" + (chunks.size() * 1024)); - MainUtil.sendMessage(plr, "&6Estimated time: &7" + chunks.size() + " seconds"); + MainUtil.sendMessage(player, "&cIf no schematic is set, the following will not do anything"); + MainUtil.sendMessage(player, "&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic"); + MainUtil.sendMessage(player, "&6Potential chunks to update: &7" + (chunks.size() * 1024)); + MainUtil.sendMessage(player, "&6Estimated time: &7" + chunks.size() + " seconds"); boolean result = HybridUtils.manager.scheduleRoadUpdate(area, height); if (!result) { - MainUtil.sendMessage(plr, "&cCannot schedule mass schematic update! (Is one already in progress?)"); + MainUtil.sendMessage(player, "&cCannot schedule mass schematic update! (Is one already in progress?)"); return false; } return true; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Reload.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Reload.java index 64da9db21..928f6831d 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Reload.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Reload.java @@ -23,7 +23,7 @@ import java.util.Objects; public class Reload extends SubCommand { @Override - public boolean onCommand(PlotPlayer plr, String[] args) { + public boolean onCommand(PlotPlayer player, String[] args) { try { // The following won't affect world generation, as that has to be // loaded during startup unfortunately. @@ -78,10 +78,10 @@ public class Reload extends SubCommand { } }); PS.get().config.save(PS.get().configFile); - MainUtil.sendMessage(plr, C.RELOADED_CONFIGS); + MainUtil.sendMessage(player, C.RELOADED_CONFIGS); } catch (InvalidConfigurationException | IOException e) { e.printStackTrace(); - MainUtil.sendMessage(plr, C.RELOAD_FAILED); + MainUtil.sendMessage(player, C.RELOAD_FAILED); } return true; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java index fa5e48104..d85ff520d 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java @@ -10,8 +10,10 @@ import com.intellectualcrafters.plot.util.UUIDHandler; import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.CommandDeclaration; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; import java.util.Set; +import java.util.UUID; @CommandDeclaration( command = "remove", @@ -28,18 +30,18 @@ public class Remove extends SubCommand { } @Override - public boolean onCommand(PlotPlayer plr, String[] args) { - Location loc = plr.getLocation(); - Plot plot = loc.getPlotAbs(); + public boolean onCommand(PlotPlayer player, String[] args) { + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(plr, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.remove")) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.remove")) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return true; } int count = 0; @@ -65,7 +67,7 @@ public class Remove extends SubCommand { } default: Set uuids = MainUtil.getUUIDsFromString(args[0]); - if (uuids != null) { + if (uuids.isEmpty()) { for (UUID uuid : uuids) { if (plot.getTrusted().contains(uuid)) { if (plot.removeTrusted(uuid)) { @@ -85,10 +87,10 @@ public class Remove extends SubCommand { break; } if (count == 0) { - MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); + MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]); return false; } else { - MainUtil.sendMessage(plr, C.REMOVED_PLAYERS, count + ""); + MainUtil.sendMessage(player, C.REMOVED_PLAYERS, count + ""); } return true; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Save.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Save.java index 828864d9c..f388eaf0d 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Save.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Save.java @@ -28,31 +28,31 @@ import java.util.UUID; public class Save extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { + public boolean onCommand(final PlotPlayer player, String[] args) { if (!Settings.METRICS) { - MainUtil.sendMessage(plr, + MainUtil.sendMessage(player, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service"); return false; } - String world = plr.getLocation().getWorld(); + String world = player.getLocation().getWorld(); if (!PS.get().hasPlotArea(world)) { - return !sendMessage(plr, C.NOT_IN_PLOT_WORLD); + return !sendMessage(player, C.NOT_IN_PLOT_WORLD); } - final Plot plot = plr.getCurrentPlot(); + final Plot plot = player.getCurrentPlot(); if (plot == null) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(plr, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.save")) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.save")) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); return false; } plot.addRunning(); @@ -69,17 +69,17 @@ public class Save extends SubCommand { PlotId id = plot.getId(); String world = plot.getArea().toString().replaceAll(";", "-").replaceAll("[^A-Za-z0-9]", ""); final String file = time + '_' + world + '_' + id.x + '_' + id.y + '_' + size + '_' + name; - UUID uuid = plr.getUUID(); + UUID uuid = player.getUUID(); SchematicHandler.manager.upload(value, uuid, file, new RunnableVal() { @Override public void run(URL url) { plot.removeRunning(); if (url == null) { - MainUtil.sendMessage(plr, C.SAVE_FAILED); + MainUtil.sendMessage(player, C.SAVE_FAILED); return; } - MainUtil.sendMessage(plr, C.SAVE_SUCCESS); - List schematics = plr.getMeta("plot_schematics"); + MainUtil.sendMessage(player, C.SAVE_SUCCESS); + List schematics = player.getMeta("plot_schematics"); if (schematics != null) { schematics.add(file); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java index 3ac516f24..005b7bed7 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java @@ -33,37 +33,37 @@ public class SchematicCmd extends SubCommand { private boolean running = false; @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { + public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length < 1) { - sendMessage(plr, C.SCHEMATIC_MISSING_ARG); + sendMessage(player, C.SCHEMATIC_MISSING_ARG); return true; } String arg = args[0].toLowerCase(); switch (arg) { case "paste": { - if (!Permissions.hasPermission(plr, "plots.schematic.paste")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste"); + if (!Permissions.hasPermission(player, "plots.schematic.paste")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.schematic.paste"); return false; } if (args.length < 2) { - sendMessage(plr, C.SCHEMATIC_MISSING_ARG); + sendMessage(player, C.SCHEMATIC_MISSING_ARG); break; } - Location loc = plr.getLocation(); + Location loc = player.getLocation(); final Plot plot = loc.getPlotAbs(); if (plot == null) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(plr, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.schematic.paste")) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.schematic.paste")) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } if (this.running) { - MainUtil.sendMessage(plr, "&cTask is already running."); + MainUtil.sendMessage(player, "&cTask is already running."); return false; } final String location = args[1]; @@ -80,7 +80,7 @@ public class SchematicCmd extends SubCommand { schematic = SchematicHandler.manager.getSchematic(url); } catch (Exception e) { e.printStackTrace(); - sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent url: " + location); + sendMessage(player, C.SCHEMATIC_INVALID, "non-existent url: " + location); SchematicCmd.this.running = false; return; } @@ -89,7 +89,7 @@ public class SchematicCmd extends SubCommand { } if (schematic == null) { SchematicCmd.this.running = false; - sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent or not in gzip format"); + sendMessage(player, C.SCHEMATIC_INVALID, "non-existent or not in gzip format"); return; } SchematicHandler.manager.paste(schematic, plot, 0, 0, 0, true, new RunnableVal() { @@ -97,9 +97,9 @@ public class SchematicCmd extends SubCommand { public void run(Boolean value) { SchematicCmd.this.running = false; if (value) { - sendMessage(plr, C.SCHEMATIC_PASTE_SUCCESS); + sendMessage(player, C.SCHEMATIC_PASTE_SUCCESS); } else { - sendMessage(plr, C.SCHEMATIC_PASTE_FAILED); + sendMessage(player, C.SCHEMATIC_PASTE_FAILED); } } }); @@ -141,81 +141,81 @@ public class SchematicCmd extends SubCommand { // } case "saveall": case "exportall": { - if (!(plr instanceof ConsolePlayer)) { - MainUtil.sendMessage(plr, C.NOT_CONSOLE); + if (!(player instanceof ConsolePlayer)) { + MainUtil.sendMessage(player, C.NOT_CONSOLE); return false; } if (args.length != 2) { - MainUtil.sendMessage(plr, "&cNeed world argument. Use &7/plots sch exportall "); + MainUtil.sendMessage(player, "&cNeed world argument. Use &7/plots sch exportall "); return false; } PlotArea area = PS.get().getPlotAreaByString(args[1]); if (area == null) { - C.NOT_VALID_PLOT_WORLD.send(plr, args[1]); + C.NOT_VALID_PLOT_WORLD.send(player, args[1]); return false; } Collection plots = area.getPlots(); if (plots.isEmpty()) { - MainUtil.sendMessage(plr, "&cInvalid world. Use &7/plots sch exportall "); + MainUtil.sendMessage(player, "&cInvalid world. Use &7/plots sch exportall "); return false; } boolean result = SchematicHandler.manager.exportAll(plots, null, null, new Runnable() { @Override public void run() { - MainUtil.sendMessage(plr, "&aFinished mass export"); + MainUtil.sendMessage(player, "&aFinished mass export"); } }); if (!result) { - MainUtil.sendMessage(plr, "&cTask is already running."); + MainUtil.sendMessage(player, "&cTask is already running."); return false; } else { - MainUtil.sendMessage(plr, "&3PlotSquared&8->&3Schematic&8: &7Mass export has started. This may take a while."); - MainUtil.sendMessage(plr, "&3PlotSquared&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots..."); + MainUtil.sendMessage(player, "&3PlotSquared&8->&3Schematic&8: &7Mass export has started. This may take a while."); + MainUtil.sendMessage(player, "&3PlotSquared&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots..."); } break; } case "export": case "save": - if (!Permissions.hasPermission(plr, "plots.schematic.save")) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save"); + if (!Permissions.hasPermission(player, "plots.schematic.save")) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.schematic.save"); return false; } if (this.running) { - MainUtil.sendMessage(plr, "&cTask is already running."); + MainUtil.sendMessage(player, "&cTask is already running."); return false; } - Location loc = plr.getLocation(); - Plot plot = loc.getPlotAbs(); + Location location = player.getLocation(); + Plot plot = location.getPlotAbs(); if (plot == null) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(plr, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.schematic.save")) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.schematic.save")) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } - loc.getWorld(); - Collection plots = new ArrayList(); + location.getWorld(); + Collection plots = new ArrayList<>(); plots.add(plot); boolean result = SchematicHandler.manager.exportAll(plots, null, null, new Runnable() { @Override public void run() { - MainUtil.sendMessage(plr, "&aFinished export"); + MainUtil.sendMessage(player, "&aFinished export"); SchematicCmd.this.running = false; } }); if (!result) { - MainUtil.sendMessage(plr, "&cTask is already running."); + MainUtil.sendMessage(player, "&cTask is already running."); return false; } else { - MainUtil.sendMessage(plr, "&7Starting export..."); + MainUtil.sendMessage(player, "&7Starting export..."); } break; default: - sendMessage(plr, C.SCHEMATIC_MISSING_ARG); + sendMessage(player, C.SCHEMATIC_MISSING_ARG); break; } return true; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Set.java index a2d558f76..893e2a33d 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -47,25 +47,25 @@ public class Set extends SubCommand { } @Override - public boolean set(PlotPlayer plr, final Plot plot, String value) { - PlotArea plotworld = plr.getLocation().getPlotArea(); - PlotManager manager = plr.getLocation().getPlotManager(); - String[] components = manager.getPlotComponents(plotworld, plot.getId()); - boolean allowUnsafe = DebugAllowUnsafe.unsafeAllowed.contains(plr.getUUID()); + public boolean set(PlotPlayer player, final Plot plot, String value) { + PlotArea plotArea = player.getLocation().getPlotArea(); + PlotManager manager = player.getLocation().getPlotManager(); + String[] components = manager.getPlotComponents(plotArea, plot.getId()); + boolean allowUnsafe = DebugAllowUnsafe.unsafeAllowed.contains(player.getUUID()); String[] args = value.split(" "); String material = StringMan.join(Arrays.copyOfRange(args, 1, args.length), ",").trim(); for (String component : components) { if (component.equalsIgnoreCase(args[0])) { - if (!Permissions.hasPermission(plr, "plots.set." + component)) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set." + component); + if (!Permissions.hasPermission(player, "plots.set." + component)) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set." + component); return false; } PlotBlock[] blocks; try { if (args.length < 2) { - MainUtil.sendMessage(plr, C.NEED_BLOCK); + MainUtil.sendMessage(player, C.NEED_BLOCK); return true; } String[] split = material.split(","); @@ -73,7 +73,7 @@ public class Set extends SubCommand { for (int i = 0; i < blocks.length; i++) { PlotBlock block = blocks[i]; if (block == null) { - MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK, split[i]); + MainUtil.sendMessage(player, C.NOT_VALID_BLOCK, split[i]); String name; if (split[i].contains("%")) { name = split[i].split("%")[1]; @@ -84,36 +84,36 @@ public class Set extends SubCommand { if (match != null) { name = WorldUtil.IMP.getClosestMatchingName(match.best); if (name != null) { - MainUtil.sendMessage(plr, C.DID_YOU_MEAN, name.toLowerCase()); + MainUtil.sendMessage(player, C.DID_YOU_MEAN, name.toLowerCase()); } } return false; } else if (!allowUnsafe && !WorldUtil.IMP.isBlockSolid(block)) { - MainUtil.sendMessage(plr, C.NOT_ALLOWED_BLOCK, block.toString()); + MainUtil.sendMessage(player, C.NOT_ALLOWED_BLOCK, block.toString()); return false; } } if (!allowUnsafe) { for (PlotBlock block : blocks) { if (!WorldUtil.IMP.isBlockSolid(block)) { - MainUtil.sendMessage(plr, C.NOT_ALLOWED_BLOCK, block.toString()); + MainUtil.sendMessage(player, C.NOT_ALLOWED_BLOCK, block.toString()); return false; } } } } catch (Exception ignored) { - MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK, material); + MainUtil.sendMessage(player, C.NOT_VALID_BLOCK, material); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); return false; } plot.addRunning(); for (Plot current : plot.getConnectedPlots()) { current.setComponent(component, blocks); } - MainUtil.sendMessage(plr, C.GENERATING_COMPONENT); + MainUtil.sendMessage(player, C.GENERATING_COMPONENT); SetQueue.IMP.addTask(new Runnable() { @Override public void run() { @@ -128,37 +128,37 @@ public class Set extends SubCommand { }; } - public boolean noArgs(PlotPlayer plr) { + public boolean noArgs(PlotPlayer player) { ArrayList newValues = new ArrayList<>(); newValues.addAll(Arrays.asList("biome", "alias", "home", "flag")); - Plot plot = plr.getCurrentPlot(); + Plot plot = player.getCurrentPlot(); if (plot != null) { newValues.addAll(Arrays.asList(plot.getManager().getPlotComponents(plot.getArea(), plot.getId()))); } - MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan.join(newValues, C.BLOCK_LIST_SEPARATER.formatted())); + MainUtil.sendMessage(player, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan.join(newValues, C.BLOCK_LIST_SEPARATER.formatted())); return false; } @Override - public boolean onCommand(PlotPlayer plr, String[] args) { + public boolean onCommand(PlotPlayer player, String[] args) { if (args.length == 0) { - return noArgs(plr); + return noArgs(player); } Command cmd = MainCommand.getInstance().getCommand("set" + args[0]); if (cmd != null) { - cmd.execute(plr, Arrays.copyOfRange(args, 1, args.length), null, null); + cmd.execute(player, Arrays.copyOfRange(args, 1, args.length), null, null); return true; } // Additional checks - Plot plot = plr.getCurrentPlot(); + Plot plot = player.getCurrentPlot(); if (plot == null) { - MainUtil.sendMessage(plr, C.NOT_IN_PLOT); + MainUtil.sendMessage(player, C.NOT_IN_PLOT); return false; } // components HashSet components = new HashSet<>(Arrays.asList(plot.getManager().getPlotComponents(plot.getArea(), plot.getId()))); if (components.contains(args[0].toLowerCase())) { - return this.component.onCommand(plr, Arrays.copyOfRange(args, 0, args.length)); + return this.component.onCommand(player, Arrays.copyOfRange(args, 0, args.length)); } // flag Flag flag = FlagManager.getFlag(args[0].toLowerCase()); @@ -169,9 +169,9 @@ public class Set extends SubCommand { a.append(" ").append(args[x]); } } - MainCommand.onCommand(plr, ("flag set " + args[0] + a.toString()).split(" ")); + MainCommand.onCommand(player, ("flag set " + args[0] + a.toString()).split(" ")); return true; } - return noArgs(plr); + return noArgs(player); } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/SetCommand.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/SetCommand.java index bd78883fa..601a16ce9 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/SetCommand.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/SetCommand.java @@ -11,32 +11,32 @@ import com.intellectualcrafters.plot.util.StringMan; public abstract class SetCommand extends SubCommand { @Override - public boolean onCommand(PlotPlayer plr, String[] args) { - Location loc = plr.getLocation(); + public boolean onCommand(PlotPlayer player, String[] args) { + Location loc = player.getLocation(); Plot plot = loc.getPlotAbs(); if (plot == null) { - return !sendMessage(plr, C.NOT_IN_PLOT); + return !sendMessage(player, C.NOT_IN_PLOT); } if (!plot.hasOwner()) { - if (!Permissions.hasPermission(plr, "plots.admin.command." + getFullId())) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command." + getFullId()); - MainUtil.sendMessage(plr, C.PLOT_NOT_CLAIMED); + if (!Permissions.hasPermission(player, "plots.admin.command." + getFullId())) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.admin.command." + getFullId()); + MainUtil.sendMessage(player, C.PLOT_NOT_CLAIMED); return false; } } - if (!plot.isOwner(plr.getUUID())) { - if (!Permissions.hasPermission(plr, "plots.admin.command." + getFullId())) { - MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command." + getFullId()); - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot.isOwner(player.getUUID())) { + if (!Permissions.hasPermission(player, "plots.admin.command." + getFullId())) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.admin.command." + getFullId()); + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } } if (args.length == 0) { - return set(plr, plot, ""); + return set(player, plot, ""); } - return set(plr, plot, StringMan.join(args, " ")); + return set(player, plot, StringMan.join(args, " ")); } - public abstract boolean set(PlotPlayer plr, Plot plot, String value); + public abstract boolean set(PlotPlayer player, Plot plot, String value); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java index 42402de01..5ae2647c3 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java @@ -19,24 +19,24 @@ import com.plotsquared.general.commands.CommandDeclaration; public class SetHome extends SetCommand { @Override - public boolean set(PlotPlayer plr, Plot plot, String value) { + public boolean set(PlotPlayer player, Plot plot, String value) { switch (value.toLowerCase()) { case "unset": case "remove": case "none": { Plot base = plot.getBasePlot(false); base.setHome(null); - return MainUtil.sendMessage(plr, C.POSITION_UNSET); + return MainUtil.sendMessage(player, C.POSITION_UNSET); } case "": Plot base = plot.getBasePlot(false); Location bot = base.getBottomAbs(); - Location loc = plr.getLocationFull(); + Location loc = player.getLocationFull(); BlockLoc rel = new BlockLoc(loc.getX() - bot.getX(), loc.getY(), loc.getZ() - bot.getZ(), loc.getYaw(), loc.getPitch()); base.setHome(rel); - return MainUtil.sendMessage(plr, C.POSITION_SET); + return MainUtil.sendMessage(player, C.POSITION_SET); default: - MainUtil.sendMessage(plr, C.HOME_ARGUMENT); + MainUtil.sendMessage(player, C.HOME_ARGUMENT); return false; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Setup.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Setup.java index b46793554..15ca30473 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Setup.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Setup.java @@ -28,7 +28,7 @@ import java.util.Map.Entry; category = CommandCategory.ADMINISTRATION) public class Setup extends SubCommand { - public void displayGenerators(PlotPlayer plr) { + public void displayGenerators(PlotPlayer player) { StringBuilder message = new StringBuilder(); message.append("&6What generator do you want?"); for (Entry> entry : SetupUtils.generators.entrySet()) { @@ -40,32 +40,32 @@ public class Setup extends SubCommand { message.append("\n&8 - &7").append(entry.getKey()).append(" (Unknown structure)"); } } - MainUtil.sendMessage(plr, message.toString()); + MainUtil.sendMessage(player, message.toString()); } @Override - public boolean onCommand(PlotPlayer plr, String[] args) { + public boolean onCommand(PlotPlayer player, String[] args) { // going through setup - SetupObject object = plr.getMeta("setup"); + SetupObject object = player.getMeta("setup"); if (object == null) { object = new SetupObject(); - plr.setMeta("setup", object); + player.setMeta("setup", object); SetupUtils.manager.updateGenerators(); - sendMessage(plr, C.SETUP_INIT); - displayGenerators(plr); + sendMessage(player, C.SETUP_INIT); + displayGenerators(player); return false; } if (args.length == 1) { if (args[0].equalsIgnoreCase("cancel")) { - plr.deleteMeta("setup"); - MainUtil.sendMessage(plr, "&aCancelled setup"); + player.deleteMeta("setup"); + MainUtil.sendMessage(player, "&aCancelled setup"); return false; } if (args[0].equalsIgnoreCase("back")) { if (object.setup_index > 0) { object.setup_index--; ConfigurationNode node = object.step[object.setup_index]; - sendMessage(plr, C.SETUP_STEP, object.setup_index + 1, node.getDescription(), node.getType().getType(), + sendMessage(player, C.SETUP_STEP, object.setup_index + 1, node.getDescription(), node.getType().getType(), String.valueOf(node.getDefaultValue())); return false; } else if (object.current > 0) { @@ -78,15 +78,15 @@ public class Setup extends SubCommand { case 0: // choose generator if (args.length != 1 || !SetupUtils.generators.containsKey(args[0])) { String prefix = "\n&8 - &7"; - MainUtil.sendMessage(plr, "&cYou must choose a generator!" + prefix + StringMan.join(SetupUtils.generators.keySet(), prefix) + MainUtil.sendMessage(player, "&cYou must choose a generator!" + prefix + StringMan.join(SetupUtils.generators.keySet(), prefix) .replaceAll("PlotSquared", "&2PlotSquared")); - sendMessage(plr, C.SETUP_INIT); + sendMessage(player, C.SETUP_INIT); return false; } object.setupGenerator = args[0]; object.current++; String partial = "\n&8 - &7PARTIAL&8 - &7Vanilla with clusters of plots"; - MainUtil.sendMessage(plr, "&6What world type do you want?\n&8 - &2DEFAULT&8 - &7Standard plot generation" + MainUtil.sendMessage(player, "&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 @@ -100,13 +100,13 @@ public class Setup extends SubCommand { types.add("augmented"); types.add("partial"); if (args.length != 1 || !types.contains(args[0].toLowerCase())) { - MainUtil.sendMessage(plr, "&cYou must choose a world type!"); + MainUtil.sendMessage(player, "&cYou must choose a world type!"); for (String type : types) { int i = allTypes.indexOf(type); if (type.equals("default")) { - MainUtil.sendMessage(plr, "&8 - &2" + type + " &8-&7 " + allDesc.get(i)); + MainUtil.sendMessage(player, "&8 - &2" + type + " &8-&7 " + allDesc.get(i)); } else { - MainUtil.sendMessage(plr, "&8 - &7" + type + " &8-&7 " + allDesc.get(i)); + MainUtil.sendMessage(player, "&8 - &7" + type + " &8-&7 " + allDesc.get(i)); } } return false; @@ -122,12 +122,12 @@ public class Setup extends SubCommand { SetupUtils.generators.get(object.plotManager).getPlotGenerator().processSetup(object); } if (object.step.length == 0) { - MainUtil.sendMessage(plr, "&6What do you want your world to be called?"); + MainUtil.sendMessage(player, "&6What do you want your world to be called?"); object.setup_index = 0; return true; } ConfigurationNode step = object.step[object.setup_index]; - sendMessage(plr, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(), + sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(), String.valueOf(step.getDefaultValue())); } else { if (gen.isFull()) { @@ -138,16 +138,16 @@ public class Setup extends SubCommand { SetupUtils.generators.get(object.plotManager).getPlotGenerator().processSetup(object); } else { object.plotManager = "PlotSquared"; - MainUtil.sendMessage(plr, "&c[WARNING] The specified generator does not identify as BukkitPlotGenerator"); - MainUtil.sendMessage(plr, "&7 - You may need to manually configure the other plugin"); + MainUtil.sendMessage(player, "&c[WARNING] The specified generator does not identify as BukkitPlotGenerator"); + MainUtil.sendMessage(player, "&7 - You may need to manually configure the other plugin"); object.step = SetupUtils.generators.get(object.plotManager).getPlotGenerator() .getNewPlotArea("CheckingPlotSquaredGenerator", null, null, null).getSettingNodes(); } if (object.type == 2) { - MainUtil.sendMessage(plr, "What would you like this area called?"); + MainUtil.sendMessage(player, "What would you like this area called?"); object.current++; } else { - MainUtil.sendMessage(plr, "&6What terrain would you like in plots?" + MainUtil.sendMessage(player, "&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 - &7ROAD&8 - &7Terrain separated by roads" @@ -158,42 +158,42 @@ public class Setup extends SubCommand { break; case 2: // area id if (!StringMan.isAlphanumericUnd(args[0])) { - MainUtil.sendMessage(plr, "&cThe area id must be alphanumerical!"); + MainUtil.sendMessage(player, "&cThe area id must be alphanumerical!"); return false; } for (PlotArea area : PS.get().getPlotAreas()) { if (area.id != null && area.id.equalsIgnoreCase(args[0])) { - MainUtil.sendMessage(plr, "&cYou must choose an area id that is not in use!"); + MainUtil.sendMessage(player, "&cYou must choose an area id that is not in use!"); return false; } } object.id = args[0]; object.current++; - MainUtil.sendMessage(plr, "&6What should be the minimum Plot Id?"); + MainUtil.sendMessage(player, "&6What should be the minimum Plot Id?"); break; case 3: // min object.min = PlotId.fromString(args[0]); if (object.min == null) { - MainUtil.sendMessage(plr, "&cYou must choose a valid minimum PlotId!"); + MainUtil.sendMessage(player, "&cYou must choose a valid minimum PlotId!"); return false; } object.current++; - MainUtil.sendMessage(plr, "&6What should be the maximum Plot Id?"); + MainUtil.sendMessage(player, "&6What should be the maximum Plot Id?"); break; case 4: // max PlotId id = PlotId.fromString(args[0]); if (id == null) { - MainUtil.sendMessage(plr, "&cYou must choose a valid maximum PlotId!"); + MainUtil.sendMessage(player, "&cYou must choose a valid maximum PlotId!"); return false; } if (id.x <= object.min.x || id.y <= object.min.y) { - MainUtil.sendMessage(plr, "&cThe max PlotId must be greater than the minimum!"); + MainUtil.sendMessage(player, "&cThe max PlotId must be greater than the minimum!"); return false; } object.max = id; object.current++; - MainUtil.sendMessage(plr, "&6What terrain would you like in plots?" + MainUtil.sendMessage(player, "&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 - &7ROAD&8 - &7Terrain separated by roads" @@ -202,7 +202,7 @@ public class Setup extends SubCommand { case 5: { // Choose terrain List terrain = Arrays.asList("none", "ore", "road", "all"); if (args.length != 1 || !terrain.contains(args[0].toLowerCase())) { - MainUtil.sendMessage(plr, "&cYou must choose the terrain!" + MainUtil.sendMessage(player, "&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 - &7ROAD&8 - &7Terrain separated by roads" @@ -216,58 +216,58 @@ public class Setup extends SubCommand { .getNewPlotArea("CheckingPlotSquaredGenerator", null, null, null).getSettingNodes(); } ConfigurationNode step = object.step[object.setup_index]; - sendMessage(plr, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(), + sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(), String.valueOf(step.getDefaultValue())); break; } case 6: // world setup if (object.setup_index == object.step.length) { - MainUtil.sendMessage(plr, "&6What do you want your world to be called?"); + MainUtil.sendMessage(player, "&6What do you want your world to be called?"); object.setup_index = 0; object.current++; return true; } ConfigurationNode step = object.step[object.setup_index]; if (args.length < 1) { - sendMessage(plr, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(), + sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(), String.valueOf(step.getDefaultValue())); return false; } boolean valid = step.isValid(args[0]); if (valid) { - sendMessage(plr, C.SETUP_VALID_ARG, step.getConstant(), args[0]); + sendMessage(player, C.SETUP_VALID_ARG, step.getConstant(), args[0]); step.setValue(args[0]); object.setup_index++; if (object.setup_index == object.step.length) { - onCommand(plr, args); + onCommand(player, args); return false; } step = object.step[object.setup_index]; - sendMessage(plr, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(), + sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(), String.valueOf(step.getDefaultValue())); return false; } else { - sendMessage(plr, C.SETUP_INVALID_ARG, args[0], step.getConstant()); - sendMessage(plr, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(), + sendMessage(player, C.SETUP_INVALID_ARG, args[0], step.getConstant()); + sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(), String.valueOf(step.getDefaultValue())); return false; } case 7: if (args.length != 1) { - MainUtil.sendMessage(plr, "&cYou need to choose a world name!"); + MainUtil.sendMessage(player, "&cYou need to choose a world name!"); return false; } if (WorldUtil.IMP.isWorld(args[0])) { if (PS.get().hasPlotArea(args[0])) { - MainUtil.sendMessage(plr, "&cThat world name is already taken!"); + MainUtil.sendMessage(player, "&cThat world name is already taken!"); return false; } - MainUtil.sendMessage(plr, + MainUtil.sendMessage(player, "&cThe world you specified already exists. After restarting, new terrain will use PlotSquared, however you may need to " + "reset the world for it to generate correctly!"); } object.world = args[0]; - plr.deleteMeta("setup"); + player.deleteMeta("setup"); String world; if (object.setupManager == null) { world = SetupUtils.manager.setupWorld(object); @@ -275,12 +275,12 @@ public class Setup extends SubCommand { world = object.setupManager.setupWorld(object); } try { - plr.teleport(WorldUtil.IMP.getSpawn(world)); + player.teleport(WorldUtil.IMP.getSpawn(world)); } catch (Exception e) { - plr.sendMessage("&cAn error occurred. See console for more information"); + player.sendMessage("&cAn error occurred. See console for more information"); e.printStackTrace(); } - sendMessage(plr, C.SETUP_FINISHED, object.world); + sendMessage(player, C.SETUP_FINISHED, object.world); } return false; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java index aa7222719..b53869965 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java @@ -28,7 +28,7 @@ public abstract class SubCommand extends Command { } - public abstract boolean onCommand(PlotPlayer plr, String[] args); + public abstract boolean onCommand(PlotPlayer player, String[] args); public boolean sendMessage(PlotPlayer player, C message, Object... args) { message.send(player, args); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Swap.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Swap.java index d68f58399..d1871f6b3 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Swap.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Swap.java @@ -17,42 +17,42 @@ import com.plotsquared.general.commands.CommandDeclaration; public class Swap extends SubCommand { @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { - Location loc = plr.getLocation(); + public boolean onCommand(final PlotPlayer player, String[] args) { + Location loc = player.getLocation(); Plot plot1 = loc.getPlotAbs(); if (plot1 == null) { - return !MainUtil.sendMessage(plr, C.NOT_IN_PLOT); + return !MainUtil.sendMessage(player, C.NOT_IN_PLOT); } - if (!plot1.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, C.PERMISSION_ADMIN.s())) { - MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); + if (!plot1.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN.s())) { + MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return false; } if (args.length != 1) { - C.COMMAND_SYNTAX.send(plr, getUsage()); + C.COMMAND_SYNTAX.send(player, getUsage()); return false; } - Plot plot2 = MainUtil.getPlotFromString(plr, args[0], true); + Plot plot2 = MainUtil.getPlotFromString(player, args[0], true); if (plot2 == null) { return false; } if (plot1.equals(plot2)) { - MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID); - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy "); + MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot copy "); return false; } if (!plot1.getArea().isCompatible(plot2.getArea())) { - C.PLOTWORLD_INCOMPATIBLE.send(plr); + C.PLOTWORLD_INCOMPATIBLE.send(player); return false; } if (plot1.move(plot2, new Runnable() { @Override public void run() { - MainUtil.sendMessage(plr, C.SWAP_SUCCESS); + MainUtil.sendMessage(player, C.SWAP_SUCCESS); } }, true)) { return true; } else { - MainUtil.sendMessage(plr, C.SWAP_OVERLAP); + MainUtil.sendMessage(player, C.SWAP_OVERLAP); return false; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Target.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Target.java index ff4f73840..6cfae47cc 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Target.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Target.java @@ -24,31 +24,31 @@ public class Target extends SubCommand { } @Override - public boolean onCommand(PlotPlayer plr, String[] args) { - Location plrLocation = plr.getLocation(); - if (!plrLocation.isPlotArea()) { - MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD); + public boolean onCommand(PlotPlayer player, String[] args) { + Location location = player.getLocation(); + if (!location.isPlotArea()) { + MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD); return false; } Plot target = null; if (StringMan.isEqualIgnoreCaseToAny(args[0], "near", "nearest")) { int distance = Integer.MAX_VALUE; - for (Plot plot : PS.get().getPlots(plrLocation.getWorld())) { - double current = plot.getCenter().getEuclideanDistanceSquared(plrLocation); + for (Plot plot : PS.get().getPlots(location.getWorld())) { + double current = plot.getCenter().getEuclideanDistanceSquared(location); if (current < distance) { distance = (int) current; target = plot; } } if (target == null) { - MainUtil.sendMessage(plr, C.FOUND_NO_PLOTS); + MainUtil.sendMessage(player, C.FOUND_NO_PLOTS); return false; } - } else if ((target = MainUtil.getPlotFromString(plr, args[0], true)) == null) { + } else if ((target = MainUtil.getPlotFromString(player, args[0], true)) == null) { return false; } - plr.setCompassTarget(target.getCenter()); - MainUtil.sendMessage(plr, C.COMPASS_TARGET); + player.setCompassTarget(target.getCenter()); + MainUtil.sendMessage(player, C.COMPASS_TARGET); return true; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Template.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Template.java index 6380df7f1..946c4c9cd 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Template.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Template.java @@ -74,10 +74,10 @@ public class Template extends SubCommand { } } - public static byte[] getBytes(PlotArea plotworld) { - ConfigurationSection section = PS.get().config.getConfigurationSection("worlds." + plotworld.worldname); + public static byte[] getBytes(PlotArea plotArea) { + ConfigurationSection section = PS.get().config.getConfigurationSection("worlds." + plotArea.worldname); YamlConfiguration config = new YamlConfiguration(); - String generator = SetupUtils.manager.getGenerator(plotworld); + String generator = SetupUtils.manager.getGenerator(plotArea); if (generator != null) { config.set("generator.plugin", generator); } @@ -103,34 +103,34 @@ public class Template extends SubCommand { } @Override - public boolean onCommand(final PlotPlayer plr, String[] args) { + public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length != 2 && args.length != 3) { if (args.length == 1) { if (args[0].equalsIgnoreCase("export")) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template export "); + MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot template export "); return true; } else if (args[0].equalsIgnoreCase("import")) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template import