From 80527c3e401b2d2026281c5f043d1dcdb3a38b5f Mon Sep 17 00:00:00 2001 From: Hamza Ali Date: Tue, 31 Mar 2020 08:50:25 +0700 Subject: [PATCH] allow ops with no perms to use the plugin --- src/main/kotlin/pw/hamzantal/bloodmoon/BloodMoon.kt | 4 ++-- src/main/resources/plugin.yml | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/pw/hamzantal/bloodmoon/BloodMoon.kt b/src/main/kotlin/pw/hamzantal/bloodmoon/BloodMoon.kt index 17467ab..6d7812a 100644 --- a/src/main/kotlin/pw/hamzantal/bloodmoon/BloodMoon.kt +++ b/src/main/kotlin/pw/hamzantal/bloodmoon/BloodMoon.kt @@ -26,7 +26,7 @@ class BloodMoon : JavaPlugin(), Listener { if (Bukkit.getWorlds().first().fullTime - 13000 in 0..20) { val chance = Random.nextDouble() 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( "&c[!] &7Blood Moon chance did not meet threshold: ${String.format( "%.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.") 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!") return@command } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 417e3ce..3d79086 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -6,4 +6,7 @@ depend: - ProtocolLib commands: bloodmoon: - description: Default command for seeing bloodmoon status \ No newline at end of file + description: Default command for seeing bloodmoon status +permissions: + bloodmoon.admin: + default: op \ No newline at end of file