testserver/Spigot-Server-Patches/0074-Entity-AddTo-RemoveFro...

30 lines
1.3 KiB
Diff
Raw Normal View History

2019-04-27 03:05:36 +00:00
From 30a0f8ece5268608ed4328b4c2f6aeb9066b6689 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:32:58 -0400
Subject: [PATCH] Entity AddTo/RemoveFrom World Events
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 3bd624569..ab2ca1c32 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1102,6 +1102,7 @@ public class WorldServer extends World {
this.I.add(((EntityInsentient) entity).getNavigation());
}
entity.valid = true; // CraftBukkit
+ new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
}
}
@@ -1111,6 +1112,7 @@ public class WorldServer extends World {
if (this.tickingEntities) {
throw new IllegalStateException("Removing entity while ticking!");
} else {
+ new com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
this.removeEntityFromChunk(entity);
this.entitiesById.remove(entity.getId());
this.unregisterEntity(entity);
--
2.21.0