From 33256e0ea4be49314329376454a7b939eb08bec1 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Wed, 1 Apr 2015 22:14:00 +1100 Subject: [PATCH] Fix move command --- .../com/intellectualcrafters/plot/commands/Command.java | 1 + .../java/com/intellectualcrafters/plot/commands/Move.java | 6 +++++- .../java/com/intellectualcrafters/plot/util/MainUtil.java | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java index 4e861414c..c2a120566 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java @@ -34,6 +34,7 @@ public enum Command { // (Rating system) (ratings can be stored as the average, and number of // ratings) // - /plot rate + MOVE("move", ""), FLAG("flag", "f"), TARGET("target"), CLUSTER("cluster", "clusters"), diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java index 8630cacd0..29e20489f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java @@ -21,6 +21,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.PlotSquared; +import com.intellectualcrafters.plot.commands.SubCommand.CommandCategory; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; @@ -37,7 +38,7 @@ import com.intellectualcrafters.plot.util.Permissions; */ public class Move extends SubCommand { public Move() { - super("debugmove", "plots.move", "Move a plot", "move", "", CommandCategory.ACTIONS, true); + super(Command.MOVE, "Move a plot", "debugmove", CommandCategory.ACTIONS, true); } @Override @@ -77,6 +78,9 @@ public class Move extends SubCommand { world2 = world; } Plot plot2 = MainUtil.getPlot(world2, plot2id); + + System.out.print(plot1 + " | " + plot2); + if (plot1.equals(plot2)) { MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot move "); 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 90faf6f75..fe1bb8fbd 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -859,7 +859,7 @@ public class MainUtil { public static boolean move(final Plot plot1, final Plot plot2, final Runnable whenDone) { final com.intellectualcrafters.plot.object.Location bot1 = MainUtil.getPlotBottomLoc(plot1.world, plot1.id); - final com.intellectualcrafters.plot.object.Location bot2 = MainUtil.getPlotBottomLoc(plot1.world, plot1.id); + final com.intellectualcrafters.plot.object.Location bot2 = MainUtil.getPlotBottomLoc(plot2.world, plot1.id); final Location top = MainUtil.getPlotTopLoc(plot1.world, plot1.id); if (plot1.owner == null) { TaskManager.runTaskLater(whenDone, 1); @@ -883,6 +883,9 @@ public class MainUtil { plot.id.y += offset_y; PlotSquared.getPlots(plot2.world).put(plot.id, plot); } + System.out.print("BOT: " + bot1); + System.out.print("TOP: " + top); + System.out.print(" -> " + bot2); ChunkManager.manager.copyRegion(bot1, top, bot2, new Runnable() { @Override public void run() {