Paper/Spigot-Server-Patches/0122-Vehicle-Event-Cancellation-Changes.patch
Aikar 18c3716c49
Current Chunk for Entity and Block Entities, counts by entity type
This enables us a fast reference to the entities current chunk instead
of having to look it up by hashmap lookups.

We also store counts by type to further enable other performance optimizations in later patches.
2018-07-04 03:58:56 -04:00

46 lines
2.1 KiB
Diff

From e68a92dac303b69a9ef4935be8935e649a415431 Mon Sep 17 00:00:00 2001
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
index 7314b4dc5..d1f07bbbd 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -70,7 +70,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
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;
@@ -1979,6 +1979,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
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) {
@@ -1994,7 +1995,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
}
// 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;
+ }
+ entity.setVehicle(null);
+ // Paper end
+
this.passengers.remove(entity);
entity.j = 60;
}
--
2.18.0