Update Entity AddTo|RemoveFrom World events to be EntityEvents

This commit is contained in:
Aikar 2016-06-24 00:16:46 -04:00
parent dc33259d0d
commit 0152e0f616

View File

@ -1,4 +1,4 @@
From d32bff844b27d2b2e5827728d21411630c15d25e Mon Sep 17 00:00:00 2001
From 159fec1e94abbed864b41a5aeeca483306863fba 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
@ -6,15 +6,16 @@ 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 0000000..cc44c1d
index 0000000..18b158c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
@@ -0,0 +1,37 @@
@@ -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.
@ -22,19 +23,10 @@ index 0000000..cc44c1d
+ * Not to be confused with {@link org.bukkit.event.entity.CreatureSpawnEvent}
+ * This will fire anytime a chunk is reloaded too.
+ */
+public class EntityAddToWorldEvent extends Event {
+public class EntityAddToWorldEvent extends EntityEvent {
+
+ private final Entity entity;
+ public EntityAddToWorldEvent(Entity entity) {
+ this.entity = entity;
+ }
+
+ /**
+ * Gets the entity being added to the world
+ * @return
+ */
+ public Entity getEntity() {
+ return entity;
+ super(entity);
+ }
+
+ private static final HandlerList handlers = new HandlerList();
@ -49,32 +41,24 @@ index 0000000..cc44c1d
+}
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 0000000..9b522ce
index 0000000..800be6a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
@@ -0,0 +1,34 @@
@@ -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 Event {
+ private final Entity entity;
+public class EntityRemoveFromWorldEvent extends EntityEvent {
+
+ public EntityRemoveFromWorldEvent(Entity entity) {
+ this.entity = entity;
+ }
+
+ /**
+ * Gets the entity being removed from the world
+ * @return
+ */
+ public Entity getEntity() {
+ return entity;
+ super(entity);
+ }
+
+ private static final HandlerList handlers = new HandlerList();
@ -88,5 +72,5 @@ index 0000000..9b522ce
+ }
+}
--
2.8.0
2.9.0