2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
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
|
2024-02-01 10:15:57 +01:00
|
|
|
index 0000000000000000000000000000000000000000..ff7d9ff618ab821eeece6923a694a9a4eea8585d
|
2021-06-11 14:02:28 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
|
2024-02-01 10:15:57 +01:00
|
|
|
@@ -0,0 +1,32 @@
|
2021-06-11 14:02:28 +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;
|
2023-09-14 12:44:12 +02:00
|
|
|
+import org.jetbrains.annotations.ApiStatus;
|
2021-06-11 14:02:28 +02:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Called when a phantom is spawned for an exhausted player
|
|
|
|
+ */
|
|
|
|
+public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent {
|
2024-02-01 10:15:57 +01:00
|
|
|
+
|
2021-06-11 14:02:28 +02:00
|
|
|
+ @NotNull private final Entity entity;
|
|
|
|
+
|
2023-09-14 12:44:12 +02:00
|
|
|
+ @ApiStatus.Internal
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public PhantomPreSpawnEvent(@NotNull Location location, @NotNull Entity entity, @NotNull CreatureSpawnEvent.SpawnReason reason) {
|
|
|
|
+ super(location, EntityType.PHANTOM, reason);
|
|
|
|
+ this.entity = entity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Get the entity this phantom is spawning for
|
|
|
|
+ *
|
2024-02-01 10:15:57 +01:00
|
|
|
+ * @return the Entity
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2023-09-14 12:44:12 +02:00
|
|
|
+ @NotNull
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public Entity getSpawningEntity() {
|
2024-02-01 10:15:57 +01:00
|
|
|
+ return this.entity;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java
|
2023-01-01 21:17:40 +01:00
|
|
|
index 86cfdcf3060876c87066483d122e12f5feb55e02..082601f349ae2cebbffd1012c19c521241696a09 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Phantom.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Phantom.java
|
|
|
|
@@ -1,5 +1,8 @@
|
|
|
|
package org.bukkit.entity;
|
|
|
|
|
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
|
+import org.jetbrains.annotations.Nullable;
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Represents a phantom.
|
|
|
|
*/
|
2023-01-01 21:17:40 +01:00
|
|
|
@@ -14,4 +17,14 @@ public interface Phantom extends Flying, Enemy {
|
2021-06-11 14:02:28 +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
|
|
|
|
+ */
|
|
|
|
+ @Nullable
|
|
|
|
+ public java.util.UUID getSpawningEntity();
|
|
|
|
+ // Paper end
|
|
|
|
}
|