#966: Introduce getRespawnLocation as a replacement for getBedSpawnLocation

By: Nothixal <nothixal@gmail.com>
This commit is contained in:
Bukkit/Spigot
2024-01-22 20:27:07 +11:00
parent e0cee662c2
commit f11f3d9479
2 changed files with 55 additions and 0 deletions

View File

@@ -171,10 +171,24 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* they have not slept in one or their current bed spawn is invalid. * they have not slept in one or their current bed spawn is invalid.
* *
* @return Bed Spawn Location if bed exists, otherwise null. * @return Bed Spawn Location if bed exists, otherwise null.
*
* @see #getRespawnLocation()
* @deprecated Misleading name. This method also returns the location of
* respawn anchors.
*/ */
@Nullable @Nullable
@Deprecated
public Location getBedSpawnLocation(); public Location getBedSpawnLocation();
/**
* Gets the Location where the player will spawn at, null if they
* don't have a valid respawn point.
*
* @return respawn location if exists, otherwise null.
*/
@Nullable
public Location getRespawnLocation();
/** /**
* Increments the given statistic for this player. * Increments the given statistic for this player.
* <p> * <p>

View File

@@ -370,27 +370,68 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* they have not slept in one or their current bed spawn is invalid. * they have not slept in one or their current bed spawn is invalid.
* *
* @return Bed Spawn Location if bed exists, otherwise null. * @return Bed Spawn Location if bed exists, otherwise null.
*
* @see #getRespawnLocation()
* @deprecated Misleading name. This method also returns the location of
* respawn anchors.
*/ */
@Nullable @Nullable
@Override @Override
@Deprecated
public Location getBedSpawnLocation(); public Location getBedSpawnLocation();
/**
* Gets the Location where the player will spawn at, null if they
* don't have a valid respawn point.
*
* @return respawn location if exists, otherwise null.
*/
@Nullable
@Override
public Location getRespawnLocation();
/** /**
* Sets the Location where the player will spawn at their bed. * Sets the Location where the player will spawn at their bed.
* *
* @param location where to set the respawn location * @param location where to set the respawn location
*
* @see #setRespawnLocation(Location)
* @deprecated Misleading name. This method sets the player's respawn
* location more generally and is not limited to beds.
*/ */
@Deprecated
public void setBedSpawnLocation(@Nullable Location location); public void setBedSpawnLocation(@Nullable Location location);
/**
* Sets the Location where the player will respawn.
*
* @param location where to set the respawn location
*/
public void setRespawnLocation(@Nullable Location location);
/** /**
* Sets the Location where the player will spawn at their bed. * Sets the Location where the player will spawn at their bed.
* *
* @param location where to set the respawn location * @param location where to set the respawn location
* @param force whether to forcefully set the respawn location even if a * @param force whether to forcefully set the respawn location even if a
* valid bed is not present * valid bed is not present
*
* @see #setRespawnLocation(Location, boolean)
* @deprecated Misleading name. This method sets the player's respawn
* location more generally and is not limited to beds.
*/ */
@Deprecated
public void setBedSpawnLocation(@Nullable Location location, boolean force); public void setBedSpawnLocation(@Nullable Location location, boolean force);
/**
* Sets the Location where the player will respawn.
*
* @param location where to set the respawn location
* @param force whether to forcefully set the respawn location even if a
* valid respawn point is not present
*/
public void setRespawnLocation(@Nullable Location location, boolean force);
/** /**
* Play a note for the player at a location. <br> * Play a note for the player at a location. <br>
* This <i>will</i> work with cake. * This <i>will</i> work with cake.