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

@@ -16,20 +16,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Called when the server detects a player stopping using an item.
+ * Examples of this are letting go of the interact button when holding a bow, an edible item, or a spyglass.
+ */
+@NullMarked
+public class PlayerStopUsingItemEvent extends PlayerEvent {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final ItemStack item;
+ private final ItemStack item;
+ private final int ticksHeldFor;
+
+ public PlayerStopUsingItemEvent(@NotNull final Player player, @NotNull final ItemStack item, final int ticksHeldFor) {
+ public PlayerStopUsingItemEvent(final Player player, final ItemStack item, final int ticksHeldFor) {
+ super(player);
+ this.item = item;
+ this.ticksHeldFor = ticksHeldFor;
@@ -40,7 +41,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return ItemStack the exact item the player released
+ */
+ @NotNull
+ public ItemStack getItem() {
+ return this.item;
+ }
@@ -54,13 +54,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return this.ticksHeldFor;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }