Hello, I've got another question: How do I sort the datas in a .yml file (The biggest number on the first Position). I am programming a plugin, where every Player has datas (How many blocks he has breaken, number of his deaths and kills, and so on) And I would like to sort it in a .yml file so, that in every cathegory you see all Players, from the best to the lowest, like this: Code: brokenBlocks: decoration: player2: 5300 player1: 4543 player3: 1233 redstone: player2: 504 player3: 320 player1: 45 materials: player2: 30218 player1: 15390 player3: 1749 kills: player3: 4 player1: 3 player2: 3 deaths: player1: 0 player2: 3 player3: 24 I hope everybody understands my Problem xD And I forgott something: I would Change the yml. file everytime, when a Player did something (break a block, killsomeone, ...) But this makes the Server very slow I think. If there's a better solution, please let me know EDIT by Moderator: merged posts, please use the edit button instead of double posting.
This would be an example where you should use MySQL in your code. However if you want to use YAML, you can use threads which can be found using the BukkitRunnable object, then it does not freeze the main thread when it is trying to write to the file. An article about the BukkitRunnable object can be found here.
Haha, I forgot to answer the sort question. But this is what you would do so sort things from the YAML file.
Thank you very much, that all are good ideas! But there's one question left: I have to save a playername and a variable for him. How can I do this? How can I save the Player AND the variable in one Point of the Array list?
@Typ, Keep in mind you cannot simply set a UUID into a config file. You must use toString and fromString. I think almost every person has made that mistake at some point. XD