Finish converting all events to jspecify annotations
This commit is contained in:
parent
ea00be3aaa
commit
ba3c29b92e
82 changed files with 977 additions and 1103 deletions
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerSetSpawnEvent
|
|||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6a823008deaf26f751e598bc967f19c15525acce
|
||||
index 0000000000000000000000000000000000000000..41d42d73cf65e9b8acac9d0b2dfd6537b532be74
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java
|
||||
@@ -0,0 +1,178 @@
|
||||
@@ -0,0 +1,175 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
|
@ -19,28 +19,29 @@ index 0000000000000000000000000000000000000000..6a823008deaf26f751e598bc967f19c1
|
|||
+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..6a823008deaf26f751e598bc967f19c1
|
|||
+ *
|
||||
+ * @return the cause
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Cause getCause() {
|
||||
+ return this.cause;
|
||||
+ }
|
||||
|
@ -67,8 +67,7 @@ index 0000000000000000000000000000000000000000..6a823008deaf26f751e598bc967f19c1
|
|||
+ *
|
||||
+ * @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..6a823008deaf26f751e598bc967f19c1
|
|||
+ *
|
||||
+ * @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..6a823008deaf26f751e598bc967f19c1
|
|||
+ *
|
||||
+ * @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..6a823008deaf26f751e598bc967f19c1
|
|||
+ *
|
||||
+ * @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..6a823008deaf26f751e598bc967f19c1
|
|||
+ *
|
||||
+ * @return {@code null} if no notification
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Component getNotification() {
|
||||
+ public @Nullable Component getNotification() {
|
||||
+ return this.notification;
|
||||
+ }
|
||||
+
|
||||
|
@ -136,7 +134,7 @@ index 0000000000000000000000000000000000000000..6a823008deaf26f751e598bc967f19c1
|
|||
+ *
|
||||
+ * @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..6a823008deaf26f751e598bc967f19c1
|
|||
+ }
|
||||
+
|
||||
+ @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;
|
||||
+ }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue