mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-27 05:05:18 +01:00
Prevent NPE
This commit is contained in:
parent
8852b9d660
commit
907c6b3534
@ -139,7 +139,7 @@ public class BlueprintClipboard {
|
|||||||
Math.rint(e.getLocation().getY()),
|
Math.rint(e.getLocation().getY()),
|
||||||
Math.rint(e.getLocation().getZ())).equals(v))
|
Math.rint(e.getLocation().getZ())).equals(v))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (copyBlock(v.toLocation(world), origin, copyAir, ents)) {
|
if (copyBlock(v.toLocation(world), copyAir, ents)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -179,12 +179,13 @@ public class BlueprintClipboard {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean copyBlock(Location l, @Nullable Vector origin2, boolean copyAir, Collection<LivingEntity> entities) {
|
private boolean copyBlock(Location l, boolean copyAir, Collection<LivingEntity> entities) {
|
||||||
Block block = l.getBlock();
|
Block block = l.getBlock();
|
||||||
if (!copyAir && block.getType().equals(Material.AIR) && entities.isEmpty()) {
|
if (!copyAir && block.getType().equals(Material.AIR) && entities.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Create position
|
// Create position
|
||||||
|
Vector origin2 = origin == null ? new Vector(0,0,0) : origin;
|
||||||
int x = l.getBlockX() - origin2.getBlockX();
|
int x = l.getBlockX() - origin2.getBlockX();
|
||||||
int y = l.getBlockY() - origin2.getBlockY();
|
int y = l.getBlockY() - origin2.getBlockY();
|
||||||
int z = l.getBlockZ() - origin2.getBlockZ();
|
int z = l.getBlockZ() - origin2.getBlockZ();
|
||||||
|
Loading…
Reference in New Issue
Block a user