Update Entity AddTo|RemoveFrom World events to be EntityEvents

This commit is contained in:
Aikar 2016-06-24 00:16:46 -04:00
parent 53848cdc2f
commit 997285e344

View file

@ -15,6 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+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 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * 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();
@ -58,23 +50,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+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();