2019-03-20 02:46:00 +01:00
|
|
|
From c2f4f4916892115c29f047a6f294c0103d83cdaa Mon Sep 17 00:00:00 2001
|
2018-08-27 08:51:20 +02:00
|
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
|
|
Date: Sat, 25 Aug 2018 19:56:42 -0500
|
|
|
|
Subject: [PATCH] Add PhantomPreSpawnEvent
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
|
|
|
|
new file mode 100644
|
2019-03-20 01:28:15 +01:00
|
|
|
index 000000000..9022f697a
|
2018-08-27 08:51:20 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
|
2019-03-20 01:28:15 +01:00
|
|
|
@@ -0,0 +1,31 @@
|
2018-08-27 08:51:20 +02:00
|
|
|
+package com.destroystokyo.paper.event.entity;
|
|
|
|
+
|
|
|
|
+import org.bukkit.Location;
|
|
|
|
+import org.bukkit.entity.Entity;
|
|
|
|
+import org.bukkit.entity.EntityType;
|
|
|
|
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
2019-03-20 01:28:15 +01:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
|
+import org.jetbrains.annotations.Nullable;
|
2018-08-27 08:51:20 +02:00
|
|
|
+
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Called when a phantom is spawned for an exhausted player
|
|
|
|
+ */
|
|
|
|
+public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent {
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull private final Entity entity;
|
2018-08-27 08:51:20 +02:00
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ public PhantomPreSpawnEvent(@NotNull Location location, @NotNull Entity entity, @NotNull CreatureSpawnEvent.SpawnReason reason) {
|
2018-08-27 08:51:20 +02:00
|
|
|
+ super(location, EntityType.PHANTOM, reason);
|
|
|
|
+ this.entity = entity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Get the entity this phantom is spawning for
|
|
|
|
+ *
|
|
|
|
+ * @return Entity
|
|
|
|
+ */
|
|
|
|
+ @Nullable
|
|
|
|
+ public Entity getSpawningEntity() {
|
|
|
|
+ return entity;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java
|
2019-03-20 01:28:15 +01:00
|
|
|
index 1a1044edc..ed4d417c2 100644
|
2018-08-27 08:51:20 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Phantom.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Phantom.java
|
2019-03-20 01:28:15 +01:00
|
|
|
@@ -1,5 +1,8 @@
|
|
|
|
package org.bukkit.entity;
|
|
|
|
|
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
|
+import org.jetbrains.annotations.Nullable;
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Represents a phantom.
|
|
|
|
*/
|
|
|
|
@@ -14,4 +17,14 @@ public interface Phantom extends Flying {
|
2018-08-27 08:51:20 +02:00
|
|
|
* @param sz The new size of the phantom.
|
|
|
|
*/
|
|
|
|
public void setSize(int sz);
|
|
|
|
+
|
|
|
|
+ // Paper start
|
|
|
|
+ /**
|
|
|
|
+ * Get the UUID of the entity that caused this phantom to spawn
|
|
|
|
+ *
|
|
|
|
+ * @return UUID
|
|
|
|
+ */
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @Nullable
|
2018-08-27 08:51:20 +02:00
|
|
|
+ public java.util.UUID getSpawningEntity();
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
--
|
2019-03-20 01:28:15 +01:00
|
|
|
2.21.0
|
2018-08-27 08:51:20 +02:00
|
|
|
|