diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java index e0bb598f2..218876b4c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java @@ -84,7 +84,7 @@ public class Buy extends SubCommand { double initPrice = (double) flag.getValue(); double price = initPrice; final PlotId id = plot.id; - final PlotId id2 = MainUtil.getTopPlot(world, plot).id; + final PlotId id2 = MainUtil.getTopPlot(plot).id; final int size = MainUtil.getPlotSelectionIds(id, id2).size(); final PlotWorld plotworld = PlotSquared.getPlotWorld(world); if (plotworld.USE_ECONOMY) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java index ad26f8197..2afd14432 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -67,7 +67,7 @@ public class Clear extends SubCommand { if (plot == null) { return sendMessage(plr, C.NOT_IN_PLOT); } - if (!MainUtil.getTopPlot(loc.getWorld(), plot).equals(MainUtil.getBottomPlot( plot))) { + if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot( plot))) { return sendMessage(plr, C.UNLINK_REQUIRED); } if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java index ec1acc4d5..387f53702 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java @@ -27,7 +27,6 @@ import com.google.common.collect.BiMap; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent; import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; @@ -39,7 +38,6 @@ import com.intellectualcrafters.plot.object.StringWrapper; import com.intellectualcrafters.plot.util.AChunkManager; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; /** @@ -50,12 +48,11 @@ public class DebugClaimTest extends SubCommand { super(Command.DEBUGCLAIMTEST, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. Execution time may vary", "debugclaimtest", CommandCategory.DEBUG, false); } - @SuppressWarnings("unused") public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport) { return claimPlot(player, plot, teleport, ""); } - public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, @SuppressWarnings("unused") final String schematic) { + public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, final String schematic) { // FIXME call claim event // boolean result = event result boolean result = true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java index 3f817236a..c142e72e8 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java @@ -20,17 +20,15 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; - import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.generator.SquarePlotWorld; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions; import com.intellectualcrafters.plot.util.bukkit.ChunkManager; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; @@ -55,19 +53,18 @@ public class DebugClear extends SubCommand { if (!PlotSquared.isPlotWorld(world) || !(PlotSquared.getPlotWorld(world) instanceof SquarePlotWorld)) { PlotSquared.log("Invalid plot world: " + world); } else { - final Plot plot = MainUtil.getPlot(Bukkit.getWorld(world), id); + final Plot plot = MainUtil.getPlot(world, id); if (plot == null) { PlotSquared.log("Could not find plot " + args[0] + " in world " + world); } else { - final World bukkitWorld = Bukkit.getWorld(world); - final Location pos1 = MainUtil.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1); - final Location pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id); + final Location pos1 = MainUtil.getPlotBottomLoc(world, plot.id).add(1, 0, 1); + final Location pos2 = MainUtil.getPlotTopLoc(world, plot.id); if (MainUtil.runners.containsKey(plot)) { MainUtil.sendMessage(null, C.WAIT_FOR_TIMER); return false; } MainUtil.runners.put(plot, 1); - ChunkManager.regenerateRegion(pos1, pos2, new Runnable() { + ChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() { @Override public void run() { MainUtil.runners.remove(plot); @@ -81,26 +78,26 @@ public class DebugClear extends SubCommand { } return true; } - if (!BukkitPlayerFunctions.isInPlot(plr) || !(PlotSquared.getPlotWorld(plr.getWorld()) instanceof SquarePlotWorld)) { + Location loc = plr.getLocation(); + final Plot plot = MainUtil.getPlot(loc); + if (plot == null || !(PlotSquared.getPlotWorld(loc.getWorld()) instanceof SquarePlotWorld)) { return sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = MainUtil.getPlot(loc); - if (!MainUtil.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) { + if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) { return sendMessage(plr, C.UNLINK_REQUIRED); } if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.debugclear")) { return sendMessage(plr, C.NO_PLOT_PERMS); } assert plot != null; - final World bukkitWorld = plr.getWorld(); - final Location pos1 = MainUtil.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1); - final Location pos2 = MainUtil.getPlotTopLoc(bukkitWorld, plot.id); + final Location pos1 = MainUtil.getPlotBottomLoc(loc.getWorld(), plot.id).add(1, 0, 1); + final Location pos2 = MainUtil.getPlotTopLoc(loc.getWorld(), plot.id); if (MainUtil.runners.containsKey(plot)) { MainUtil.sendMessage(null, C.WAIT_FOR_TIMER); return false; } MainUtil.runners.put(plot, 1); - ChunkManager.regenerateRegion(pos1, pos2, new Runnable() { + ChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() { @Override public void run() { MainUtil.runners.remove(plot); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 5743f110b..53414359c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -333,7 +333,7 @@ public class MainUtil { } count++; final PlotId bot = getBottomPlot(plot).id; - final PlotId top = getTopPlot(world, plot).id; + final PlotId top = getTopPlot(plot).id; plots = getPlotSelectionIds(new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y)); if (ownsPlots(world, plots, uuid, 0)) { final boolean result = mergePlots(world, plots, true); @@ -379,7 +379,7 @@ public class MainUtil { if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(uuid))) { return false; } - final PlotId top = getTopPlot(world, myplot).id; + final PlotId top = getTopPlot(myplot).id; if (((top.x > id_max.x) && (dir != 1)) || ((top.y > id_max.y) && (dir != 2))) { return false; } @@ -724,7 +724,7 @@ public class MainUtil { public static Location getPlotTopLoc(final String world, PlotId id) { final Plot plot = PlotSquared.getPlots(world).get(id); if (plot != null) { - id = getTopPlot(world, plot).id; + id = getTopPlot(plot).id; } final PlotWorld plotworld = PlotSquared.getPlotWorld(world); final PlotManager manager = PlotSquared.getPlotManager(world); @@ -773,7 +773,7 @@ public class MainUtil { return false; } final Plot pos1 = getBottomPlot(currentPlot); - final Plot pos2 = getTopPlot(world, currentPlot); + final Plot pos2 = getTopPlot(currentPlot); final PlotId size = MainUtil.getSize(world, currentPlot); if (!MainUtil.isUnowned(world, newPlot, new PlotId((newPlot.x + size.x) - 1, (newPlot.y + size.y) - 1))) { return false; @@ -967,12 +967,12 @@ public class MainUtil { return plot; } - public static Plot getTopPlot(final String world, final Plot plot) { + public static Plot getTopPlot(final Plot plot) { if (plot.settings.getMerged(2)) { - return getTopPlot(world, PlotSquared.getPlots(world).get(new PlotId(plot.id.x, plot.id.y + 1))); + return getTopPlot(PlotSquared.getPlots(plot.world).get(new PlotId(plot.id.x, plot.id.y + 1))); } if (plot.settings.getMerged(1)) { - return getTopPlot(world, PlotSquared.getPlots(world).get(new PlotId(plot.id.x + 1, plot.id.y))); + return getTopPlot(PlotSquared.getPlots(plot.world).get(new PlotId(plot.id.x + 1, plot.id.y))); } return plot; } @@ -982,7 +982,7 @@ public class MainUtil { if (!settings.isMerged()) { return new PlotId(1, 1); } - final Plot top = getTopPlot(world, plot); + final Plot top = getTopPlot(plot); final Plot bot = getBottomPlot(plot); return new PlotId((top.id.x - bot.id.x) + 1, (top.id.y - bot.id.y) + 1); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java index 67c08488c..8dde1d571 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java @@ -123,7 +123,7 @@ public class BukkitPlayerFunctions { pos1 = MainUtil.getBottomPlot(plot1).id; } if (plot2 != null) { - pos2 = MainUtil.getTopPlot(world, plot2).id; + pos2 = MainUtil.getTopPlot(plot2).id; } final ArrayList myplots = new ArrayList<>(); for (int x = pos1.x; x <= pos2.x; x++) {