allow ops with no perms to use the plugin

master
ALI Hamza 2020-03-31 08:50:25 +07:00
parent daef7be2a9
commit 80527c3e40
No known key found for this signature in database
GPG Key ID: BCA8A46C87798C4C
2 changed files with 6 additions and 3 deletions

@ -26,7 +26,7 @@ class BloodMoon : JavaPlugin(), Listener {
if (Bukkit.getWorlds().first().fullTime - 13000 in 0..20) { if (Bukkit.getWorlds().first().fullTime - 13000 in 0..20) {
val chance = Random.nextDouble() val chance = Random.nextDouble()
if (!BMData.running && chance < Config.chance) BMData.begin() if (!BMData.running && chance < Config.chance) BMData.begin()
else Bukkit.getOnlinePlayers().filter { it.hasPermission("bloodmoon.admin") }.forEach { else Bukkit.getOnlinePlayers().filter { it.hasPermission("bloodmoon.admin") || it.isOp }.forEach {
it.msg( it.msg(
"&c[!] &7Blood Moon chance did not meet threshold: ${String.format( "&c[!] &7Blood Moon chance did not meet threshold: ${String.format(
"%.02f", "%.02f",
@ -43,7 +43,7 @@ class BloodMoon : JavaPlugin(), Listener {
if (BMData.running) sender.msg("&c&lThe Blood Moon is Active!\n&7${BMData.ticksLeft() / 20} seconds left.") if (BMData.running) sender.msg("&c&lThe Blood Moon is Active!\n&7${BMData.ticksLeft() / 20} seconds left.")
else sender.msg("&a&lThe Blood Moon is not currently active.") else sender.msg("&a&lThe Blood Moon is not currently active.")
if (!sender.hasPermission("bloodmoon.admin")) { if (!sender.hasPermission("bloodmoon.admin") && !sender.isOp) {
sender.msg("&cNo permission!") sender.msg("&cNo permission!")
return@command return@command
} }

@ -6,4 +6,7 @@ depend:
- ProtocolLib - ProtocolLib
commands: commands:
bloodmoon: bloodmoon:
description: Default command for seeing bloodmoon status description: Default command for seeing bloodmoon status
permissions:
bloodmoon.admin:
default: op