mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-30 21:17:45 +01:00
Nullcheck
This commit is contained in:
parent
6f8c4a7e58
commit
b72711e9ac
@ -26,7 +26,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
|
||||
this.params = params;
|
||||
this.dest = dest;
|
||||
this.npc = npc;
|
||||
Location location = npc.getBukkitEntity().getLocation();
|
||||
Location location = npc.getBukkitEntity().getEyeLocation();
|
||||
plan = (Path) ASTAR.runFully(new VectorGoal(dest), new VectorNode(location, new ChunkBlockSource(
|
||||
location, params.range()), params.examiners()), 10000);
|
||||
if (plan == null || plan.isComplete())
|
||||
@ -49,7 +49,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
|
||||
public boolean update() {
|
||||
if (getCancelReason() != null)
|
||||
return true;
|
||||
if (plan.isComplete())
|
||||
if (plan == null || plan.isComplete())
|
||||
return true;
|
||||
if (NMS.distanceSquared(npc.getHandle(), vector) <= params.distanceMargin()) {
|
||||
plan.update(npc);
|
||||
|
Loading…
Reference in New Issue
Block a user