I am having troubles sorting out the top 5 kills for my plugin, each person has their own .yml file and within gets stored the following: Code: User: Kills: 0 Deaths: 0 HighestKS: 1 DefaultKit: tank OwnedKits: - tank I tried doing this to be able to get the top 5 kills but it doesn't seem to work and just throws off errors Code: https://hastebin.com/lelejuqeta.vbs Error: https://hastebin.com/yudexumiye.vbs
If there's only 1 user per file, the below code would only run once. Code: for(String uuid : user.getUserFile().getConfigurationSection("User").getKeys(false)) list most likely doesn't contain more than one data value so the loop would cause an error
Any chance you can give me more information about Object Oriented Programming and about how I can go about doing that, thank you.
@AyWuzzUp First off, I'm not sure what you plan on achieving with this line here Code: for(String uuid : user.getUserFile().getConfigurationSection("User").getKeys(false)) I assume user.getUserFile() fetches the corresponding yml file to the user, so there is no need to loop through the keys in searching for the uuid. Remove the loop. Second, this line here is also wrong Code: if(user.getUserFile().getInt("User."+".Kills") > high) You're trying to get the int value of the path "User." + ".Kills", which is the same as "User..Kills". I'm pretty sure that's not what you meant. "User.Kills" is fine in this case.
I am just simply trying to loop through every persons .yml file and check their kills and make a top 5