diff --git a/src/main/java/com/intellectualcrafters/plot/util/BO3Handler.java b/src/main/java/com/intellectualcrafters/plot/util/BO3Handler.java index cb39d437a..d9b7a904e 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/BO3Handler.java +++ b/src/main/java/com/intellectualcrafters/plot/util/BO3Handler.java @@ -32,6 +32,15 @@ public class BO3Handler { return saveBO3(null, plot); } + public static boolean contains(PlotBlock[] blocks, PlotBlock block) { + for (PlotBlock item : blocks) { + if (item.equals(block)) { + return true; + } + } + return false; + } + /** * Save a plot as a BO3 file
* - Use null for the player object if no player is applicable @@ -65,6 +74,26 @@ public class BO3Handler { int zz = (z - cz) % 16; ChunkLoc loc = new ChunkLoc(X, Z); BO3 bo3 = map.get(loc); + for (int y = 1; y < height; y++) { + PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z)); + if (block != null && !contains(cpw.MAIN_BLOCK, block)) { + if (bo3 == null) { + bo3 = new BO3(alias, loc); + map.put(loc, bo3); + content = true; + } + bo3.addBlock(xx, y - height - 1, zz, block); + } + } + PlotBlock floor = BlockManager.manager.getBlock(new Location(plot.world, x, height, z)); + if (floor != null && !contains(cpw.TOP_BLOCK, floor)) { + if (bo3 == null) { + bo3 = new BO3(alias, loc); + map.put(loc, bo3); + content = true; + } + bo3.addBlock(xx, -1, zz, floor); + } for (int y = height + 1; y < 256; y++) { PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z)); if (block != null && block.id != 0) {