mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-24 11:38:26 +01:00
Change StuckAction implementation
This commit is contained in:
parent
3d9ae92a8f
commit
073ee8a65f
@ -141,8 +141,13 @@ public class CitizensNavigator implements Navigator {
|
|||||||
return;
|
return;
|
||||||
if (reason == CancelReason.STUCK) {
|
if (reason == CancelReason.STUCK) {
|
||||||
StuckAction action = localParams.stuckAction();
|
StuckAction action = localParams.stuckAction();
|
||||||
if (action != null)
|
if (action != null) {
|
||||||
action.run(npc, this);
|
boolean shouldContinue = action.run(npc, this);
|
||||||
|
if (shouldContinue) {
|
||||||
|
stationaryTicks = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Bukkit.getPluginManager().callEvent(new NavigationCancelEvent(this, reason));
|
Bukkit.getPluginManager().callEvent(new NavigationCancelEvent(this, reason));
|
||||||
stopNavigating();
|
stopNavigating();
|
||||||
@ -175,7 +180,7 @@ public class CitizensNavigator implements Navigator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean updateStationaryStatus() {
|
private boolean updateStationaryStatus() {
|
||||||
if (localParams.stationaryTicks() < 0 || executing.getTargetType() == TargetType.ENTITY)
|
if (localParams.stationaryTicks() < 0)
|
||||||
return false;
|
return false;
|
||||||
EntityLiving handle = npc.getHandle();
|
EntityLiving handle = npc.getHandle();
|
||||||
if (lastX == (int) handle.locX && lastY == (int) handle.locY && lastZ == (int) handle.locZ) {
|
if (lastX == (int) handle.locX && lastY == (int) handle.locY && lastZ == (int) handle.locZ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user