diff options
Diffstat (limited to 'patches/api/0079-PreCreatureSpawnEvent.patch')
-rw-r--r-- | patches/api/0079-PreCreatureSpawnEvent.patch | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/patches/api/0079-PreCreatureSpawnEvent.patch b/patches/api/0079-PreCreatureSpawnEvent.patch index 60f65dc98d..f746a461e5 100644 --- a/patches/api/0079-PreCreatureSpawnEvent.patch +++ b/patches/api/0079-PreCreatureSpawnEvent.patch @@ -16,10 +16,10 @@ See: https://github.com/PaperMC/Paper/issues/917 diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..633ef4dcc701916f2dbfefbbebd5994f93ffc2a4 +index 0000000000000000000000000000000000000000..c1c96f93a4a5450381cb5bdb198b056a37ba0fbe --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java -@@ -0,0 +1,109 @@ +@@ -0,0 +1,105 @@ +package com.destroystokyo.paper.event.entity; + +import org.bukkit.Location; @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..633ef4dcc701916f2dbfefbbebd5994f +import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * WARNING: This event only fires for a limited number of cases, and not for every case that {@link CreatureSpawnEvent} does. @@ -41,19 +41,20 @@ index 0000000000000000000000000000000000000000..633ef4dcc701916f2dbfefbbebd5994f + * Currently: NATURAL and SPAWNER based reasons. <!-- Please submit a Pull Request for future additions. --> + * Also, Plugins that replace Entity Registrations with their own custom entities might not fire this event. + */ ++@NullMarked +public class PreCreatureSpawnEvent extends Event implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); + -+ @NotNull private final Location location; -+ @NotNull private final EntityType type; -+ @NotNull private final CreatureSpawnEvent.SpawnReason reason; ++ private final Location location; ++ private final EntityType type; ++ private final CreatureSpawnEvent.SpawnReason reason; + private boolean shouldAbortSpawn; + + private boolean cancelled; + + @ApiStatus.Internal -+ public PreCreatureSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) { ++ public PreCreatureSpawnEvent(final Location location, final EntityType type, final CreatureSpawnEvent.SpawnReason reason) { + this.location = location; + this.type = type; + this.reason = reason; @@ -62,7 +63,6 @@ index 0000000000000000000000000000000000000000..633ef4dcc701916f2dbfefbbebd5994f + /** + * @return The location this creature is being spawned at + */ -+ @NotNull + public Location getSpawnLocation() { + return this.location.clone(); + } @@ -70,7 +70,6 @@ index 0000000000000000000000000000000000000000..633ef4dcc701916f2dbfefbbebd5994f + /** + * @return The type of creature being spawned + */ -+ @NotNull + public EntityType getType() { + return this.type; + } @@ -78,7 +77,6 @@ index 0000000000000000000000000000000000000000..633ef4dcc701916f2dbfefbbebd5994f + /** + * @return Reason this creature is spawning (ie, NATURAL vs SPAWNER) + */ -+ @NotNull + public CreatureSpawnEvent.SpawnReason getReason() { + return this.reason; + } @@ -96,7 +94,7 @@ index 0000000000000000000000000000000000000000..633ef4dcc701916f2dbfefbbebd5994f + * + * @param shouldAbortSpawn Set if the spawn process should be aborted vs trying more attempts + */ -+ public void setShouldAbortSpawn(boolean shouldAbortSpawn) { ++ public void setShouldAbortSpawn(final boolean shouldAbortSpawn) { + this.shouldAbortSpawn = shouldAbortSpawn; + } + @@ -114,17 +112,15 @@ index 0000000000000000000000000000000000000000..633ef4dcc701916f2dbfefbbebd5994f + * @param cancel {@code true} if you wish to cancel this event, and abort the spawn of this creature + */ + @Override -+ public void setCancelled(boolean cancel) { ++ public void setCancelled(final boolean cancel) { + this.cancelled = cancel; + } + -+ @NotNull + @Override + public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ @NotNull + public static HandlerList getHandlerList() { + return HANDLER_LIST; + } |