From 5ee4538fc4b5f6124fb37bbb7bf773f142e504a8 Mon Sep 17 00:00:00 2001 From: fullwall Date: Tue, 5 Nov 2013 13:08:01 +0800 Subject: [PATCH] Set event priorty to MONITOR for right click entity events --- src/main/java/net/citizensnpcs/EventListen.java | 2 +- src/main/java/net/citizensnpcs/trait/Controllable.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/citizensnpcs/EventListen.java b/src/main/java/net/citizensnpcs/EventListen.java index 0b9250fc7..4d5c3aa99 100644 --- a/src/main/java/net/citizensnpcs/EventListen.java +++ b/src/main/java/net/citizensnpcs/EventListen.java @@ -242,7 +242,7 @@ public class EventListen implements Listener { checkCreationEvent(event); } - @EventHandler(ignoreCancelled = true) + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { NPC npc = npcRegistry.getNPC(event.getRightClicked()); if (npc == null) { diff --git a/src/main/java/net/citizensnpcs/trait/Controllable.java b/src/main/java/net/citizensnpcs/trait/Controllable.java index 374015830..b0eed3e23 100644 --- a/src/main/java/net/citizensnpcs/trait/Controllable.java +++ b/src/main/java/net/citizensnpcs/trait/Controllable.java @@ -203,7 +203,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab return enabled; } - private double updateHorizontralSpeed(EntityLiving handle, double speed, float speedMod) { + private double updateHorizontalSpeed(EntityLiving handle, double speed, float speedMod) { double oldSpeed = Math.sqrt(handle.motX * handle.motX + handle.motZ * handle.motZ); double horizontal = ((EntityLiving) handle.passenger).bf; if (horizontal > 0.0D) { @@ -253,7 +253,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab boolean onGround = handle.onGround; float speedMod = npc.getNavigator().getDefaultParameters() .modifiedSpeed((onGround ? GROUND_SPEED : AIR_SPEED)); - this.speed = updateHorizontralSpeed(handle, speed, speedMod); + this.speed = updateHorizontalSpeed(handle, speed, speedMod); boolean shouldJump = NMS.shouldJump(handle.passenger); if (shouldJump) { @@ -275,7 +275,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab } public class LookAirController implements MovementController { - boolean paused = false; + private boolean paused = false; @Override public void leftClick(PlayerInteractEvent event) { @@ -319,7 +319,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab } public class PlayerInputAirController implements MovementController { - boolean paused = false; + private boolean paused = false; private double speed; @Override @@ -344,7 +344,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab return; } EntityLiving handle = getHandle(); - this.speed = updateHorizontralSpeed(handle, this.speed, 1F); + this.speed = updateHorizontalSpeed(handle, this.speed, 1F); boolean shouldJump = NMS.shouldJump(handle.passenger); if (shouldJump) { handle.motY = 0.3F;