Finish converting all events to jspecify annotations

This commit is contained in:
Jake Potrebic 2024-09-29 16:48:34 -07:00
parent ea00be3aaa
commit ba3c29b92e
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
82 changed files with 977 additions and 1103 deletions

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerItemFrameChangeEvent
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..7bd61b66db42ecc8c9a3a16f563552414488079e
index 0000000000000000000000000000000000000000..f387477da45a44cc7788ed5342104f535cf3cb98
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java
@@ -0,0 +1,104 @@
@@ -0,0 +1,99 @@
+package io.papermc.paper.event.player;
+
+import org.bukkit.entity.ItemFrame;
@ -19,12 +19,13 @@ index 0000000000000000000000000000000000000000..7bd61b66db42ecc8c9a3a16f56355241
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jspecify.annotations.NullMarked;
+import org.jspecify.annotations.Nullable;
+
+/**
+ * Called when an {@link ItemFrame} is having an item rotated, added, or removed from it.
+ */
+@NullMarked
+public class PlayerItemFrameChangeEvent extends PlayerEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
@ -36,8 +37,7 @@ index 0000000000000000000000000000000000000000..7bd61b66db42ecc8c9a3a16f56355241
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public PlayerItemFrameChangeEvent(@NotNull Player player, @NotNull ItemFrame itemFrame,
+ @NotNull ItemStack itemStack, @NotNull ItemFrameChangeAction action) {
+ public PlayerItemFrameChangeEvent(final Player player, final ItemFrame itemFrame, final ItemStack itemStack, final ItemFrameChangeAction action) {
+ super(player);
+ this.itemFrame = itemFrame;
+ this.itemStack = itemStack;
@ -49,7 +49,6 @@ index 0000000000000000000000000000000000000000..7bd61b66db42ecc8c9a3a16f56355241
+ *
+ * @return the {@link ItemFrame}
+ */
+ @NotNull
+ public ItemFrame getItemFrame() {
+ return this.itemFrame;
+ }
@ -62,7 +61,6 @@ index 0000000000000000000000000000000000000000..7bd61b66db42ecc8c9a3a16f56355241
+ *
+ * @return the {@link ItemStack} being added, rotated, or removed
+ */
+ @NotNull
+ public ItemStack getItemStack() {
+ return this.itemStack;
+ }
@ -73,7 +71,7 @@ index 0000000000000000000000000000000000000000..7bd61b66db42ecc8c9a3a16f56355241
+ *
+ * @param itemStack {@link ItemFrame} item
+ */
+ public void setItemStack(@Nullable ItemStack itemStack) {
+ public void setItemStack(final @Nullable ItemStack itemStack) {
+ this.itemStack = itemStack == null ? ItemStack.empty() : itemStack;
+ }
+
@ -82,7 +80,6 @@ index 0000000000000000000000000000000000000000..7bd61b66db42ecc8c9a3a16f56355241
+ *
+ * @return action performed on the item frame in this event
+ */
+ @NotNull
+ public ItemFrameChangeAction getAction() {
+ return this.action;
+ }
@ -93,17 +90,15 @@ index 0000000000000000000000000000000000000000..7bd61b66db42ecc8c9a3a16f56355241
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ public void setCancelled(final boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }