diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java index 0738c1cb7..019719ddd 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java @@ -45,7 +45,7 @@ import java.util.UUID; /** * @author Citymonstret */ -@SuppressWarnings({"unused", "deprecated", "javadoc"}) public class Info extends SubCommand { +@SuppressWarnings({"javadoc"}) public class Info extends SubCommand { public Info() { super(Command.INFO, "Display plot info", "info", CommandCategory.INFO, false); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index cad149393..b96d2bf3c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -109,25 +109,40 @@ public class Merge extends SubCommand { return false; } final World world = plr.getWorld(); - final PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id; - final PlotId top = PlayerFunctions.getTopPlot(world, plot).id; + PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id; + PlotId top = PlayerFunctions.getTopPlot(world, plot).id; ArrayList plots; switch (direction) { case 0: // north = -y - plots = PlayerFunctions.getMaxPlotSelectionIds(plr.getWorld(), new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y)); + plots = PlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y)); break; case 1: // east = +x - plots = PlayerFunctions.getMaxPlotSelectionIds(plr.getWorld(), new PlotId(bot.x, bot.y), new PlotId(top.x + 1, top.y)); + plots = PlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x + 1, top.y)); break; case 2: // south = +y - plots = PlayerFunctions.getMaxPlotSelectionIds(plr.getWorld(), new PlotId(bot.x, bot.y), new PlotId(top.x, top.y + 1)); + plots = PlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x, top.y + 1)); break; case 3: // west = -x - plots = PlayerFunctions.getMaxPlotSelectionIds(plr.getWorld(), new PlotId(bot.x - 1, bot.y), new PlotId(top.x, top.y)); + plots = PlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x - 1, bot.y), new PlotId(top.x, top.y)); break; default: return false; } + + PlotId botId = plots.get(0); + PlotId topId = plots.get(plots.size() - 1); + + PlotId bot1 = PlayerFunctions.getBottomPlot(world, PlotHelper.getPlot(world, botId)).id; + PlotId bot2 = PlayerFunctions.getBottomPlot(world, PlotHelper.getPlot(world, topId)).id; + + PlotId top1 = PlayerFunctions.getTopPlot(world, PlotHelper.getPlot(world, topId)).id; + PlotId top2 = PlayerFunctions.getTopPlot(world, PlotHelper.getPlot(world, botId)).id; + + bot = new PlotId(Math.min(bot1.x, bot2.x), Math.min(bot1.y, bot2.y)); + top = new PlotId(Math.min(top1.x, top2.x), Math.min(top1.y, top2.y)); + + plots = PlayerFunctions.getMaxPlotSelectionIds(world, bot, top); + for (final PlotId myid : plots) { final Plot myplot = PlotMain.getPlots(world).get(myid); if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(plr)) || admin)) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java index b790d5e54..7b494d4fa 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java @@ -53,11 +53,11 @@ import java.util.UUID; @Override public boolean execute(final Player plr, final String... args) { - if (!PlayerFunctions.isInPlot(plr)) { + Plot plot = PlayerFunctions.getCurrentPlot(plr); + if (plot == null || plot.owner == null) { PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); return true; } - final Plot plot = PlayerFunctions.getCurrentPlot(plr); if (args.length < 1) { PlayerFunctions.sendMessage(plr, C.NEED_USER); return true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java index a05bc5deb..736658186 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -74,7 +74,7 @@ public class Settings { /** * Max allowed plots */ - public static int MAX_PLOTS = 20; + public static int MAX_PLOTS = 127; /** * WorldGuard region on claimed plots */ diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlayerFunctions.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlayerFunctions.java index 43bee1b79..dbc602ee4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlayerFunctions.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlayerFunctions.java @@ -175,11 +175,8 @@ import java.util.*; if (id == null) { return null; } - final HashMap plots = PlotMain.getPlots(world); - if (plots != null) { - if (plots.containsKey(id)) { - return plots.get(id); - } + if (PlotMain.getPlots(world).containsKey(id)) { + return PlotMain.getPlots(world).get(id); } return new Plot(id, null, new ArrayList(), new ArrayList(), world.getName());