Bukkit/CraftBukkit — pull request #601 by wilsonsd (2011-12-16 20:32:42+00:00)
Title: Prevent VehicleEnterEvent being sent when player exits vehicle.  Fix for BUKKIT-223.

Issue BUKKIT-223: When a player exits a minecart or boat, both a
VehicleExitEvent and a VehicleEnterEvent are fired. Only the
VehicleExitEvent should fire.

Reason for bug: This occurs because the VehicleEnterEvent is fired in
EntityBoat.b and EntityMinecart.b *any* time a player right-clicks on
a vehicle, whether the right-click is to enter the vehicle or exit it.

Fix: By moving the creation of VehicleEnterEvents from EntityBoat.b
and EntityMinecart.b to Entity.setPassengerOf, we can create either a
VehicleEnterEvent or a VehicleExitEvent, depending on whether the
player is entering or exiting a vehicle.