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;