diff options
author | Nate Mortensen <nate.richard.mortensen@gmail.com> | 2013-07-12 16:45:42 -0600 |
---|---|---|
committer | Nate Mortensen <nate.richard.mortensen@gmail.com> | 2013-07-13 13:29:32 -0600 |
commit | cebc247b78e14c7bc236d69010e1000d53be28ef (patch) | |
tree | a54345c2058257476570d19aba1572955c9da659 /src/main/java/net/minecraft/server/PathfinderGoalTame.java | |
parent | 67f15266dae4d2963d5351fb20f40de63acd721e (diff) | |
download | craftbukkit-cebc247b78e14c7bc236d69010e1000d53be28ef.tar craftbukkit-cebc247b78e14c7bc236d69010e1000d53be28ef.tar.gz craftbukkit-cebc247b78e14c7bc236d69010e1000d53be28ef.tar.lz craftbukkit-cebc247b78e14c7bc236d69010e1000d53be28ef.tar.xz craftbukkit-cebc247b78e14c7bc236d69010e1000d53be28ef.zip |
Correctly fire VehicleExitEvent. Fixes BUKKIT-3761
This change makes it so that EntityHuman#setPassengerOf(Entity) invokes
its parent method when leaving vehicles so that VehicleExitEvent is fired
for players leaving vehicles.
This change also fixes BUKKIT-2110, making it so VehicleExitEvent
correctly handles cancellation. The implementation of VehicleExitEvent
completely ignored the cancellation state of the event, making it so that
cancelling the event had no effect. Cancelling a VehicleExitEvent now
causes the entity to remain inside of the vehicle, with no visual stutter.
Diffstat (limited to 'src/main/java/net/minecraft/server/PathfinderGoalTame.java')
-rw-r--r-- | src/main/java/net/minecraft/server/PathfinderGoalTame.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTame.java b/src/main/java/net/minecraft/server/PathfinderGoalTame.java index 8fde2e11..4b0d484c 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalTame.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalTame.java @@ -55,8 +55,16 @@ public class PathfinderGoalTame extends PathfinderGoal { this.entity.t(5); } - if (this.entity.passenger != null) this.entity.passenger.mount((Entity) null); // CraftBukkit - Check for null - this.entity.passenger = null; + // CraftBukkit start - Handle dismounting to account for VehicleExitEvent being fired. + if (this.entity.passenger != null) { + this.entity.passenger.mount((Entity) null); + // If the entity still has a passenger, then a plugin cancelled the event. + if (this.entity.passenger != null) { + return; + } + } + // this.entity.passenger = null; + // CraftBukkit end this.entity.cD(); this.entity.world.broadcastEntityEffect(this.entity, (byte) 6); } |