Call event when boat is destroyed by falling. Fixes BUKKIT-5500

This commit is contained in:
Brokkonaut 2014-03-29 22:39:17 +01:00 committed by Travis Watkins
parent 0092460086
commit a86bc7aeb3

View File

@ -445,17 +445,24 @@ public class EntityBoat extends Entity {
if (this.fallDistance > 3.0F) { if (this.fallDistance > 3.0F) {
this.b(this.fallDistance); this.b(this.fallDistance);
if (!this.world.isStatic && !this.dead) { if (!this.world.isStatic && !this.dead) {
this.die(); // CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
if (!destroyEvent.isCancelled()) {
this.die();
int l; int l;
for (l = 0; l < 3; ++l) { for (l = 0; l < 3; ++l) {
this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F); this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
} }
for (l = 0; l < 2; ++l) { for (l = 0; l < 2; ++l) {
this.a(Items.STICK, 1, 0.0F); this.a(Items.STICK, 1, 0.0F);
}
} }
// CraftBukkit end
} }
this.fallDistance = 0.0F; this.fallDistance = 0.0F;