From f39d31836d08ec31eee5ed54c3b349046795bdf7 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Thu, 23 Oct 2014 21:39:55 +1100 Subject: [PATCH] states don't work :/ --- .../plot/PlotSelection.java | 57 +------------------ .../plot/commands/Swap.java | 10 ++++ 2 files changed, 13 insertions(+), 54 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotSelection.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotSelection.java index 757ae864f..92e377dc1 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotSelection.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotSelection.java @@ -107,49 +107,9 @@ public class PlotSelection { Location bot2 = PlotHelper.getPlotBottomLocAbs(world, id2).add(1, 0, 1); Location top2 = PlotHelper.getPlotTopLocAbs(world, id2); - ArrayList states2 = new ArrayList(); - - for (int i = (bot2.getBlockX() / 16) * 16; i < (16 + ((top2.getBlockX() / 16) * 16)); i += 16) { - for (int j = (bot2.getBlockZ() / 16) * 16; j < (16 + ((top2.getBlockZ() / 16) * 16)); j += 16) { - Chunk chunk = world.getChunkAt(i, j); - - boolean result = chunk.load(false); - if (!result) { - return false; - } - - for (BlockState tile :chunk.getTileEntities()) { - PlotId id = PlayerFunctions.getPlot(tile.getLocation()); - if ((id != null) && id.equals(id2)) { - states2.add(tile); - } - } - } - } - Location bot1 = PlotHelper.getPlotBottomLocAbs(world, id1).add(1, 0, 1); Location top1 = PlotHelper.getPlotTopLocAbs(world, id1); - ArrayList states1 = new ArrayList(); - - for (int i = (bot1.getBlockX() / 16) * 16; i < (16 + ((top1.getBlockX() / 16) * 16)); i += 16) { - for (int j = (bot1.getBlockZ() / 16) * 16; j < (16 + ((top1.getBlockZ() / 16) * 16)); j += 16) { - Chunk chunk = world.getChunkAt(i, j); - - boolean result = chunk.load(false); - if (!result) { - return false; - } - - for (BlockState tile :chunk.getTileEntities()) { - PlotId id = PlayerFunctions.getPlot(tile.getLocation()); - if ((id != null) && id.equals(id1)) { - states1.add(tile); - } - } - } - } - int minX = bot1.getBlockX(), maxX = top1.getBlockX(), @@ -161,9 +121,9 @@ public class PlotSelection { boolean canSetFast = PlotHelper.canSetFast; - for (int x = 0; x < maxX - minX; x++) { - for (int z = 0; z < maxZ - minZ; z++) { - for (int y = 1; y < world.getMaxHeight(); y++) { + for (int x = 0; x <= maxX - minX; x++) { + for (int z = 0; z <= maxZ - minZ; z++) { + for (int y = 1; y <= world.getMaxHeight(); y++) { final Block block1 = world.getBlockAt(x + minX, y, z + minZ); final Block block2 = world.getBlockAt(x + minX2, y, z + minZ2); @@ -199,17 +159,6 @@ public class PlotSelection { } } } - - for (BlockState state : states1) { - Location loc = new Location(world,state.getX() - minX + minX2, state.getY(), state.getZ() - minZ + minZ2); - world.getBlockAt(loc).getState().setRawData(state.getRawData()); - } - - for (BlockState state : states2) { - Location loc = new Location(world,state.getX() - minX2 + minX, state.getY(), state.getZ() - minZ2 + minZ); - world.getBlockAt(loc).getState().setRawData(state.getRawData()); - } - return true; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Swap.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Swap.java index 27494d6f5..59f563d9c 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Swap.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Swap.java @@ -59,8 +59,18 @@ public class Swap extends SubCommand { PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX); return false; } + if (plot.id.equals(plotid)) { + PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID); + PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX); + return false; + } PlotSelection.swap(world, plot.id, plotid); PlayerFunctions.sendMessage(plr, C.SWAP_SUCCESS); + + if (PlotHelper.canSetFast) { + SetBlockFast.update(plr); + } + return true; } }