Bukkit/CraftBukkit — pull request #574 by wilsonsd (2011-12-07 00:26:30+00:00)
Title: Fix for BUKKIT-223 and make VehicleExitEvent cancellable.

Moved creation of VehicleEnterEvent from EntityBoat and EntityMinecart
to Entity.setPassengerOf. This resolves BUKKIT-223.

Also, in Entity.setPassengerOf, when a VehicleExitEvent is created, I
added checks to see if it is cancelled. This required changing the
return type of setPassengerOf to boolean so we can notify the caller
if the vehicle entry/exit was cancelled or not. We must do this so
that EntityPlayer.setPassengerOf (which calls Entity.setPassengerOf)
knows whether or not to send a packet to the Minecraft client
notifying it that a player has left a vehicle.

This patch creates the following issue:
if a player leaves a vehicle, but the VehicleExitEvent is cancelled,
then the player disconnects then reconnects, they player will appear
outside the vehicle, but a duplicate copy of the player's entity will
be in the vehicle.