diff options
Diffstat (limited to 'patches/api/0305-Add-PlayerSetSpawnEvent.patch')
-rw-r--r-- | patches/api/0305-Add-PlayerSetSpawnEvent.patch | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/patches/api/0305-Add-PlayerSetSpawnEvent.patch b/patches/api/0305-Add-PlayerSetSpawnEvent.patch index 9229c768c6..42bce4d456 100644 --- a/patches/api/0305-Add-PlayerSetSpawnEvent.patch +++ b/patches/api/0305-Add-PlayerSetSpawnEvent.patch @@ -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..c615dbe6ca1289bb090b8e28e98b9ad7b0af8b2a +index 0000000000000000000000000000000000000000..6a823008deaf26f751e598bc967f19c15525acce --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java -@@ -0,0 +1,175 @@ +@@ -0,0 +1,178 @@ +package com.destroystokyo.paper.event.player; + +import net.kyori.adventure.text.Component; @@ -18,11 +18,13 @@ index 0000000000000000000000000000000000000000..c615dbe6ca1289bb090b8e28e98b9ad7 +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..c615dbe6ca1289bb090b8e28e98b9ad7 + + 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..c615dbe6ca1289bb090b8e28e98b9ad7 + */ + @NotNull + public Cause getCause() { -+ return cause; ++ return this.cause; + } + + /** @@ -62,18 +65,18 @@ index 0000000000000000000000000000000000000000..c615dbe6ca1289bb090b8e28e98b9ad7 + * 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..c615dbe6ca1289bb090b8e28e98b9ad7 + /** + * 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..c615dbe6ca1289bb090b8e28e98b9ad7 + * 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..c615dbe6ca1289bb090b8e28e98b9ad7 + * 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..c615dbe6ca1289bb090b8e28e98b9ad7 + */ + 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, + /** |