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

@ -6,10 +6,10 @@ Subject: [PATCH] Added PlayerChangeBeaconEffectEvent
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..1cc5dfb6d31f312f07acb1d5fb4719d6f4c2c4ff
index 0000000000000000000000000000000000000000..580f01754ce082c926240b9bf4842cde1320f987
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java
@@ -0,0 +1,137 @@
@@ -0,0 +1,136 @@
+package io.papermc.paper.event.player;
+
+import org.bukkit.block.Block;
@ -19,25 +19,26 @@ index 0000000000000000000000000000000000000000..1cc5dfb6d31f312f07acb1d5fb4719d6
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.potion.PotionEffectType;
+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;
+
+/**
+ * Called when a player sets the effect for a beacon
+ */
+@NullMarked
+public class PlayerChangeBeaconEffectEvent extends PlayerEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final Block beacon;
+ private PotionEffectType primary;
+ private PotionEffectType secondary;
+ private @Nullable PotionEffectType primary;
+ private @Nullable PotionEffectType secondary;
+ private boolean consumeItem = true;
+
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public PlayerChangeBeaconEffectEvent(@NotNull Player player, @Nullable PotionEffectType primary, @Nullable PotionEffectType secondary, @NotNull Block beacon) {
+ public PlayerChangeBeaconEffectEvent(final Player player, final @Nullable PotionEffectType primary, final @Nullable PotionEffectType secondary, final Block beacon) {
+ super(player);
+ this.primary = primary;
+ this.secondary = secondary;
@ -47,7 +48,7 @@ index 0000000000000000000000000000000000000000..1cc5dfb6d31f312f07acb1d5fb4719d6
+ /**
+ * @return the primary effect
+ */
+ @Nullable public PotionEffectType getPrimary() {
+ public @Nullable PotionEffectType getPrimary() {
+ return this.primary;
+ }
+
@ -58,14 +59,14 @@ index 0000000000000000000000000000000000000000..1cc5dfb6d31f312f07acb1d5fb4719d6
+ *
+ * @param primary the primary effect
+ */
+ public void setPrimary(@Nullable PotionEffectType primary) {
+ public void setPrimary(final @Nullable PotionEffectType primary) {
+ this.primary = primary;
+ }
+
+ /**
+ * @return the secondary effect
+ */
+ @Nullable public PotionEffectType getSecondary() {
+ public @Nullable PotionEffectType getSecondary() {
+ return this.secondary;
+ }
+
@ -77,14 +78,13 @@ index 0000000000000000000000000000000000000000..1cc5dfb6d31f312f07acb1d5fb4719d6
+ *
+ * @param secondary the secondary effect
+ */
+ public void setSecondary(@Nullable PotionEffectType secondary) {
+ public void setSecondary(final @Nullable PotionEffectType secondary) {
+ this.secondary = secondary;
+ }
+
+ /**
+ * @return the beacon block associated with this event
+ */
+ @NotNull
+ public Block getBeacon() {
+ return this.beacon;
+ }
@ -109,7 +109,7 @@ index 0000000000000000000000000000000000000000..1cc5dfb6d31f312f07acb1d5fb4719d6
+ *
+ * @param consumeItem {@code true} if item should be consumed
+ */
+ public void setConsumeItem(boolean consumeItem) {
+ public void setConsumeItem(final boolean consumeItem) {
+ this.consumeItem = consumeItem;
+ }
+
@ -133,16 +133,15 @@ index 0000000000000000000000000000000000000000..1cc5dfb6d31f312f07acb1d5fb4719d6
+ * or saved.
+ */
+ @Override
+ public void setCancelled(boolean cancel) {
+ public void setCancelled(final boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @Override
+ public @NotNull HandlerList getHandlers() {
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }