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,28 +19,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+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's spawn is set, either by themselves or otherwise.
+ * <br>
+ * Cancelling this event will prevent the spawn from being set.
+ */
+@NullMarked
+public class PlayerSetSpawnEvent extends PlayerEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final Cause cause;
+ private Location location;
+ private @Nullable Location location;
+ private boolean forced;
+ private boolean notifyPlayer;
+ private Component notification;
+ private @Nullable Component notification;
+
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public PlayerSetSpawnEvent(@NotNull Player player, @NotNull Cause cause, @Nullable Location location, boolean forced, boolean notifyPlayer, @Nullable Component notification) {
+ public PlayerSetSpawnEvent(final Player player, final Cause cause, final @Nullable Location location, final boolean forced, final boolean notifyPlayer, final @Nullable Component notification) {
+ super(player);
+ this.cause = cause;
+ this.location = location;
@@ -54,7 +55,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the cause
+ */
+ @NotNull
+ public Cause getCause() {
+ return this.cause;
+ }
@@ -67,8 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the spawn location, or {@code null} if removing the location
+ */
+ @Nullable
+ public Location getLocation() {
+ public @Nullable Location getLocation() {
+ return this.location;
+ }
+
@@ -78,7 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @param location the spawn location, or {@code null} to remove the spawn location
+ */
+ public void setLocation(@Nullable Location location) {
+ public void setLocation(final @Nullable Location location) {
+ this.location = location;
+ }
+
@@ -96,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @param forced {@code true} to force
+ */
+ public void setForced(boolean forced) {
+ public void setForced(final boolean forced) {
+ this.forced = forced;
+ }
+
@@ -116,7 +115,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @param notifyPlayer {@code true} to notify
+ */
+ public void setNotifyPlayer(boolean notifyPlayer) {
+ public void setNotifyPlayer(final boolean notifyPlayer) {
+ this.notifyPlayer = notifyPlayer;
+ }
+
@@ -126,8 +125,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return {@code null} if no notification
+ */
+ @Nullable
+ public Component getNotification() {
+ public @Nullable Component getNotification() {
+ return this.notification;
+ }
+
@@ -136,7 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @param notification {@code null} to send no message
+ */
+ public void setNotification(@Nullable Component notification) {
+ public void setNotification(final @Nullable Component notification) {
+ this.notification = notification;
+ }
+
@@ -146,16 +144,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @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;
+ }