[ci skip] Cleanup events (#10202)

This commit is contained in:
Lulu13022002
2024-02-01 10:15:57 +01:00
parent d676979ea0
commit f7e469eb2e
187 changed files with 2415 additions and 2258 deletions

View File

@@ -18,11 +18,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.event.Cancellable;
+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;
+
+/**
+ * Called when a player's spawn is set, either by themselves or otherwise.<br>
+ * Called when a player's spawn is set, either by themselves or otherwise.
+ * <br>
+ * Cancelling this event will prevent the spawn from being set.
+ */
+public class PlayerSetSpawnEvent extends PlayerEvent implements Cancellable {
@@ -37,8 +39,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ private boolean cancelled;
+
+ public PlayerSetSpawnEvent(@NotNull Player who, @NotNull Cause cause, @Nullable Location location, boolean forced, boolean notifyPlayer, @Nullable Component notification) {
+ super(who);
+ @ApiStatus.Internal
+ public PlayerSetSpawnEvent(@NotNull Player player, @NotNull Cause cause, @Nullable Location location, boolean forced, boolean notifyPlayer, @Nullable Component notification) {
+ super(player);
+ this.cause = cause;
+ this.location = location;
+ this.forced = forced;
@@ -53,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @NotNull
+ public Cause getCause() {
+ return cause;
+ return this.cause;
+ }
+
+ /**
@@ -62,18 +65,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * will change the resulting spawn point of the player. Use
+ * {@link Location#clone()} to get a copy of this location.
+ *
+ * @return the spawn location, or null if removing the location
+ * @return the spawn location, or {@code null} if removing the location
+ */
+ @Nullable
+ public Location getLocation() {
+ return location;
+ return this.location;
+ }
+
+ /**
+ * Sets the location to be set as the spawn location. The yaw
+ * of this location is the spawn angle.
+ *
+ * @param location the spawn location, or null to remove the spawn location
+ * @param location the spawn location, or {@code null} to remove the spawn location
+ */
+ public void setLocation(@Nullable Location location) {
+ this.location = location;
@@ -82,16 +85,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Gets if this is a force spawn location
+ *
+ * @return true if forced
+ * @return {@code true} if forced
+ */
+ public boolean isForced() {
+ return forced;
+ return this.forced;
+ }
+
+ /**
+ * Sets if this is a forced spawn location
+ *
+ * @param forced true to force
+ * @param forced {@code true} to force
+ */
+ public void setForced(boolean forced) {
+ this.forced = forced;
@@ -101,17 +104,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Gets if this action will notify the player their spawn
+ * has been set.
+ *
+ * @return true to notify
+ * @return {@code true} to notify
+ */
+ public boolean willNotifyPlayer() {
+ return notifyPlayer;
+ return this.notifyPlayer;
+ }
+
+ /**
+ * Sets if this action will notify the player that their spawn
+ * has been set.
+ *
+ * @param notifyPlayer true to notify
+ * @param notifyPlayer {@code true} to notify
+ */
+ public void setNotifyPlayer(boolean notifyPlayer) {
+ this.notifyPlayer = notifyPlayer;
@@ -121,17 +124,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Gets the notification message that will be sent to the player
+ * if {@link #willNotifyPlayer()} returns true.
+ *
+ * @return null if no notification
+ * @return {@code null} if no notification
+ */
+ @Nullable
+ public Component getNotification() {
+ return notification;
+ return this.notification;
+ }
+
+ /**
+ * Sets the notification message that will be sent to the player.
+ *
+ * @param notification null to send no message
+ * @param notification {@code null} to send no message
+ */
+ public void setNotification(@Nullable Component notification) {
+ this.notification = notification;
@@ -175,8 +178,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ COMMAND,
+ /**
+ * When a plugin uses {@link Player#setBedSpawnLocation(Location)} or
+ * {@link Player#setBedSpawnLocation(Location, boolean)}.
+ * When a plugin uses {@link Player#setRespawnLocation(Location)} or
+ * {@link Player#setRespawnLocation(Location, boolean)}.
+ */
+ PLUGIN,
+ /**