Paper/Spigot-API-Patches/0028-Entity-AddTo-RemoveFrom-World-Events.patch
Aikar 17b58d00d8
Unwrap Event Exceptions
This was a useless exception wrapper that ends up making
stack traces harder to read as well as the JVM cutting off
the important parts

Nothing catches this exception, so its safe to just get rid
of it and let the REAL exception bubble down
2019-02-23 12:17:41 -05:00

77 lines
2.3 KiB
Diff

From 317c71255861fe7a849577db4f289473425bd0d6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:26:34 -0400
Subject: [PATCH] Entity AddTo/RemoveFrom World Events
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
new file mode 100644
index 00000000..18b158cd
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
@@ -0,0 +1,29 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+
+/**
+ * Fired any time an entity is being added to the world for any reason.
+ *
+ * Not to be confused with {@link org.bukkit.event.entity.CreatureSpawnEvent}
+ * This will fire anytime a chunk is reloaded too.
+ */
+public class EntityAddToWorldEvent extends EntityEvent {
+
+ public EntityAddToWorldEvent(Entity entity) {
+ super(entity);
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
new file mode 100644
index 00000000..800be6aa
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
@@ -0,0 +1,26 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+
+/**
+ * Fired any time an entity is being removed from a world for any reason
+ */
+public class EntityRemoveFromWorldEvent extends EntityEvent {
+
+ public EntityRemoveFromWorldEvent(Entity entity) {
+ super(entity);
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.20.1