So, I'm trying to create a points system on my minigames server, where players get points for winning and can spend them and stuff. Basically, I want to save a yaml per player, so like: /MyPlugin/PlayersName/PlayersName.YML I have this HashMap: Code:java HashMap<OfflinePlayer, Integer> scores = new HashMap<OfflinePlayer, Integer>(); (I'm aware that OfflinePlayer is a resource heavy thing to use as a key) And I want to have my plugin read the file of a player when they join (if it exists) and set their integer in the hashmap to their score, and I want it to save the YAML whenever they log off or when the plugin is disabled. I have read https://forums.bukkit.org/threads/bukkits-yaml-configuration-tutorial.42770/ but I just can't seem to soak it in at all, can somebody just give me a method or two that will point me in the right direction?
there is no point in creating a yaml file for every single player to only store points. Just create a list and have the players name and their score in 1 yaml file. Something like this. Code: Scores: Player1: 10 Player2: 20 Player3: 40 Player4: 50
But if I had like 20,000 players get on the server over like 2 years, that YAML would take forever to load...
rocket138 You should have a quarterly cleaning up. Meaning, go through all the contents of the YML. If the player hasn't logged in for 3 months, get rid of the entry.
rocket138 The_Doctor_123 is right just remove players from the file if they are inactive. Also do you know how much space 20,000 different yaml files would take up.
Fair points, but should I have it save a players last login aswell? because it would be rather difficult to pay attention to every single player.