From 4c268acc00a00ee8cef1ff23ec8adfc01dfdfa68 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 14 Apr 2019 17:58:53 +0100 Subject: [PATCH] Fixed /whitelist on/off permissions, closes #2849 --- src/pocketmine/command/defaults/WhitelistCommand.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/command/defaults/WhitelistCommand.php b/src/pocketmine/command/defaults/WhitelistCommand.php index ddf43866c..c998a9762 100644 --- a/src/pocketmine/command/defaults/WhitelistCommand.php +++ b/src/pocketmine/command/defaults/WhitelistCommand.php @@ -115,8 +115,12 @@ class WhitelistCommand extends VanillaCommand{ return true; } - private function badPerm(CommandSender $sender, string $perm) : bool{ - if(!$sender->hasPermission("pocketmine.command.whitelist.$perm")){ + private function badPerm(CommandSender $sender, string $subcommand) : bool{ + static $map = [ + "on" => "enable", + "off" => "disable" + ]; + if(!$sender->hasPermission("pocketmine.command.whitelist." . ($map[$subcommand] ?? $subcommand))){ $sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission")); return true;