From f45d1f4c0b98e77231d56d36fc358ff876eb5d5c Mon Sep 17 00:00:00 2001 From: boy0001 Date: Mon, 23 Mar 2015 00:48:02 +1100 Subject: [PATCH] Allow swapping of region --- .../com/intellectualcrafters/plot/util/ChunkManager.java | 2 ++ .../plot/util/bukkit/BukkitChunkManager.java | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java index 3cffaf91f..8a36782c4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java @@ -41,4 +41,6 @@ public abstract class ChunkManager { public abstract void clearAllEntities(final Plot plot); public abstract void swap(String world, PlotId id, PlotId plotid); + + public abstract void swap(String worldname, Location bot1, Location top1, Location bot2, Location top2); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java index 6defeac07..3c030d7aa 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java @@ -848,7 +848,14 @@ public class BukkitChunkManager extends ChunkManager { Location bot2 = MainUtil.getPlotBottomLoc(worldname, pos2).add(1, 0, 1); Location top2 = MainUtil.getPlotTopLoc(worldname, pos2); + swap(worldname, bot1, top1, bot2, top2); + clearAllEntities(MainUtil.getPlot(worldname, pos1)); + clearAllEntities(MainUtil.getPlot(worldname, pos2)); + } + + @Override + public void swap(final String worldname, final Location bot1, final Location top1, Location bot2, Location top2) { final RegionWrapper region1 = new RegionWrapper(bot1.getX(), top1.getX(), bot1.getZ(), top1.getZ()); final RegionWrapper region2 = new RegionWrapper(bot2.getX(), top2.getX(), bot2.getZ(), top2.getZ()); final World world = Bukkit.getWorld(bot1.getWorld()); @@ -863,8 +870,6 @@ public class BukkitChunkManager extends ChunkManager { swapChunk(world, chunk1, chunk2, region1, region2); } } - clearAllEntities(MainUtil.getPlot(worldname, pos1)); - clearAllEntities(MainUtil.getPlot(worldname, pos2)); // FIXME swap plots }