Stop hardcoding permission names everywhere

using strings for permission names is nearly as shitty, but this is at least cross-referencable and statically analysable.
This commit is contained in:
Dylan K. Taylor
2021-06-26 19:14:51 +01:00
parent 0910054c41
commit bf7d69b69e
43 changed files with 267 additions and 115 deletions

View File

@@ -27,6 +27,7 @@ use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\command\utils\InvalidCommandSyntaxException;
use pocketmine\lang\TranslationContainer;
use pocketmine\permission\DefaultPermissionNames;
use pocketmine\player\GameMode;
use pocketmine\player\Player;
use pocketmine\utils\TextFormat;
@@ -40,7 +41,7 @@ class GamemodeCommand extends VanillaCommand{
"%pocketmine.command.gamemode.description",
"%commands.gamemode.usage"
);
$this->setPermission("pocketmine.command.gamemode");
$this->setPermission(DefaultPermissionNames::COMMAND_GAMEMODE);
}
public function execute(CommandSender $sender, string $commandLabel, array $args){