mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-25 18:47:40 +01:00
Also make guided waypoints reset when chagned
This commit is contained in:
parent
b56a1f85e1
commit
65c7e7c28c
@ -243,6 +243,9 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
|
||||
tree.put(new long[] { waypoint.getLocation().getBlockX(), waypoint.getLocation().getBlockY(),
|
||||
waypoint.getLocation().getBlockZ() }, waypoint);
|
||||
}
|
||||
if (currentGoal != null) {
|
||||
currentGoal.onProviderChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -262,6 +265,9 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
|
||||
@Override
|
||||
public void setPaused(boolean paused) {
|
||||
this.paused = paused;
|
||||
if (currentGoal != null) {
|
||||
currentGoal.onProviderChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -275,6 +281,15 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
|
||||
private class GuidedAIGoal implements Goal {
|
||||
private GuidedPlan plan;
|
||||
|
||||
public void onProviderChanged() {
|
||||
if (plan != null) {
|
||||
reset();
|
||||
if (npc.getNavigator().isNavigating()) {
|
||||
npc.getNavigator().cancelNavigation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
plan = null;
|
||||
|
Loading…
Reference in New Issue
Block a user