[SOLVED] How getting the top 3 killers?

Discussion in 'Spigot Plugin Development' started by ProxyBite, May 1, 2015.

Thread Status:
Not open for further replies.
  1. I need getting the top 3 killers when game finish.

    Some methods?
  2. gigosaurus


  3. I suppose you are making a minigame plugin and you want to get the player(s) that have the biggest number of kills.
  4. Yes , use HashMap to store the kills and use collection but did not work
  5. 'did not work' does not help us all. What didn't work? Is an exception being thrown?
    • Agree Agree x 1
    • Like Like x 1
  6. Very Information. Such helpful. Many context.

    Seriously, if you need help, give Information on everything connected to your problem. You said you save all the Kills and their Names/UUIDs (dare you save the Players itself).

    To sort the whole HashMap, take a look into sorting systems. Choose the one you prefer, I recommend taking one which directly sorts the 3 highest Values as first (e.g. BubbleSort). I recommend stopping the sorting after you got the 3 first ones. The rest just takes performance.
    • Like Like x 1
Thread Status:
Not open for further replies.