Paper/Spigot-API-Patches/0142-Add-PhantomPreSpawnEvent.patch
Shane Freeder ea855e2b46 Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Developers!: You will need to clean up your work/Minecraft/1.13.2 folder
for this

Also, restore a patch that was dropped in the last upstream

Bukkit Changes:
279eeab3 Fix command description not being set
96e2bb18 Remove debug print from SyntheticEventTest

CraftBukkit Changes:
d3ed1516 Fix dangerously threaded beacons
217a293d Don't relocate joptsimple to allow --help to work.
1be05a21 Prepare for imminent Java 12 release
a49270b2 Mappings Update
5259d80c SPIGOT-4669: Fix PlayerTeleportEvent coordinates for relative teleports

Spigot Changes:
e6eb36f2 Rebuild patches
2019-03-20 01:55:16 +00:00

75 lines
2.2 KiB
Diff

From c2f4f4916892115c29f047a6f294c0103d83cdaa 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
index 000000000..9022f697a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
@@ -0,0 +1,31 @@
+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;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+
+/**
+ * Called when a phantom is spawned for an exhausted player
+ */
+public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent {
+ @NotNull private final Entity entity;
+
+ 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
+ *
+ * @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
index 1a1044edc..ed4d417c2 100644
--- 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.
*/
@@ -14,4 +17,14 @@ public interface Phantom extends Flying {
* @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
}
--
2.21.0