mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-23 11:15:24 +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().getZ())).equals(v))
|
||||
.collect(Collectors.toList());
|
||||
if (copyBlock(v.toLocation(world), origin, copyAir, ents)) {
|
||||
if (copyBlock(v.toLocation(world), copyAir, ents)) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
@ -179,12 +179,13 @@ public class BlueprintClipboard {
|
||||
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();
|
||||
if (!copyAir && block.getType().equals(Material.AIR) && entities.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
// Create position
|
||||
Vector origin2 = origin == null ? new Vector(0,0,0) : origin;
|
||||
int x = l.getBlockX() - origin2.getBlockX();
|
||||
int y = l.getBlockY() - origin2.getBlockY();
|
||||
int z = l.getBlockZ() - origin2.getBlockZ();
|
||||
|
Loading…
Reference in New Issue
Block a user