This commit is contained in:
fullwall 2012-09-01 14:26:54 +08:00
parent 1b3d81f019
commit 47c5775a95
3 changed files with 9 additions and 9 deletions

View File

@ -115,9 +115,7 @@ 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();
@ -125,6 +123,7 @@ public class EventListen implements Listener {
NPCRightClickEvent rightClickEvent = new NPCRightClickEvent(npc, player);
Bukkit.getPluginManager().callEvent(rightClickEvent);
}
}
/*
* Player events

View File

@ -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) {

View File

@ -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