mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-03 01:10:37 +01:00
8175ec916f
Should fix #1280 Citizens hijacks entity map, and im guessing under the right conditions the result might actually be null during entity creation Pre the cache patch, the id is looked up on save, so it was fine. Now, if its null and the save ID is requested, we will try to look it up again and cache it if found.
46 lines
2.1 KiB
Diff
46 lines
2.1 KiB
Diff
From e834b8fc7de6fc3a3460176d2c23e77d3c5afce3 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 89e42c0a46..86b783e73b 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -83,7 +83,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;
|
|
@@ -2022,6 +2022,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) {
|
|
@@ -2037,7 +2038,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
|
|
|