2020-01-22 02:02:07 +00:00
|
|
|
From dec02429dc56f84c69c327df0f87b1919f6579a2 Mon Sep 17 00:00:00 2001
|
2016-03-29 00:33:10 +00:00
|
|
|
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
|
2020-01-22 02:02:07 +00:00
|
|
|
index 00000000..07660202
|
2016-03-29 00:33:10 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
|
2019-03-20 00:28:15 +00:00
|
|
|
@@ -0,0 +1,32 @@
|
2016-03-29 00:33:10 +00:00
|
|
|
+package com.destroystokyo.paper.event.entity;
|
|
|
|
+
|
|
|
|
+import org.bukkit.entity.Entity;
|
|
|
|
+import org.bukkit.event.Event;
|
|
|
|
+import org.bukkit.event.HandlerList;
|
2016-06-24 04:16:46 +00:00
|
|
|
+import org.bukkit.event.entity.EntityEvent;
|
2019-03-20 00:28:15 +00:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
2016-03-29 00:33:10 +00:00
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 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.
|
|
|
|
+ */
|
2016-06-24 04:16:46 +00:00
|
|
|
+public class EntityAddToWorldEvent extends EntityEvent {
|
2016-03-29 00:33:10 +00:00
|
|
|
+
|
2019-03-20 00:28:15 +00:00
|
|
|
+ public EntityAddToWorldEvent(@NotNull Entity entity) {
|
2016-06-24 04:16:46 +00:00
|
|
|
+ super(entity);
|
2016-03-29 00:33:10 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
|
|
+
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @NotNull
|
2016-03-29 00:33:10 +00:00
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @NotNull
|
2016-03-29 00:33:10 +00:00
|
|
|
+ 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
|
2020-01-22 02:02:07 +00:00
|
|
|
index 00000000..e5dbbd66
|
2016-03-29 00:33:10 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
|
2019-03-20 00:28:15 +00:00
|
|
|
@@ -0,0 +1,29 @@
|
2016-03-29 00:33:10 +00:00
|
|
|
+package com.destroystokyo.paper.event.entity;
|
|
|
|
+
|
|
|
|
+import org.bukkit.entity.Entity;
|
|
|
|
+import org.bukkit.event.Event;
|
|
|
|
+import org.bukkit.event.HandlerList;
|
2016-06-24 04:16:46 +00:00
|
|
|
+import org.bukkit.event.entity.EntityEvent;
|
2019-03-20 00:28:15 +00:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
2016-03-29 00:33:10 +00:00
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Fired any time an entity is being removed from a world for any reason
|
|
|
|
+ */
|
2016-06-24 04:16:46 +00:00
|
|
|
+public class EntityRemoveFromWorldEvent extends EntityEvent {
|
2016-03-29 00:33:10 +00:00
|
|
|
+
|
2019-03-20 00:28:15 +00:00
|
|
|
+ public EntityRemoveFromWorldEvent(@NotNull Entity entity) {
|
2016-06-24 04:16:46 +00:00
|
|
|
+ super(entity);
|
2016-03-29 00:33:10 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
|
|
+
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @NotNull
|
2016-03-29 00:33:10 +00:00
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @NotNull
|
2016-03-29 00:33:10 +00:00
|
|
|
+ public static HandlerList getHandlerList() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
--
|
2020-01-22 02:02:07 +00:00
|
|
|
2.25.0.windows.1
|
2016-03-29 00:33:10 +00:00
|
|
|
|