diff --git a/patches/api/0417-Add-PlayerGetRespawnLocationEvent.patch b/patches/api/0417-Add-PlayerGetRespawnLocationEvent.patch index dc108bc903..287b48c33b 100644 --- a/patches/api/0417-Add-PlayerGetRespawnLocationEvent.patch +++ b/patches/api/0417-Add-PlayerGetRespawnLocationEvent.patch @@ -4,23 +4,25 @@ Date: Mon, 1 May 2023 15:23:34 -0500 Subject: [PATCH] Add PlayerGetRespawnLocationEvent -diff --git a/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerGetRespawnLocationEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerGetRespawnLocationEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..7eca4d6929fc7a75974d182c1ea692d3823a19c0 +index 0000000000000000000000000000000000000000..98e369de90ac2b71363bb0a45bb5baaf14e1cd5a --- /dev/null -+++ b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java -@@ -0,0 +1,53 @@ -+package org.bukkit.event.player; ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerGetRespawnLocationEvent.java +@@ -0,0 +1,55 @@ ++package com.destroystokyo.paper.event.player; + +import org.apache.commons.lang3.Validate; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.bukkit.event.player.PlayerRespawnEvent; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** -+ * Called when a respawn event tries to determine the location of a respawn ++ * Called when a respawn event tries to determine the location of a respawn. This is called before {@link PlayerRespawnEvent} + */ +public class PlayerGetRespawnLocationEvent extends PlayerEvent { + private static final HandlerList handlers = new HandlerList(); diff --git a/patches/server/0977-Add-PlayerGetRespawnLocationEvent.patch b/patches/server/0977-Add-PlayerGetRespawnLocationEvent.patch index c245169fda..84d865befb 100644 --- a/patches/server/0977-Add-PlayerGetRespawnLocationEvent.patch +++ b/patches/server/0977-Add-PlayerGetRespawnLocationEvent.patch @@ -5,9 +5,25 @@ Subject: [PATCH] Add PlayerGetRespawnLocationEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 4d837c1530a3031a4c2a5a39d87bd013d60e14a6..cbbaebc7515da7d630e575abc7f8a9548b4e070b 100644 +index 4d837c1530a3031a4c2a5a39d87bd013d60e14a6..5074e3eeaff73900ec5a48282fa3f2b842a6594c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -1,6 +1,7 @@ + package net.minecraft.server.players; + + import co.aikar.timings.MinecraftTimings; ++import com.destroystokyo.paper.event.player.PlayerGetRespawnLocationEvent; + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import com.google.common.collect.Sets; +@@ -118,7 +119,6 @@ import org.bukkit.Location; + import org.bukkit.craftbukkit.CraftServer; + import org.bukkit.craftbukkit.CraftWorld; + import org.bukkit.craftbukkit.entity.CraftPlayer; +-import org.bukkit.craftbukkit.util.CraftChatMessage; + import org.bukkit.entity.Player; + import org.bukkit.event.player.PlayerChangedWorldEvent; + import org.bukkit.event.player.PlayerJoinEvent; @@ -835,49 +835,57 @@ public abstract class PlayerList { // CraftBukkit start - fire PlayerRespawnEvent @@ -18,7 +34,7 @@ index 4d837c1530a3031a4c2a5a39d87bd013d60e14a6..cbbaebc7515da7d630e575abc7f8a954 - Optional optional; + // Paper start + Player respawnPlayer = entityplayer1.getBukkitEntity(); -+ org.bukkit.event.player.PlayerGetRespawnLocationEvent preRespawnEvent = new org.bukkit.event.player.PlayerGetRespawnLocationEvent(respawnPlayer); ++ PlayerGetRespawnLocationEvent preRespawnEvent = new PlayerGetRespawnLocationEvent(respawnPlayer); + preRespawnEvent.callEvent(); + location = preRespawnEvent.getRespawnLocation();