Fix null check for pos1 and pos2

This commit is contained in:
tastybento 2019-05-18 16:02:12 -07:00
parent 7ea0edea91
commit 259cb19cf3

View File

@ -314,12 +314,14 @@ public class BlueprintClipboard {
*/ */
public void setPos1(@Nullable Location pos1) { public void setPos1(@Nullable Location pos1) {
origin = null; origin = null;
if (pos1 != null) {
if (pos1.getBlockY() < 0) { if (pos1.getBlockY() < 0) {
pos1.setY(0); pos1.setY(0);
} }
if (pos1.getBlockY() > 255) { if (pos1.getBlockY() > 255) {
pos1.setY(255); pos1.setY(255);
} }
}
this.pos1 = pos1; this.pos1 = pos1;
} }
@ -328,12 +330,14 @@ public class BlueprintClipboard {
*/ */
public void setPos2(@Nullable Location pos2) { public void setPos2(@Nullable Location pos2) {
origin = null; origin = null;
if (pos2 != null) {
if (pos2.getBlockY() < 0) { if (pos2.getBlockY() < 0) {
pos2.setY(0); pos2.setY(0);
} }
if (pos2.getBlockY() > 255) { if (pos2.getBlockY() > 255) {
pos2.setY(255); pos2.setY(255);
} }
}
this.pos2 = pos2; this.pos2 = pos2;
} }