Some question of concept need help

Hi, everyone, i am learning and develop sponge plugin now, I create a PlayerContext instance when playerLogin, and store it to a map<uuid,playerContext>, PlayerContext Including gold,kill_count and other field ,I don’t know if that’s standard practice, so, today, i read custom data api from intro docs, I try to understand them ,but fail. I’ll put it down here, I hope someone can help me understand it, should i custom it? why should i custom it? i am very thanks for you.
what is DataQuery?

There are two standard. The first is a wrapper which is the standard for bukkit plugins. This is where you create your own Player class and have your player class linked to the Bukkit (or Sponge) player class. Which is essentially what your currently doing.
The issue with this is if im another plugin wanting to access and modify any and all data about a player then I need to be specific designed to read from your plugin. If you take a look at my plugin called Entity Disguise, it has a feature like this built in, admittedly its for all non-player entities but it is plausible for a plugin to want to do that.

There is then Sponge’s custom data standard which directly injects your custom data into the players NBT (or something like that) which means that it is so much simpler to serialize (save) as you don’t need a config file (you can have one if you want) and as mentioned above, plugins can see your data which gives the players on the server more control over there own server.

As for understanding it, i struggled too, mainly because when i read it it was out of date (i have not checked to see if it is now in date anymore) so I learn from other peoples code. Specifically a example PieFlavor uploaded to his git, ill provide a link below. You can also see Entity Disguise and see how that one uses it as once i understood it, i made a few tweaks.

Entity Disguise Data Folder: EntityDisguise/main/java/org/entitydisguise/entitydisguiseplugin/disguise/data at master · mosemister/EntityDisguise · GitHub

I would recommend looking at the Settings package.

Here is PieFlavor’s example:

thanks a lot, Let me use wrappers before I get too familiar with the data API

By all means. I would personally recommend it that way, get used to sponge’s main functionality before dealing with the more advanced features

thank you :kissing_heart: