Leader boards

Discussion in 'Plugin Development' started by bobthefish, Jul 28, 2014.

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

    bobthefish

    hi,

    In my plugin, I keep track of a player's kill to death ratio. I would like to add a command that will display the players with the top 5 kill death ratios in order. the only problem is, I need to go and get the kills and deaths from each player, but for every player and comapre them. any idea how I would do this? here is what my config looks like:

    Code:
    Players:
      1stPlayer:
        kills: 3
        deaths: 3
      2ndPlayer
        kills: 2
        deaths: 6
      3rdPlayer
        kills: 5
        deaths: 2
     
  2. Offline

    user_90854156

  3. Offline

    bobthefish

    MrTang thank you, but unfortunately I am not quite good enough to figure out what his code does, because I have never used anything like it before, can you maybe explain what he did?
     
  4. Offline

    user_90854156

    Create the ValueComparator class
    Loop through the config and put the name + KD in a HashMap
    In your command, sort the Map.
    Loop through the Entries for the map and send the top 10 message.
     
Thread Status:
Not open for further replies.

Share This Page