Begin switching to JSpecify annotations (#11448)

* Begin switching to JSpecify annotations

* more

* fixes
This commit is contained in:
Jake Potrebic 2024-09-29 12:52:13 -07:00 committed by GitHub
parent 6d7a438fad
commit f9c7f2a5c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 750 additions and 920 deletions

View file

@ -12,7 +12,7 @@ Dropped as it does not apply due to the earlier PreCreatureSpawnEvent patch not
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..2910f0bf929d918c86510f29d9361bbc19411256
index 0000000000000000000000000000000000000000..679b37056be9515c69922285affbf0301f5335e3
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
@@ -0,0 +1,29 @@
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..2910f0bf929d918c86510f29d9361bbc
+import org.bukkit.entity.EntityType;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Called before an entity is spawned into a world by a spawner.
@ -30,17 +30,17 @@ index 0000000000000000000000000000000000000000..2910f0bf929d918c86510f29d9361bbc
+ * This only includes the spawner's location and not the full BlockState snapshot for performance reasons.
+ * If you really need it you have to get the spawner yourself.
+ */
+@NullMarked
+public class PreSpawnerSpawnEvent extends PreCreatureSpawnEvent {
+
+ @NotNull private final Location spawnerLocation;
+ private final Location spawnerLocation;
+
+ @ApiStatus.Internal
+ public PreSpawnerSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull Location spawnerLocation) {
+ public PreSpawnerSpawnEvent(final Location location, final EntityType type, final Location spawnerLocation) {
+ super(location, type, CreatureSpawnEvent.SpawnReason.SPAWNER);
+ this.spawnerLocation = spawnerLocation;
+ }
+
+ @NotNull
+ public Location getSpawnerLocation() {
+ return this.spawnerLocation.clone();
+ }