mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-28 20:17:50 +01:00
Cancel navigation on despawn: Navigation isn't carried over so CitizensNavigator would be left in an inconsistent state
This commit is contained in:
parent
5f093276f1
commit
aa022f8fae
@ -103,8 +103,11 @@ public class CitizensNavigator implements Navigator, Runnable {
|
||||
public void run() {
|
||||
if (!isNavigating())
|
||||
return;
|
||||
if (!npc.isSpawned())
|
||||
if (!npc.isSpawned()) {
|
||||
if (isNavigating())
|
||||
stopNavigating(CancelReason.NPC_DESPAWNED);
|
||||
return;
|
||||
}
|
||||
if (updateStationaryStatus())
|
||||
return;
|
||||
updatePathfindingRange();
|
||||
|
@ -44,7 +44,7 @@ public class WanderWaypointProvider implements WaypointProvider {
|
||||
@Override
|
||||
public void onSpawn(NPC npc) {
|
||||
if (currentGoal == null) {
|
||||
currentGoal = WanderGoal.createWithNPC(npc);
|
||||
currentGoal = WanderGoal.createWithNPCAndRange(npc, xrange, yrange);
|
||||
CitizensAPI.registerEvents(currentGoal);
|
||||
}
|
||||
npc.getDefaultGoalController().addGoal(currentGoal, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user