From 47c5775a95c450e7199f89a4ba82a5af06a048a4 Mon Sep 17 00:00:00 2001 From: fullwall Date: Sat, 1 Sep 2012 14:26:54 +0800 Subject: [PATCH] Fix? --- src/main/java/net/citizensnpcs/EventListen.java | 15 +++++++-------- .../citizensnpcs/npc/entity/EntityHumanNPC.java | 1 + .../java/net/citizensnpcs/trait/Controllable.java | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/citizensnpcs/EventListen.java b/src/main/java/net/citizensnpcs/EventListen.java index 988603b12..e957c0da1 100644 --- a/src/main/java/net/citizensnpcs/EventListen.java +++ b/src/main/java/net/citizensnpcs/EventListen.java @@ -115,15 +115,14 @@ public class EventListen implements Listener { @EventHandler public void onEntityTarget(EntityTargetEvent event) { - if (!npcRegistry.isNPC(event.getEntity()) || !(event.getTarget() instanceof Player)) - return; + if (npcRegistry.isNPC(event.getEntity()) && event.getTarget() instanceof Player) { + NPC npc = npcRegistry.getNPC(event.getEntity()); + Player player = (Player) event.getTarget(); - NPC npc = npcRegistry.getNPC(event.getEntity()); - Player player = (Player) event.getTarget(); - - // Call right-click event - NPCRightClickEvent rightClickEvent = new NPCRightClickEvent(npc, player); - Bukkit.getPluginManager().callEvent(rightClickEvent); + // Call right-click event + NPCRightClickEvent rightClickEvent = new NPCRightClickEvent(npc, player); + Bukkit.getPluginManager().callEvent(rightClickEvent); + } } /* diff --git a/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java b/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java index 2f8e43676..ab319cb9e 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java @@ -110,6 +110,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder { getControllerMove().c(); getControllerLook().a(); getControllerJump().b(); + e(npc.getNavigator().getDefaultParameters().speed()); // taken from EntityLiving update method if (bu) { diff --git a/src/main/java/net/citizensnpcs/trait/Controllable.java b/src/main/java/net/citizensnpcs/trait/Controllable.java index dd7ea7cd6..ec61440cf 100644 --- a/src/main/java/net/citizensnpcs/trait/Controllable.java +++ b/src/main/java/net/citizensnpcs/trait/Controllable.java @@ -72,7 +72,7 @@ public class Controllable extends Trait implements Toggleable { boolean onGround = handle.onGround; handle.motX += handle.passenger.motX * (onGround ? GROUND_SPEED : AIR_SPEED); handle.motZ += handle.passenger.motZ * (onGround ? GROUND_SPEED : AIR_SPEED); - handle.e(npc.getNavigator().getSpeed()); + handle.e(npc.getNavigator().getDefaultParameters().speed()); } @Override