mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-02 14:38:19 +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.params = params;
|
||||||
this.dest = dest;
|
this.dest = dest;
|
||||||
this.npc = npc;
|
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(
|
plan = (Path) ASTAR.runFully(new VectorGoal(dest), new VectorNode(location, new ChunkBlockSource(
|
||||||
location, params.range()), params.examiners()), 10000);
|
location, params.range()), params.examiners()), 10000);
|
||||||
if (plan == null || plan.isComplete())
|
if (plan == null || plan.isComplete())
|
||||||
@ -49,7 +49,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
|
|||||||
public boolean update() {
|
public boolean update() {
|
||||||
if (getCancelReason() != null)
|
if (getCancelReason() != null)
|
||||||
return true;
|
return true;
|
||||||
if (plan.isComplete())
|
if (plan == null || plan.isComplete())
|
||||||
return true;
|
return true;
|
||||||
if (NMS.distanceSquared(npc.getHandle(), vector) <= params.distanceMargin()) {
|
if (NMS.distanceSquared(npc.getHandle(), vector) <= params.distanceMargin()) {
|
||||||
plan.update(npc);
|
plan.update(npc);
|
||||||
|
Loading…
Reference in New Issue
Block a user