3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00
Paper/Spigot-API-Patches/0030-Entity-AddTo-RemoveFrom-World-Events.patch
Aikar c2f872aed3 Add Minimal FastUtil int/long collections.
Importing the full library would double the jar size... its way too large.
So lets just import the basic int/long based collections to then use
to improve performance on these kind of collections.
2016-03-30 01:57:56 -04:00

93 Zeilen
2.6 KiB
Diff

From d32bff844b27d2b2e5827728d21411630c15d25e 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 0000000..cc44c1d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
@@ -0,0 +1,37 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+/**
+ * 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 Event {
+
+ 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;
+ }
+
+ 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 0000000..9b522ce
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
@@ -0,0 +1,34 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+/**
+ * Fired any time an entity is being removed from a world for any reason
+ */
+public class EntityRemoveFromWorldEvent extends Event {
+ private final Entity entity;
+
+ public EntityRemoveFromWorldEvent(Entity entity) {
+ this.entity = entity;
+ }
+
+ /**
+ * Gets the entity being removed from the world
+ * @return
+ */
+ public Entity getEntity() {
+ return entity;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.8.0