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

@@ -20,7 +20,7 @@ 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.jspecify.annotations.NullMarked;
+
+/**
+ * Called when a player shoots a projectile.
@@ -29,18 +29,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * of a bow or crossbow. A plugin may listen to {@link EntityShootBowEvent}
+ * for these actions instead.
+ */
+@NullMarked
+public class PlayerLaunchProjectileEvent extends PlayerEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final Projectile projectile;
+ @NotNull private final ItemStack itemStack;
+ private final Projectile projectile;
+ private final ItemStack itemStack;
+ private boolean consumeItem = true;
+
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public PlayerLaunchProjectileEvent(@NotNull Player shooter, @NotNull ItemStack itemStack, @NotNull Projectile projectile) {
+ public PlayerLaunchProjectileEvent(final Player shooter, final ItemStack itemStack, final Projectile projectile) {
+ super(shooter);
+ this.itemStack = itemStack;
+ this.projectile = projectile;
@@ -51,7 +52,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the launched projectile
+ */
+ @NotNull
+ public Projectile getProjectile() {
+ return this.projectile;
+ }
@@ -61,7 +61,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return The ItemStack used
+ */
+ @NotNull
+ public ItemStack getItemStack() {
+ return this.itemStack;
+ }
@@ -80,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @param consumeItem {@code true} to consume
+ */
+ public void setShouldConsume(boolean consumeItem) {
+ public void setShouldConsume(final boolean consumeItem) {
+ this.consumeItem = consumeItem;
+ }
+
@@ -90,17 +89,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @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;
+ }