From 9911244f343bcfa7179eac5928c58d500aee8ec5 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Mon, 24 Oct 2022 17:02:25 +0100 Subject: [PATCH] PR Cleanup --- .../main/kotlin/com/willfp/ecojobs/jobs/Job.kt | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/Job.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/Job.kt index a77b212..685b6a0 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/Job.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/Job.kt @@ -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) }