From a5b7881dbeedf6ac67c7729e25d3f06c70b27ee9 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Mon, 13 Apr 2015 12:01:55 +0100 Subject: [PATCH] SPIGOT-645: Fix players/entities being dismounted when the destroy event was cancelled --- nms-patches/EntityMinecartAbstract.patch | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/nms-patches/EntityMinecartAbstract.patch b/nms-patches/EntityMinecartAbstract.patch index 76880d8e0a..db2ba15ac9 100644 --- a/nms-patches/EntityMinecartAbstract.patch +++ b/nms-patches/EntityMinecartAbstract.patch @@ -1,5 +1,5 @@ ---- /home/matt/mc-dev-private//net/minecraft/server/EntityMinecartAbstract.java 2015-04-13 11:54:43.295977016 +0100 -+++ src/main/java/net/minecraft/server/EntityMinecartAbstract.java 2015-04-13 11:54:43.295977016 +0100 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityMinecartAbstract.java 2015-04-13 12:01:38.387967804 +0100 ++++ src/main/java/net/minecraft/server/EntityMinecartAbstract.java 2015-04-13 12:01:38.391967804 +0100 @@ -4,6 +4,15 @@ import java.util.Iterator; import java.util.Map; @@ -63,10 +63,10 @@ this.k(-this.r()); this.j(10); this.ac(); -@@ -102,6 +137,15 @@ - if (this.passenger != null) { - this.passenger.mount((Entity) null); - } +@@ -99,6 +134,15 @@ + boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild; + + if (flag || this.getDamage() > 40.0F) { + // CraftBukkit start + VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger); + this.world.getServer().getPluginManager().callEvent(destroyEvent); @@ -76,9 +76,9 @@ + return true; + } + // CraftBukkit end - - if (flag && !this.hasCustomName()) { - this.die(); + if (this.passenger != null) { + this.passenger.mount((Entity) null); + } @@ -140,6 +184,14 @@ }