Skip to content

Commit

Permalink
✨ multiple players on one rank
Browse files Browse the repository at this point in the history
  • Loading branch information
b8daniel committed Apr 20, 2022
1 parent 939c994 commit d8e0b4d
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,13 @@ object Game {
}

private fun topPlayers(obj: Objective): String {

return Bukkit.getOnlinePlayers().asSequence()
.map { it.name to obj.getScore(it.name).score }
.filter { it.second != 0 }
.sortedByDescending { it.second }
return Bukkit.getOnlinePlayers()
.groupBy { obj.getScore(it.name).score }.entries
.asSequence()
.filter { it.key > 0 }
.sortedByDescending { it.key }
.filterIndexed { index, _ -> index < 5 }
.mapIndexed { i, pair -> "${i + 1}. *${pair.first}*: ${pair.second}" }
.mapIndexed { i, en -> en.value.joinToString("\n") { "${i + 1}. *${it.name}*: ${en.key}" } }
.joinToString("\n")
}

Expand Down

0 comments on commit d8e0b4d

Please sign in to comment.