mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Handle null case in equality checking BlockVector3+DFSNode
This commit is contained in:
parent
b7e9547cd5
commit
da9c4ad543
@ -59,7 +59,7 @@ public class SplineBrush implements Brush, ResettableTool {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int originalSize = numSplines;
|
int originalSize = numSplines;
|
||||||
boolean newPos = this.position == null || !position.equals(this.position);
|
boolean newPos = !position.equals(this.position);
|
||||||
this.position = position;
|
this.position = position;
|
||||||
if (newPos) {
|
if (newPos) {
|
||||||
if (positionSets.size() >= MAX_POINTS) {
|
if (positionSets.size() >= MAX_POINTS) {
|
||||||
|
@ -46,7 +46,7 @@ public class SweepBrush implements Brush, ResettableTool {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean newPos = this.position == null || !position.equals(this.position);
|
boolean newPos = !position.equals(this.position);
|
||||||
this.position = position;
|
this.position = position;
|
||||||
Player player = editSession.getPlayer();
|
Player player = editSession.getPlayer();
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
|
@ -104,7 +104,7 @@ public abstract class DFSVisitor implements Operation {
|
|||||||
from.getZ() + direction.getZ());
|
from.getZ() + direction.getZ());
|
||||||
if (isVisitable(bv, bv2)) {
|
if (isVisitable(bv, bv2)) {
|
||||||
Node adjacent = new Node(bv2.getBlockX(), bv2.getBlockY(), bv2.getBlockZ());
|
Node adjacent = new Node(bv2.getBlockX(), bv2.getBlockY(), bv2.getBlockZ());
|
||||||
if (current.from == null || !adjacent.equals(current.from)) {
|
if (!adjacent.equals(current.from)) {
|
||||||
AtomicInteger adjacentCount = visited.get(adjacent);
|
AtomicInteger adjacentCount = visited.get(adjacent);
|
||||||
if (adjacentCount == null) {
|
if (adjacentCount == null) {
|
||||||
if (countAdd++ < maxBranch) {
|
if (countAdd++ < maxBranch) {
|
||||||
@ -200,6 +200,10 @@ public abstract class DFSVisitor implements Operation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Node other = (Node) obj;
|
Node other = (Node) obj;
|
||||||
return other.x == x && other.z == z && other.y == y;
|
return other.x == x && other.z == z && other.y == y;
|
||||||
}
|
}
|
||||||
|
@ -775,6 +775,10 @@ public abstract class BlockVector3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final boolean equals(BlockVector3 other) {
|
public final boolean equals(BlockVector3 other) {
|
||||||
|
if (other == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return other.getX() == this.getX() && other.getY() == this.getY() && other.getZ() == this.getZ();
|
return other.getX() == this.getX() && other.getY() == this.getY() && other.getZ() == this.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
|||||||
public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
|
public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
|
||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
|
|
||||||
if (position1 != null && position.equals(position1)) {
|
if (position.equals(position1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
|||||||
public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) {
|
public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) {
|
||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
|
|
||||||
if (position2 != null && position.equals(position2)) {
|
if (position.equals(position2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class ExtendingCuboidRegionSelector extends CuboidRegionSelector {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
|
public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
|
||||||
if (position1 != null && position2 != null && position.equals(position1) && position.equals(position2)) {
|
if (position.equals(position1) && position.equals(position2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user