Use an array for command permissions

it doesn't make sense to have to parse the string every time we want to verify permissions, nor to expect that people will somehow know to use ; to separate them without it being documented anywhere...
This commit is contained in:
Dylan K. Taylor
2023-02-13 14:44:55 +00:00
parent cb10360c20
commit caebe14dab
13 changed files with 44 additions and 46 deletions

View File

@ -30,7 +30,6 @@ use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\lang\KnownTranslationFactory;
use pocketmine\permission\DefaultPermissionNames;
use function count;
use function implode;
class KillCommand extends VanillaCommand{
@ -41,7 +40,7 @@ class KillCommand extends VanillaCommand{
KnownTranslationFactory::pocketmine_command_kill_usage(),
["suicide"]
);
$this->setPermission(implode(";", [DefaultPermissionNames::COMMAND_KILL_SELF, DefaultPermissionNames::COMMAND_KILL_OTHER]));
$this->setPermissions([DefaultPermissionNames::COMMAND_KILL_SELF, DefaultPermissionNames::COMMAND_KILL_OTHER]);
}
public function execute(CommandSender $sender, string $commandLabel, array $args){