Allow gamemode strings for gamemode property in server.properties (#4638)

closes #2692
This commit is contained in:
Matthew Jordan
2021-12-14 16:56:22 -06:00
committed by GitHub
parent 4b06fe73f2
commit a41404bd8a
3 changed files with 6 additions and 8 deletions

View File

@ -25,7 +25,6 @@ namespace pocketmine\command\defaults;
use pocketmine\command\CommandSender;
use pocketmine\command\utils\InvalidCommandSyntaxException;
use pocketmine\data\java\GameModeIdMap;
use pocketmine\lang\KnownTranslationFactory;
use pocketmine\permission\DefaultPermissionNames;
use pocketmine\player\GameMode;
@ -57,7 +56,7 @@ class DefaultGamemodeCommand extends VanillaCommand{
return true;
}
$sender->getServer()->getConfigGroup()->setConfigInt("gamemode", GameModeIdMap::getInstance()->toId($gameMode));
$sender->getServer()->getConfigGroup()->setConfigString("gamemode", $gameMode->name());
$sender->sendMessage(KnownTranslationFactory::commands_defaultgamemode_success($gameMode->getTranslatableName()));
return true;
}