From f1ad62b1168dd660a59d0a8d806f962e28015720 Mon Sep 17 00:00:00 2001 From: fullwall Date: Fri, 7 Sep 2012 16:38:18 +0800 Subject: [PATCH] Change StuckAction implementation --- .../net/citizensnpcs/npc/ai/CitizensNavigator.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java b/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java index 7549a35bf..1f88bb412 100644 --- a/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java +++ b/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java @@ -141,8 +141,13 @@ public class CitizensNavigator implements Navigator { return; if (reason == CancelReason.STUCK) { StuckAction action = localParams.stuckAction(); - if (action != null) - action.run(npc, this); + if (action != null) { + boolean shouldContinue = action.run(npc, this); + if (shouldContinue) { + stationaryTicks = 0; + return; + } + } } Bukkit.getPluginManager().callEvent(new NavigationCancelEvent(this, reason)); stopNavigating(); @@ -175,7 +180,7 @@ public class CitizensNavigator implements Navigator { } private boolean updateStationaryStatus() { - if (localParams.stationaryTicks() < 0 || executing.getTargetType() == TargetType.ENTITY) + if (localParams.stationaryTicks() < 0) return false; EntityLiving handle = npc.getHandle(); if (lastX == (int) handle.locX && lastY == (int) handle.locY && lastZ == (int) handle.locZ) {