Skip to content

Commit

Permalink
Merge pull request #50
Browse files Browse the repository at this point in the history
Spigot | Add permission based vanish level system (velocityvanish.level.<level>)
  • Loading branch information
Syrent committed Dec 9, 2022
2 parents d6beb9f + 3c70eb7 commit 215d0f1
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ class VanishManager(
}

fun hidePlayer(player: Player) {
val vanishLevel = player.effectivePermissions.map { it.permission }
.filter { it.startsWith("velocityvanish.level.") }.maxOfOrNull { it.split(".")[2].toInt() } ?: 0
for (onlinePlayer in Ruom.getOnlinePlayers().filter { !it.hasPermission("velocityvanish.admin.seevanished") }) {
val onlinePlayerVanishLevel = onlinePlayer.effectivePermissions.map { it.permission }
.filter { it.startsWith("velocityvanish.level.") }.maxOfOrNull { it.split(".")[2].toInt() } ?: 0
if (onlinePlayerVanishLevel > vanishLevel) continue

@Suppress("DEPRECATION")
onlinePlayer.hidePlayer(player)
}
Expand Down

0 comments on commit 215d0f1

Please sign in to comment.