Export negative coord blocks with BO3 if not part of normal plot component

This commit is contained in:
boy0001 2015-09-03 15:57:12 +10:00
parent 574ca7a180
commit dfc32741fa

View File

@ -32,6 +32,15 @@ public class BO3Handler {
return saveBO3(null, plot); 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<br> * Save a plot as a BO3 file<br>
* - Use null for the player object if no player is applicable * - Use null for the player object if no player is applicable
@ -65,6 +74,26 @@ public class BO3Handler {
int zz = (z - cz) % 16; int zz = (z - cz) % 16;
ChunkLoc loc = new ChunkLoc(X, Z); ChunkLoc loc = new ChunkLoc(X, Z);
BO3 bo3 = map.get(loc); 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++) { for (int y = height + 1; y < 256; y++) {
PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z)); PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z));
if (block != null && block.id != 0) { if (block != null && block.id != 0) {