From 9629d652201822443eb29153ef65529d8a0a5a23 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 26 Jul 2018 18:41:00 +0100 Subject: [PATCH] Fix EntityDismountEvent changes While upstream has now made this event cancellable, their changes result in the vechicle being removed before the event is called, thus leading cancellation to not behave as expected. --- .../Vehicle-Event-Cancellation-Changes.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Spigot-Server-Patches/Vehicle-Event-Cancellation-Changes.patch diff --git a/Spigot-Server-Patches/Vehicle-Event-Cancellation-Changes.patch b/Spigot-Server-Patches/Vehicle-Event-Cancellation-Changes.patch new file mode 100644 index 0000000000..f0e26eacab --- /dev/null +++ b/Spigot-Server-Patches/Vehicle-Event-Cancellation-Changes.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +Date: Fri, 22 Apr 2016 18:20:05 -0500 +Subject: [PATCH] Vehicle Event Cancellation Changes + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 85358902ff..98d67d9a17 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + public boolean j; public boolean blocksEntitySpawning() { return j; } // Paper - OBFHELPER + public final List passengers; + protected int k; +- private Entity ax; ++ private Entity ax;public void setVehicle(Entity entity) { this.ax = entity; } // Paper - OBFHELPER + public boolean attachedToPlayer; + public World world; + public double lastX; +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); + } else { + // CraftBukkit start ++ entity.setVehicle(this); // Paper - Set the vehicle back for the event + CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle(); + Entity orig = craft == null ? null : craft.getHandle(); + if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + return; + } + // Spigot end ++ ++ entity.setVehicle(null); // Paper - fix EntityDismountEvent cancellable + this.passengers.remove(entity); + entity.k = 60; + } +-- \ No newline at end of file