2018-07-21 22:43:00 +02:00
|
|
|
From 173ce5b19ace1cc6316fe318b79cc36ee2c207d5 Mon Sep 17 00:00:00 2001
|
2016-04-23 00:01:28 +02: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-21 22:43:00 +02:00
|
|
|
index 31c580de1..16d521dfd 100644
|
2016-04-23 00:01:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2018-07-21 22:43:00 +02:00
|
|
|
@@ -93,7 +93,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2018-07-16 17:34:55 +02:00
|
|
|
public boolean j;
|
2016-12-29 06:53:02 +01:00
|
|
|
public final List<Entity> passengers;
|
2018-07-16 17:34:55 +02:00
|
|
|
protected int k;
|
|
|
|
- private Entity ax;
|
2018-07-16 22:08:09 +02:00
|
|
|
+ private Entity ax;public void setVehicle(Entity entity) { this.ax = entity; } // Paper - OBFHELPER
|
2016-12-29 06:53:02 +01:00
|
|
|
public boolean attachedToPlayer;
|
|
|
|
public World world;
|
|
|
|
public double lastX;
|
2018-07-21 22:43:00 +02:00
|
|
|
@@ -2123,6 +2123,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2016-12-29 06:53:02 +01:00
|
|
|
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
2016-04-23 00:01:28 +02:00
|
|
|
} else {
|
|
|
|
// CraftBukkit start
|
2016-12-29 06:53:02 +01:00
|
|
|
+ entity.setVehicle(this); // Paper - Set the vehicle back for the event
|
2016-04-23 00:01:28 +02:00
|
|
|
CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
|
|
|
|
Entity orig = craft == null ? null : craft.getHandle();
|
2016-12-29 06:53:02 +01:00
|
|
|
if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
|
2018-07-21 22:43:00 +02:00
|
|
|
@@ -2138,7 +2139,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2016-04-23 00:01:28 +02: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 06:53:02 +01:00
|
|
|
+ entity.setVehicle(null);
|
2016-04-23 00:01:28 +02:00
|
|
|
+ // Paper end
|
2016-12-29 06:53:02 +01:00
|
|
|
+
|
2016-04-23 00:01:28 +02:00
|
|
|
this.passengers.remove(entity);
|
2018-07-16 17:34:55 +02:00
|
|
|
entity.k = 60;
|
2016-04-23 00:01:28 +02:00
|
|
|
}
|
|
|
|
--
|
2018-07-16 22:08:09 +02:00
|
|
|
2.18.0
|
2016-04-23 00:01:28 +02:00
|
|
|
|