Top kills

Discussion in 'Plugin Development' started by AyWuzzUp, Oct 14, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    AyWuzzUp

    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
     
  2. Offline

    Creeperzombi3

    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
     
  3. Offline

    AyWuzzUp

    O finally a reply thank you so much, what do you think I should do instead then?
     
  4. Offline

    Creeperzombi3

    If you aren't already, use Object Oriented Programming for your players and loop through them
     
  5. Offline

    AyWuzzUp

    Any chance you can give me more information about Object Oriented Programming and about how I can go about doing that, thank you.
     
  6. Offline

    AyWuzzUp

  7. Offline

    Side8StarLite

    @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.
     
  8. Offline

    AyWuzzUp

    I am just simply trying to loop through every persons .yml file and check their kills and make a top 5
     
Thread Status:
Not open for further replies.

Share This Page