2018-07-27 03:57:31 +00:00
|
|
|
From e834b8fc7de6fc3a3460176d2c23e77d3c5afce3 Mon Sep 17 00:00:00 2001
|
2016-04-22 22:01:28 +00:00
|
|
|
From: Zach Brown <zach.brown@destroystokyo.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
|
2018-07-27 03:57:31 +00:00
|
|
|
index 89e42c0a46..86b783e73b 100644
|
2016-04-22 22:01:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2018-07-21 13:03:10 +00:00
|
|
|
@@ -83,7 +83,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
2016-12-29 05:53:02 +00:00
|
|
|
public boolean i;
|
|
|
|
public final List<Entity> passengers;
|
|
|
|
protected int j;
|
|
|
|
- private Entity au;
|
|
|
|
+ private Entity au;public void setVehicle(Entity entity) { this.au = entity; } // Paper // OBFHELPER
|
|
|
|
public boolean attachedToPlayer;
|
|
|
|
public World world;
|
|
|
|
public double lastX;
|
2018-07-27 03:57:31 +00:00
|
|
|
@@ -2022,6 +2022,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
2016-12-29 05:53:02 +00:00
|
|
|
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
2016-04-22 22:01:28 +00:00
|
|
|
} else {
|
|
|
|
// CraftBukkit start
|
2016-12-29 05:53:02 +00:00
|
|
|
+ entity.setVehicle(this); // Paper - Set the vehicle back for the event
|
2016-04-22 22:01:28 +00:00
|
|
|
CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
|
|
|
|
Entity orig = craft == null ? null : craft.getHandle();
|
2016-12-29 05:53:02 +00:00
|
|
|
if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
|
2018-07-27 03:57:31 +00:00
|
|
|
@@ -2037,7 +2038,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
2016-04-22 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
- Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity())); // Spigot
|
|
|
|
+ // Paper start - make EntityDismountEvent cancellable
|
|
|
|
+ if (!new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity()).callEvent()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
2016-12-29 05:53:02 +00:00
|
|
|
+ entity.setVehicle(null);
|
2016-04-22 22:01:28 +00:00
|
|
|
+ // Paper end
|
2016-12-29 05:53:02 +00:00
|
|
|
+
|
2016-04-22 22:01:28 +00:00
|
|
|
this.passengers.remove(entity);
|
|
|
|
entity.j = 60;
|
|
|
|
}
|
|
|
|
--
|
2018-07-04 07:55:24 +00:00
|
|
|
2.18.0
|
2016-04-22 22:01:28 +00:00
|
|
|
|