22declare(strict_types=1);
24namespace pocketmine\command\defaults;
33use
function array_shift;
38 public function __construct(){
41 KnownTranslationFactory::pocketmine_command_op_description(),
42 KnownTranslationFactory::commands_op_usage()
44 $this->setPermission(DefaultPermissionNames::COMMAND_OP_GIVE);
48 if(count($args) === 0){
52 $name = array_shift($args);
57 $sender->getServer()->addOp($name);
58 if(($player = $sender->getServer()->getPlayerExact($name)) !==
null){
59 $player->sendMessage(KnownTranslationFactory::commands_op_message()->prefix(TextFormat::GRAY));
61 Command::broadcastCommandMessage($sender, KnownTranslationFactory::commands_op_success($name));
execute(CommandSender $sender, string $commandLabel, array $args)
static isValidUserName(?string $name)