API breakage: `Player#loadData()` doesn't load player's world info
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Expected behavior
org.bukkit.entity.Player#loadData() loads the current location, including world info, like it does on the upstream.
Observed/Actual behavior
org.bukkit.entity.Player#loadData() loads the current location without world info, unlike it does on the upstream.
Steps/models to reproduce
Player#loadData() results in Entity#load(CompoundTag) call on that player's ServerPlayer instance, which loads the world info on Paper until 1.20.2 build 272 and on Spigot.
Paper moves the world info loading from Entity#load(CompoundTag) to PlayerList#placeNewPlayer(Connection, ServerPlayer, CommonListenerCookie) since 1.20.2 build 272: https://github.com/PaperMC/Paper/blob/d348cb88a9fe8d19e46102c8b9febe18f746d46b/patches/server/0343-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch (the patch was initially included in 1.15.2 build 202 but did not contain the breaking change initially), so Entity#load(CompoundTag) and, therefore, Player#loadData() in the API no longer load information about the player's world, even though the javadoc states that it should (since API Location includes World) and it does on the upstream.
Plugin and Datapack List
No datapacks. Investigated and identified the issue by comparing relevant Paper and Spigot code. Initially discovered as https://github.com/Jannyboy11/InvSee-plus-plus/issues/105
Paper version
> version
[01:20:05 INFO]: Checking version, please wait...
[01:20:05 INFO]: This server is running Paper version 1.21.1-131-ver/1.21.1@84281ce (2024-10-31T17:43:44Z) (Implementing API version 1.21.1-R0.1-SNAPSHOT)
You are running the latest version
Based on the relevant patch, this should still be an issue on Paper 1.21.3 build 11 (latest 1.21.3 build at the time of writing)
Other
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing org.bukkit.entity.Player#loadData() through Entity#load(CompoundTag), then compare the behavior with PlayerList#placeNewPlayer(Connection, ServerPlayer, CommonListenerCookie). Read patches/server/0343-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch and the linked upstream changes. Done means loadData() restores the player's current location including its world, matching the API javadoc and upstream behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100