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

@@ -42,21 +42,22 @@ 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 a player is firing a bow and the server is choosing an arrow to use.
+ */
+@NullMarked
+public class PlayerReadyArrowEvent extends PlayerEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final ItemStack bow;
+ @NotNull private final ItemStack arrow;
+ private final ItemStack bow;
+ private final ItemStack arrow;
+
+ private boolean cancelled;
+
+ public PlayerReadyArrowEvent(@NotNull Player player, @NotNull ItemStack bow, @NotNull ItemStack arrow) {
+ public PlayerReadyArrowEvent(final Player player, final ItemStack bow, final ItemStack arrow) {
+ super(player);
+ this.bow = bow;
+ this.arrow = arrow;
@@ -65,7 +66,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * @return the player is using to fire the arrow
+ */
+ @NotNull
+ public ItemStack getBow() {
+ return this.bow;
+ }
@@ -73,7 +73,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * @return the arrow that is attempting to be used
+ */
+ @NotNull
+ public ItemStack getArrow() {
+ return this.arrow;
+ }
@@ -92,16 +91,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Cancel use of this arrow. On cancel, the server will try the next arrow available and fire another event.
+ */
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = 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;
+ }