mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Export negative coord blocks with BO3 if not part of normal plot component
This commit is contained in:
parent
574ca7a180
commit
dfc32741fa
@ -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<br>
|
||||
* - 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user