Skip to content

Commit 4e6c711

Browse files
committed
6.0.12 Update onlinePlayers()
1 parent 7dab003 commit 4e6c711

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

platform/platform-bukkit/src/main/kotlin/taboolib/platform/BukkitAdapter.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ class BukkitAdapter : PlatformAdapter {
3030
}
3131

3232
override fun onlinePlayers(): List<ProxyPlayer> {
33-
return Bukkit.getWorlds().flatMap { it.players }.filter { Bukkit.getPlayer(it.uniqueId) != null }.map { adaptPlayer(it) }
33+
return try {
34+
Bukkit.getOnlinePlayers().map { adaptPlayer(it) }
35+
} catch (_: NoSuchMethodError) {
36+
Bukkit.getWorlds().flatMap { it.players }.filter { Bukkit.getPlayer(it.uniqueId) != null }.map { adaptPlayer(it) }
37+
}
3438
}
3539

3640
override fun adaptPlayer(any: Any): ProxyPlayer {

0 commit comments

Comments
 (0)