[SPIGOT-6081] Fetch the current Bed/respawn anchor location of a player. Created: 16/Aug/20  Updated: 15/Dec/20

Status: Open
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: RyanTheLeach Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None

Version: CraftBukkit version git-Spigot-379750e-82542d0 (MC: 1.16.2) (Implementing API version 1.16.2-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

It's currently impossible to get the block responsible for a players current spawn anchoring, that if broken would break their spawn.

This is useful when creating plugins that interact with the respawn system, such as EdGruberman's sleep, whose only remaining nms dependence is getting the actual bed anchor block.

https://github.com/EdGruberman/Sleep/tree/master/src/edgruberman/bukkit/sleep/craftbukkit

You can get the expected spawn location using the current API, which is not the current anchor, and workarounds by searching for the anchor can lead to issues when multiple beds/anchors are nearby.



 Comments   
Comment by Jamie Hsieh [ 15/Dec/20 ]

This is an extremely needed feature for Spigot. I'm currently working on a project where the player needs to switch spawn points constantly and go back to a spawn point they had set previously, but it keeps on grabbing the wrong location for a bed. It's also not compatible for respawn anchors. Workarounds are not ideal and can grab wrong information. I agree with the PlayerSetSpawn event suggestion. 

Another idea would be to make Respawn Anchors compatible with PlayerEnterBed.

Comment by Airtheon Thesalion [ 02/Nov/20 ]

Just getting the block would be a bit of a niche use-case. However, a PlayerSetSpawn event of some kind would be a nice addition.

Currently, you can use the PlayerEnterBed event to check when players set their spawn at a bed. You could save the information about this block persistently to the player's NBT data and update it when necessary.

However, for anchors, there is no such event to listen to. So a solution would be to create some kind of PlayerSetSpawn event, and both PlayerEnterBed and some kind of PlayerUseAnchor event would extend this event.

Generated at Wed Apr 02 10:57:48 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.