Begin switching to JSpecify annotations (#11448)

* Begin switching to JSpecify annotations

* more

* fixes
This commit is contained in:
Jake Potrebic 2024-09-29 12:52:13 -07:00 committed by GitHub
parent 6d7a438fad
commit f9c7f2a5c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 750 additions and 920 deletions

View file

@ -7,10 +7,10 @@ Fired when a witch throws a potion at a player
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..f1d546a3576a170ecb3608e07befa0f621ea043a
index 0000000000000000000000000000000000000000..02395582b680f4baa3dc2251a8a79f41241b96ec
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
@@ -0,0 +1,85 @@
@@ -0,0 +1,81 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.LivingEntity;
@ -20,28 +20,28 @@ index 0000000000000000000000000000000000000000..f1d546a3576a170ecb3608e07befa0f6
+import org.bukkit.event.entity.EntityEvent;
+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;
+
+/**
+ * Fired when a witch throws a potion at a player
+ */
+@NullMarked
+public class WitchThrowPotionEvent extends EntityEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final LivingEntity target;
+ @Nullable private ItemStack potion;
+ private final LivingEntity target;
+ private @Nullable ItemStack potion;
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public WitchThrowPotionEvent(@NotNull Witch witch, @NotNull LivingEntity target, @Nullable ItemStack potion) {
+ public WitchThrowPotionEvent(final Witch witch, final LivingEntity target, final @Nullable ItemStack potion) {
+ super(witch);
+ this.target = target;
+ this.potion = potion;
+ }
+
+ @NotNull
+ @Override
+ public Witch getEntity() {
+ return (Witch) super.getEntity();
@ -50,7 +50,6 @@ index 0000000000000000000000000000000000000000..f1d546a3576a170ecb3608e07befa0f6
+ /**
+ * @return The target of the potion
+ */
+ @NotNull
+ public LivingEntity getTarget() {
+ return this.target;
+ }
@ -58,8 +57,7 @@ index 0000000000000000000000000000000000000000..f1d546a3576a170ecb3608e07befa0f6
+ /**
+ * @return The potion the witch will throw at a player
+ */
+ @Nullable
+ public ItemStack getPotion() {
+ public @Nullable ItemStack getPotion() {
+ return this.potion;
+ }
+
@ -68,7 +66,7 @@ index 0000000000000000000000000000000000000000..f1d546a3576a170ecb3608e07befa0f6
+ *
+ * @param potion The potion
+ */
+ public void setPotion(@Nullable ItemStack potion) {
+ public void setPotion(final @Nullable ItemStack potion) {
+ this.potion = potion != null ? potion.clone() : null;
+ }
+
@ -81,17 +79,15 @@ index 0000000000000000000000000000000000000000..f1d546a3576a170ecb3608e07befa0f6
+ }
+
+ @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;
+ }