From 9f64deb0988e360e131088b02b9ef59006f5a6a9 Mon Sep 17 00:00:00 2001 From: Cryptite Date: Wed, 3 May 2023 11:14:09 -0500 Subject: [PATCH] Rename to PlayerPreRespawnLocationEvent and further clarify what setRespawnLocation does --- ...7-Add-PlayerPreRespawnLocationEvent.patch} | 20 ++++++++++--------- ...7-Add-PlayerPreRespawnLocationEvent.patch} | 6 +++--- 2 files changed, 14 insertions(+), 12 deletions(-) rename patches/api/{0417-Add-PlayerGetRespawnLocationEvent.patch => 0417-Add-PlayerPreRespawnLocationEvent.patch} (67%) rename patches/server/{0977-Add-PlayerGetRespawnLocationEvent.patch => 0977-Add-PlayerPreRespawnLocationEvent.patch} (88%) diff --git a/patches/api/0417-Add-PlayerGetRespawnLocationEvent.patch b/patches/api/0417-Add-PlayerPreRespawnLocationEvent.patch similarity index 67% rename from patches/api/0417-Add-PlayerGetRespawnLocationEvent.patch rename to patches/api/0417-Add-PlayerPreRespawnLocationEvent.patch index 287b48c33b..2b7383cbb5 100644 --- a/patches/api/0417-Add-PlayerGetRespawnLocationEvent.patch +++ b/patches/api/0417-Add-PlayerPreRespawnLocationEvent.patch @@ -1,15 +1,15 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cryptite Date: Mon, 1 May 2023 15:23:34 -0500 -Subject: [PATCH] Add PlayerGetRespawnLocationEvent +Subject: [PATCH] Add PlayerPreRespawnLocationEvent -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerGetRespawnLocationEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerGetRespawnLocationEvent.java +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerPreRespawnLocationEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerPreRespawnLocationEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..98e369de90ac2b71363bb0a45bb5baaf14e1cd5a +index 0000000000000000000000000000000000000000..b321cc19d6ca57050233339ced6c84d9f793f1b6 --- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerGetRespawnLocationEvent.java -@@ -0,0 +1,55 @@ ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerPreRespawnLocationEvent.java +@@ -0,0 +1,57 @@ +package com.destroystokyo.paper.event.player; + +import org.apache.commons.lang3.Validate; @@ -24,11 +24,11 @@ index 0000000000000000000000000000000000000000..98e369de90ac2b71363bb0a45bb5baaf +/** + * Called when a respawn event tries to determine the location of a respawn. This is called before {@link PlayerRespawnEvent} + */ -+public class PlayerGetRespawnLocationEvent extends PlayerEvent { ++public class PlayerPreRespawnLocationEvent extends PlayerEvent { + private static final HandlerList handlers = new HandlerList(); + private Location respawnLocation; + -+ public PlayerGetRespawnLocationEvent(@NotNull final Player respawnPlayer) { ++ public PlayerPreRespawnLocationEvent(@NotNull final Player respawnPlayer) { + super(respawnPlayer); + } + @@ -43,9 +43,11 @@ index 0000000000000000000000000000000000000000..98e369de90ac2b71363bb0a45bb5baaf + } + + /** -+ * Sets the new respawn location ++ * Sets the new respawn location. + * -+ * @param respawnLocation new location for the respawn ++ * @param respawnLocation The exact location for the respawn.
++ * Note: If this is provided, no vanilla logic that calculates "safe" respawn locations will be done. It is up to you to ensure you are ++ * providing a good respawn location for a Player. + */ + public void setRespawnLocation(@NotNull Location respawnLocation) { + Validate.notNull(respawnLocation, "Respawn location can not be null"); diff --git a/patches/server/0977-Add-PlayerGetRespawnLocationEvent.patch b/patches/server/0977-Add-PlayerPreRespawnLocationEvent.patch similarity index 88% rename from patches/server/0977-Add-PlayerGetRespawnLocationEvent.patch rename to patches/server/0977-Add-PlayerPreRespawnLocationEvent.patch index 7519a1e6cf..8715a7f2cf 100644 --- a/patches/server/0977-Add-PlayerGetRespawnLocationEvent.patch +++ b/patches/server/0977-Add-PlayerPreRespawnLocationEvent.patch @@ -1,11 +1,11 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cryptite Date: Mon, 1 May 2023 15:23:34 -0500 -Subject: [PATCH] Add PlayerGetRespawnLocationEvent +Subject: [PATCH] Add PlayerPreRespawnLocationEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 4d837c1530a3031a4c2a5a39d87bd013d60e14a6..3f3d9bb6274ba370cf8e401015e9f0979e398824 100644 +index 4d837c1530a3031a4c2a5a39d87bd013d60e14a6..75e7430fcc2d55575aadbdf2cb0c3969d7b63741 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -835,6 +835,14 @@ public abstract class PlayerList { @@ -14,7 +14,7 @@ index 4d837c1530a3031a4c2a5a39d87bd013d60e14a6..3f3d9bb6274ba370cf8e401015e9f097 if (location == null) { + // Paper start + Player respawnPlayer = entityplayer1.getBukkitEntity(); -+ com.destroystokyo.paper.event.player.PlayerGetRespawnLocationEvent preRespawnEvent = new com.destroystokyo.paper.event.player.PlayerGetRespawnLocationEvent(respawnPlayer); ++ com.destroystokyo.paper.event.player.PlayerPreRespawnLocationEvent preRespawnEvent = new com.destroystokyo.paper.event.player.PlayerPreRespawnLocationEvent(respawnPlayer); + preRespawnEvent.callEvent(); + location = preRespawnEvent.getRespawnLocation(); +