Parity for respawn events (#11792)

This commit is contained in:
Lulu13022002
2025-04-30 20:04:24 +02:00
committed by GitHub
parent 2754d7c3b9
commit 567f63ae34
7 changed files with 149 additions and 129 deletions

View File

@@ -1,9 +1,10 @@
package com.destroystokyo.paper.event.player;
import io.papermc.paper.event.player.AbstractRespawnEvent;
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.ApiStatus;
import org.jspecify.annotations.NullMarked;
@@ -11,36 +12,31 @@ import org.jspecify.annotations.NullMarked;
* Fired after a player has respawned
*/
@NullMarked
public class PlayerPostRespawnEvent extends PlayerEvent {
public class PlayerPostRespawnEvent extends AbstractRespawnEvent {
private static final HandlerList HANDLER_LIST = new HandlerList();
private final Location respawnedLocation;
private final boolean isBedSpawn;
@ApiStatus.Internal
public PlayerPostRespawnEvent(final Player respawnPlayer, final Location respawnedLocation, final boolean isBedSpawn) {
super(respawnPlayer);
this.respawnedLocation = respawnedLocation;
this.isBedSpawn = isBedSpawn;
public PlayerPostRespawnEvent(
final Player respawnPlayer,
final Location respawnLocation,
final boolean isBedSpawn,
final boolean isAnchorSpawn,
final boolean missingRespawnBlock,
final PlayerRespawnEvent.RespawnReason respawnReason
) {
super(respawnPlayer, respawnLocation, isBedSpawn, isAnchorSpawn, missingRespawnBlock, respawnReason);
}
/**
* Returns the location of the respawned player
* Returns the location of the respawned player.
*
* @return location of the respawned player
* @see #getRespawnLocation()
*/
@ApiStatus.Obsolete
public Location getRespawnedLocation() {
return this.respawnedLocation.clone();
}
/**
* Checks if the player respawned to their bed
*
* @return whether the player respawned to their bed
*/
public boolean isBedSpawn() {
return this.isBedSpawn;
return super.getRespawnLocation();
}
@Override