Saving Data
The different ways PrisonPick can store a player's data and statistics
Last updated
Was this helpful?
The different ways PrisonPick can store a player's data and statistics
Last updated
Was this helpful?
PrisonPick stores data in different ways depending on how it is configured. Enchantments can be fetched from the of a custom item, the , or a . The blocks mined statistic can only be fetched from the local file or a MySQL database.
A player's data is always saved locally, and that file can be found within /plugins/PrisonPick/data/playerUUID.yml
This does not mean that data is always fetched from it.
If enabled in the , data will also be stored within a MySQL database. If data is saved to a database, all statistics will be fetched from the database, unless enchantments are fetched instead. If there is an SQLException, data will be fetched from the local file instead.
Enchantments are always stored in the NBT tag of a custom item and within their local file.
If the option getEnchantsFromItem
is enabled within the , enchantments will be always fetched from the NBT tag of the item. This means that if a player loses their pickaxe or if the pickaxe is removed from their inventory, all enchantments will be reset for that player. By default, this is false, meaning that the enchantment level depends on the and/or a database.
The /prisonpick syncData [file/db] confirm
command is a very unique command and one that probably won't be used often. This command copies all existing data from the given location and also sets those values at the other. It will not remove any other existing data, but it will overwrite pre-existing stats for a player.
File to Database Sync Example
You just enabled my database, but you've been running PrisonPick for quite some time, so a lot of my players have statistics. To minimize the number of workarounds you have to do, there's a command built directly for this. To copy the stats from the found within the data folder to the database, you just type /prisonpick syncData file confirm
.
You have a server that's been using PrisonPick and a MySQL database, and you are planning on setting up another server on your network that uses the same data as the other. It's not necessary if you are using a database, but highly recommended that you run the command /prisonpick syncdata db confirm
on the newer server. This will sync the data from the database to this new server.
Even though within this example the local files are not being used, if a database occurs, PrisonPick will use the local file instead, so making sure both are the same is good practice.
Take caution while using this command. Syncing data will overwrite data if the data is not the same.