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

@@ -19,25 +19,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+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..00000000000000000000000000000000
+ /**
+ * @return the primary effect
+ */
+ @Nullable public PotionEffectType getPrimary() {
+ public @Nullable PotionEffectType getPrimary() {
+ return this.primary;
+ }
+
@@ -58,14 +59,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @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..00000000000000000000000000000000
+ *
+ * @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..00000000000000000000000000000000
+ *
+ * @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..00000000000000000000000000000000
+ * 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;
+ }