Don't save air blocks
This commit is contained in:
parent
f08280776e
commit
ef7ccb3d0a
1 changed files with 4 additions and 3 deletions
|
@ -31,7 +31,7 @@ public class PluginMain extends JavaPlugin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final int[] xyz = new int[6];
|
final int[] xyz = new int[6];
|
||||||
for (int i = 0; i < args.length; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
xyz[i] = Integer.parseInt(args[i]);
|
xyz[i] = Integer.parseInt(args[i]);
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (xyz[i] >= xyz[i + 3]) {
|
if (xyz[i] >= xyz[i + 3]) {
|
||||||
|
@ -45,10 +45,11 @@ public class PluginMain extends JavaPlugin {
|
||||||
for (int y = xyz[1]; y <= xyz[4]; y++) {
|
for (int y = xyz[1]; y <= xyz[4]; y++) {
|
||||||
for (int x = xyz[0]; x <= xyz[3]; x++) {
|
for (int x = xyz[0]; x <= xyz[3]; x++) {
|
||||||
for (int z = xyz[2]; z <= xyz[5]; z++) {
|
for (int z = xyz[2]; z <= xyz[5]; z++) {
|
||||||
|
Block block = world.getBlockAt(x, y, z);
|
||||||
|
if(block.getType().name().equals("AIR")) continue;
|
||||||
Blocks blocks = new Blocks();
|
Blocks blocks = new Blocks();
|
||||||
blocks.setStart(new Location(null, x, y, z));
|
blocks.setStart(new Location(null, x, y, z));
|
||||||
blocks.setEnd(blocks.getStart());
|
blocks.setEnd(blocks.getStart());
|
||||||
Block block = world.getBlockAt(x, y, z);
|
|
||||||
blocks.setMaterial(block.getType().name());
|
blocks.setMaterial(block.getType().name());
|
||||||
list.add(blocks);
|
list.add(blocks);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +66,7 @@ public class PluginMain extends JavaPlugin {
|
||||||
}
|
}
|
||||||
}).create();
|
}).create();
|
||||||
try {
|
try {
|
||||||
Files.write(gson.toJson(list), new File("result.txt"), StandardCharsets.UTF_8);
|
Files.write(gson.toJson(list), new File("result.json"), StandardCharsets.UTF_8);
|
||||||
sender.sendMessage("§bSuccess!");
|
sender.sendMessage("§bSuccess!");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in a new issue