Yaml files dummy /leaderboard.

Discussion in 'Plugin Development' started by Pizza371, Sep 4, 2013.

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

    Pizza371

    Hello! I have a problem which ive been trying to figure out a way to get around, but I can't.
    So, I have a yaml file for each user, with kills: <amt>.
    I need a leaderboard for my server to add more of a challenge, E.G.
    1. Pizza Kills: 5
    2. bob kills: 3
    3. notch kills: 1
    How I'm trying to do it is by matching up the killer on the death event with the top 5 places.
    if killer has more points than notch, set killer to 3.
    But I'm unsure what to do before the leaderboard is there? ofc I could just set them all null, but when someone gets a kill it wont check it at all... since its null, or will null have a config file with its kills? :p
    Any help? Thanks!
     
  2. Offline

    etaxi341

    Pizza371 I would recommend you to look into Bubble Sort. This is a Java Methods to sort the Highest Integers. And then you would just need to get the first 10 out of this list (or the last 10... But I would recommend you to sort them that the Best one is on Place one)
     
  3. Offline

    Pizza371

    etaxi341 each player has a seperate YAML file though :(
     
  4. Offline

    etaxi341

    Pizza371 I am not sure if there is a Method to get every Player that has ever been online but if not you should store all the Playernames in a players.yml. Then you need to cycle through each <player>.yml.
     
  5. Offline

    Pizza371

    @etaxi341 Thanks!​
    I'm not gonna use your method directly, I'm gonna check if the player = null or offline player = null on the leaderboard, and if it is, fill it up untill it gets to 5 people. only then can the leaderboard be seen​
    Should work right? Testing now anyway ;D​
     
Thread Status:
Not open for further replies.

Share This Page