Paper
Paper copied to clipboard
Allow getting offline player's PDC
Is your feature request related to a problem?
I want to be able to get a player's PDC container, offline or online.
Describe the solution you'd like.
either Bukkit.getPDC(String username); or Bukkit.getPDC(UUID playerUUID);
Describe alternatives you've considered.
Machine Maker: you'd have to manually load the player data nbt file and search for it yourself
Other
No response
is there any updates on this feature?
Can I try and implement this feature ? I never contributed to Paper so it would be a first for me.
You’re more than welcome to!
Nice thank you I will be looking at this during the weekend then :)
sure go ahead but the most important part is when do you save the data. on every set? or periodically and need to have a system for that
Well I do not know yet, this is what I will try to figure out
So I was looking at where to implement this and was thinking of maybe another way to put it.
Instead of doing either Bukkit.getPDC(String username); or Bukkit.getPDC(UUID playerUUID); maybe use the OfflinePlayer interface, even though I still have no idea on how to save the data once changed.
I think I don't know enough of the Paper codebase to implement this, I have spent multiple hours already looking at this and I find no way to do it. I think I will just look at other issues, sorry :/
I was not aware that someone has already implemented this so I also implemented it but with a different approach of saving the containers alongside saving players to avoid many saves. @Lulu13022002 the problem right now is how do you deal with offline players who never played on the server, wouldn't saving their dat file before them ever joining become a problem when they do? this is the only current problem on hand for me
No normally the latest commit fixed that, and in my test that would just create the new file (see: https://github.com/PaperMC/Paper/pull/8117/commits/0388bda656aa55ac2ae672db4f66fe823a1251e9#diff-b3293e7f7cf1058b47281ab025cdeebbedbb2b0e384bb72df32ee57bf519ee5fR64-R66). The real problem is https://github.com/PaperMC/Paper/pull/5529#issuecomment-830155819. And i think the plugins should save themselves the data in an autocloseable or using manually the close method when they needs.
nvm i have understand your message in the wrong way. Thanks for the test. I have found two bugs:
- [Server thread/ERROR]: Not a string caused by legacy support for some old nbt when the tag exists but no world is found
- The player spawn at 0 0 0 and ignore the world spawn when the tag is almost empty (except the PDC) the tag is fully read and some value fallback to zero or their default value I have fixed that in the latest "real" commit. Can you retest that to be sure