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,15 +115,14 @@ public class EventListen implements Listener {
@EventHandler @EventHandler
public void onEntityTarget(EntityTargetEvent event) { public void onEntityTarget(EntityTargetEvent event) {
if (!npcRegistry.isNPC(event.getEntity()) || !(event.getTarget() instanceof Player)) if (npcRegistry.isNPC(event.getEntity()) && event.getTarget() instanceof Player) {
return; NPC npc = npcRegistry.getNPC(event.getEntity());
Player player = (Player) event.getTarget();
NPC npc = npcRegistry.getNPC(event.getEntity()); // Call right-click event
Player player = (Player) event.getTarget(); NPCRightClickEvent rightClickEvent = new NPCRightClickEvent(npc, player);
Bukkit.getPluginManager().callEvent(rightClickEvent);
// Call right-click event }
NPCRightClickEvent rightClickEvent = new NPCRightClickEvent(npc, player);
Bukkit.getPluginManager().callEvent(rightClickEvent);
} }
/* /*

View File

@ -110,6 +110,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
getControllerMove().c(); getControllerMove().c();
getControllerLook().a(); getControllerLook().a();
getControllerJump().b(); getControllerJump().b();
e(npc.getNavigator().getDefaultParameters().speed());
// taken from EntityLiving update method // taken from EntityLiving update method
if (bu) { if (bu) {

View File

@ -72,7 +72,7 @@ public class Controllable extends Trait implements Toggleable {
boolean onGround = handle.onGround; boolean onGround = handle.onGround;
handle.motX += handle.passenger.motX * (onGround ? GROUND_SPEED : AIR_SPEED); handle.motX += handle.passenger.motX * (onGround ? GROUND_SPEED : AIR_SPEED);
handle.motZ += handle.passenger.motZ * (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 @Override