diff --git a/src/main/java/net/citizensnpcs/npc/ai/MCNavigationStrategy.java b/src/main/java/net/citizensnpcs/npc/ai/MCNavigationStrategy.java index 2ef9bbef3..d1a54b2a9 100644 --- a/src/main/java/net/citizensnpcs/npc/ai/MCNavigationStrategy.java +++ b/src/main/java/net/citizensnpcs/npc/ai/MCNavigationStrategy.java @@ -15,12 +15,12 @@ import org.bukkit.entity.Player; import com.google.common.collect.Maps; public class MCNavigationStrategy implements PathStrategy { - private EntityHumanNPC entity = null; + private final EntityLiving entity; private final Navigation navigation; MCNavigationStrategy(CitizensNPC npc, Location dest) { + entity = npc.getHandle(); if (npc.getBukkitEntity() instanceof Player) { - entity = (EntityHumanNPC) npc.getHandle(); entity.onGround = true; // not sure of a better way around this - if onGround is false, then // navigation won't execute, and calling entity.move doesn't @@ -32,8 +32,8 @@ public class MCNavigationStrategy implements PathStrategy { } MCNavigationStrategy(EntityLiving entity, EntityLiving target) { + this.entity = entity; if (entity instanceof EntityHumanNPC) { - this.entity = (EntityHumanNPC) entity; entity.onGround = true; // see above } navigation = entity.al(); @@ -60,9 +60,9 @@ public class MCNavigationStrategy implements PathStrategy { @Override public boolean update() { - if (entity != null) { + if (entity instanceof EntityHumanNPC) { navigation.d(); - entity.moveOnCurrentHeading(); + ((EntityHumanNPC) entity).moveOnCurrentHeading(); } return navigation.e(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java b/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java index 9d45fc7af..3f8d2321d 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java @@ -44,7 +44,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHandle { @Override public void F_() { super.F_(); - if (motX != 0 || motZ != 0 || motY != 0) { + if (!npc.getAI().hasDestination() && (motX != 0 || motZ != 0 || motY != 0)) { a(0, 0); } if (noDamageTicks > 0) diff --git a/src/main/java/net/citizensnpcs/trait/waypoint/LinearWaypointProvider.java b/src/main/java/net/citizensnpcs/trait/waypoint/LinearWaypointProvider.java index d410f143c..d76c0c271 100644 --- a/src/main/java/net/citizensnpcs/trait/waypoint/LinearWaypointProvider.java +++ b/src/main/java/net/citizensnpcs/trait/waypoint/LinearWaypointProvider.java @@ -40,9 +40,11 @@ public class LinearWaypointProvider implements WaypointProvider, IterableAdded a waypoint at (%d, %d, %d).", @@ -67,6 +69,11 @@ public class LinearWaypointProvider implements WaypointProvider, Iterable