9
0
mirror of https://github.com/Auxilor/EcoJobs.git synced 2025-12-27 02:49:06 +00:00

PR Cleanup

This commit is contained in:
Auxilor
2022-10-24 17:02:25 +01:00
parent 3b949c0119
commit 9911244f34

View File

@@ -176,25 +176,10 @@ class Job(
plugin,
"${id}_total_players"
) {
getTotalPlayers(this).toNiceString()
Bukkit.getOfflinePlayers().count { it.activeJob == this }.toString()
}.register()
}
private fun getTotalPlayers(job: Job): Int {
val offlinePlayers = Bukkit.getServer().offlinePlayers
val onlinePlayers = Bukkit.getServer().onlinePlayers
val allPlayers = offlinePlayers + onlinePlayers
var countPlayerWithJob = 0
for (player in allPlayers.distinct()) {
if (player.activeJob?.id == job.id)
countPlayerWithJob += 1
}
return countPlayerWithJob
}
fun getLevel(level: Int): JobLevel = levels.get(level) {
JobLevel(this, it, effects, conditions)
}