Finish converting all events to jspecify annotations

This commit is contained in:
Jake Potrebic 2024-09-29 16:48:34 -07:00
parent ea00be3aaa
commit ba3c29b92e
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
82 changed files with 977 additions and 1103 deletions

View file

@ -17,10 +17,10 @@ the cooldown event.
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..25c13b01c5630a6de30058532458d779763e4e42
index 0000000000000000000000000000000000000000..aa2fb7923b121cda547291d14cff60895361a4dd
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
@@ -0,0 +1,92 @@
@@ -0,0 +1,90 @@
+package io.papermc.paper.event.player;
+
+import com.google.common.base.Preconditions;
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..25c13b01c5630a6de30058532458d779
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Called whenever a players shield is disabled due to an attack from another entity that was capable of disabling the
@ -41,6 +41,7 @@ index 0000000000000000000000000000000000000000..25c13b01c5630a6de30058532458d779
+ * It follows that, if this event is cancelled, no {@link PlayerItemCooldownEvent} is called as the shield is never
+ * disabled in the first place.
+ */
+@NullMarked
+public class PlayerShieldDisableEvent extends PlayerEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
@ -51,7 +52,7 @@ index 0000000000000000000000000000000000000000..25c13b01c5630a6de30058532458d779
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public PlayerShieldDisableEvent(@NotNull final Player player, @NotNull final Entity damager, final int cooldown) {
+ public PlayerShieldDisableEvent(final Player player, final Entity damager, final int cooldown) {
+ super(player);
+ this.damager = damager;
+ this.cooldown = cooldown;
@ -62,7 +63,6 @@ index 0000000000000000000000000000000000000000..25c13b01c5630a6de30058532458d779
+ *
+ * @return the entity instance that damaged the player in a way that caused the shield to be disabled.
+ */
+ @NotNull
+ public Entity getDamager() {
+ return this.damager;
+ }
@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..25c13b01c5630a6de30058532458d779
+ *
+ * @param cooldown cooldown in ticks, has to be a positive number
+ */
+ public void setCooldown(int cooldown) {
+ public void setCooldown(final int cooldown) {
+ Preconditions.checkArgument(cooldown >= 0, "The cooldown has to be equal to or greater than 0!");
+ this.cooldown = cooldown;
+ }
@ -102,13 +102,11 @@ index 0000000000000000000000000000000000000000..25c13b01c5630a6de30058532458d779
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }