SPIGOT-5930: Add PlayerRespawnEvent#isAnchorSpawn

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2020-07-03 09:54:12 +10:00
parent c66b18ca72
commit f399ada24d

View File

@ -13,11 +13,18 @@ public class PlayerRespawnEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private Location respawnLocation;
private final boolean isBedSpawn;
private final boolean isAnchorSpawn;
@Deprecated
public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn) {
this(respawnPlayer, respawnLocation, isBedSpawn, false);
}
public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn) {
super(respawnPlayer);
this.respawnLocation = respawnLocation;
this.isBedSpawn = isBedSpawn;
this.isAnchorSpawn = isAnchorSpawn;
}
/**
@ -51,6 +58,15 @@ public class PlayerRespawnEvent extends PlayerEvent {
return this.isBedSpawn;
}
/**
* Gets whether the respawn location is the player's respawn anchor.
*
* @return true if the respawn location is the player's respawn anchor.
*/
public boolean isAnchorSpawn() {
return isAnchorSpawn;
}
@NotNull
@Override
public HandlerList getHandlers() {