22declare(strict_types=1);
24namespace pocketmine\command\defaults;
30use pocketmine\player\GameMode;
36 public function __construct(){
39 KnownTranslationFactory::pocketmine_command_defaultgamemode_description(),
40 KnownTranslationFactory::commands_defaultgamemode_usage()
42 $this->setPermission(DefaultPermissionNames::COMMAND_DEFAULTGAMEMODE);
46 if(count($args) === 0){
50 $gameMode = GameMode::fromString($args[0]);
51 if($gameMode ===
null){
52 $sender->sendMessage(KnownTranslationFactory::pocketmine_command_gamemode_unknown($args[0]));
57 $sender->getServer()->getConfigGroup()->setConfigString(ServerProperties::GAME_MODE, $gameMode->name);
58 $sender->sendMessage(KnownTranslationFactory::commands_defaultgamemode_success($gameMode->getTranslatableName()));
execute(CommandSender $sender, string $commandLabel, array $args)