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

@ -6,10 +6,10 @@ Subject: [PATCH] Add ShulkerDuplicateEvent
diff --git a/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java b/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..88d8278e49f1bb32e97ee551d8ad31d4a59534e2
index 0000000000000000000000000000000000000000..d427a67a5c7e44aee78d21a7b344b8bb19235dc7
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java
@@ -0,0 +1,71 @@
@@ -0,0 +1,68 @@
+package io.papermc.paper.event.entity;
+
+import org.bukkit.entity.Shulker;
@ -17,13 +17,14 @@ index 0000000000000000000000000000000000000000..88d8278e49f1bb32e97ee551d8ad31d4
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Fired when a shulker duplicates itself by spawning a new shulker.
+ * <p>
+ * The event is fired prior to the newly created shulker, accessible via {@link #getEntity()}, being added to the world.
+ */
+@NullMarked
+public class ShulkerDuplicateEvent extends EntityEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
@ -32,7 +33,7 @@ index 0000000000000000000000000000000000000000..88d8278e49f1bb32e97ee551d8ad31d4
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public ShulkerDuplicateEvent(@NotNull Shulker child, @NotNull Shulker parent) {
+ public ShulkerDuplicateEvent(final Shulker child, final Shulker parent) {
+ super(child);
+ this.parent = parent;
+ }
@ -44,7 +45,6 @@ index 0000000000000000000000000000000000000000..88d8278e49f1bb32e97ee551d8ad31d4
+ * @return the newly duplicated shulker.
+ */
+ @Override
+ @NotNull
+ public Shulker getEntity() {
+ return (Shulker) super.getEntity();
+ }
@ -55,7 +55,6 @@ index 0000000000000000000000000000000000000000..88d8278e49f1bb32e97ee551d8ad31d4
+ *
+ * @return the previously existing shulker which duplicated.
+ */
+ @NotNull
+ public Shulker getParent() {
+ return this.parent;
+ }
@ -66,17 +65,15 @@ index 0000000000000000000000000000000000000000..88d8278e49f1bb32e97ee551d8ad31d4
+ }
+
+ @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;
+ }