Finish converting all events to jspecify annotations

This commit is contained in:
Jake Potrebic
2024-09-29 16:48:34 -07:00
parent fa97c59a4e
commit 29a25df60e
78 changed files with 757 additions and 883 deletions

View File

@@ -19,12 +19,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+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..00000000000000000000000000000000
+ 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..00000000000000000000000000000000
+ *
+ * @return the {@link ItemFrame}
+ */
+ @NotNull
+ public ItemFrame getItemFrame() {
+ return this.itemFrame;
+ }
@@ -62,7 +61,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the {@link ItemStack} being added, rotated, or removed
+ */
+ @NotNull
+ public ItemStack getItemStack() {
+ return this.itemStack;
+ }
@@ -73,7 +71,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @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..00000000000000000000000000000000
+ *
+ * @return action performed on the item frame in this event
+ */
+ @NotNull
+ public ItemFrameChangeAction getAction() {
+ return this.action;
+ }
@@ -93,17 +90,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @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;
+ }