mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-31 00:20:44 +01:00
1863ac217f
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent 258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD CraftBukkit Changes: 98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent 5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class 76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor Spigot Changes: e9ec5485 Rebuild patches f1b62e0c Rebuild patches
135 lines
4.6 KiB
Diff
135 lines
4.6 KiB
Diff
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
|
|
@@ -0,0 +0,0 @@
|
|
+package com.destroystokyo.paper.event.entity;
|
|
+
|
|
+import org.bukkit.World;
|
|
+import org.bukkit.entity.Entity;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
|
+import org.bukkit.event.entity.EntityEvent;
|
|
+import org.jetbrains.annotations.ApiStatus;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+/**
|
|
+ * Fired any time an entity is being added to the world for any reason (including a chunk loading).
|
|
+ * <p>
|
|
+ * Not to be confused with {@link CreatureSpawnEvent}
|
|
+ */
|
|
+public class EntityAddToWorldEvent extends EntityEvent {
|
|
+
|
|
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
|
+
|
|
+ @NotNull private final World world;
|
|
+
|
|
+ @ApiStatus.Internal
|
|
+ public EntityAddToWorldEvent(@NotNull Entity entity, @NotNull World world) {
|
|
+ super(entity);
|
|
+ this.world = world;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @return The world that the entity is being added to
|
|
+ */
|
|
+ @NotNull
|
|
+ public World getWorld() {
|
|
+ return this.world;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return HANDLER_LIST;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return HANDLER_LIST;
|
|
+ }
|
|
+}
|
|
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
|
|
@@ -0,0 +0,0 @@
|
|
+package com.destroystokyo.paper.event.entity;
|
|
+
|
|
+import org.bukkit.World;
|
|
+import org.bukkit.entity.Entity;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.entity.EntityEvent;
|
|
+import org.jetbrains.annotations.ApiStatus;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+/**
|
|
+ * Fired any time an entity is being removed from a world for any reason (including a chunk unloading).
|
|
+ * Note: The entity is updated prior to this event being called, as such, the entity's world may not be equal to {@link #getWorld()}.
|
|
+ */
|
|
+public class EntityRemoveFromWorldEvent extends EntityEvent {
|
|
+
|
|
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
|
+
|
|
+ @NotNull private final World world;
|
|
+
|
|
+ @ApiStatus.Internal
|
|
+ public EntityRemoveFromWorldEvent(@NotNull Entity entity, @NotNull World world) {
|
|
+ super(entity);
|
|
+ this.world = world;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @return The world that the entity is being removed from
|
|
+ */
|
|
+ @NotNull
|
|
+ public World getWorld() {
|
|
+ return this.world;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return HANDLER_LIST;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return HANDLER_LIST;
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/event/entity/EntityRemoveEvent.java b/src/main/java/org/bukkit/event/entity/EntityRemoveEvent.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/event/entity/EntityRemoveEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/entity/EntityRemoveEvent.java
|
|
@@ -0,0 +0,0 @@
|
|
package org.bukkit.event.entity;
|
|
|
|
+import com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent;
|
|
import org.bukkit.entity.Entity;
|
|
import org.bukkit.event.HandlerList;
|
|
import org.jetbrains.annotations.ApiStatus;
|
|
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
|
* This event should only be used for monitoring. The result
|
|
* of modifying the entity during or after this event is unspecified.
|
|
* This event is not called for a {@link org.bukkit.entity.Player}.
|
|
+ * @deprecated use {@link EntityRemoveFromWorldEvent} instead
|
|
*/
|
|
-@ApiStatus.Experimental
|
|
+@Deprecated(forRemoval = true)
|
|
public class EntityRemoveEvent extends EntityEvent {
|
|
|
|
private static final HandlerList handlers = new HandlerList();
|
|
@@ -0,0 +0,0 @@ public class EntityRemoveEvent extends EntityEvent {
|
|
* When the chunk an entity is in gets unloaded.
|
|
*/
|
|
UNLOAD,
|
|
+ DISCARD
|
|
}
|
|
}
|