mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-25 10:29:41 -05:00
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.
This commit is contained in:
1 parent
67f15266da
commit
cebc247b78
4 files changed
+52
-6
No files matched your search
@@ -461,12 +461,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
public void setPassengerOf(Entity entity) {
|
||||
// mount(null) doesn't really fly for overloaded methods,
|
||||
// so this method is needed
|
||||
Entity currentVehicle = this.vehicle;
|
||||
|
||||
super.setPassengerOf(entity);
|
||||
// CraftBukkit end
|
||||
|
||||
this.playerConnection.sendPacket(new Packet39AttachEntity(0, this, this.vehicle));
|
||||
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
// Check if the vehicle actually changed.
|
||||
if (currentVehicle != this.vehicle) {
|
||||
this.playerConnection.sendPacket(new Packet39AttachEntity(0, this, this.vehicle));
|
||||
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected void a(double d0, boolean flag) {}
|
||||
|
||||
Reference in new issue
Block a user