mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-22 10:56:35 +00:00
SetupWizard: stop depending on Java gamemode IDs for option selection
This commit is contained in:
parent
999eab0c84
commit
2a528b4afb
@ -27,7 +27,6 @@ declare(strict_types=1);
|
|||||||
*/
|
*/
|
||||||
namespace pocketmine\wizard;
|
namespace pocketmine\wizard;
|
||||||
|
|
||||||
use pocketmine\data\java\GameModeIdMap;
|
|
||||||
use pocketmine\lang\KnownTranslationFactory;
|
use pocketmine\lang\KnownTranslationFactory;
|
||||||
use pocketmine\lang\Language;
|
use pocketmine\lang\Language;
|
||||||
use pocketmine\lang\LanguageNotFoundException;
|
use pocketmine\lang\LanguageNotFoundException;
|
||||||
@ -168,8 +167,12 @@ LICENSE;
|
|||||||
$this->message($this->lang->translate(KnownTranslationFactory::gamemode_info()));
|
$this->message($this->lang->translate(KnownTranslationFactory::gamemode_info()));
|
||||||
|
|
||||||
do{
|
do{
|
||||||
//TODO: drop the usage of internal Mojang IDs for this - we really just need a set of options to choose from
|
$input = (int) $this->getInput($this->lang->translate(KnownTranslationFactory::default_gamemode()), "0");
|
||||||
$gamemode = GameModeIdMap::getInstance()->fromId((int) $this->getInput($this->lang->translate(KnownTranslationFactory::default_gamemode()), (string) GameModeIdMap::getInstance()->toId(GameMode::SURVIVAL)));
|
$gamemode = match($input){
|
||||||
|
0 => GameMode::SURVIVAL,
|
||||||
|
1 => GameMode::CREATIVE,
|
||||||
|
default => null
|
||||||
|
};
|
||||||
}while($gamemode === null);
|
}while($gamemode === null);
|
||||||
//TODO: this probably shouldn't use the enum name directly
|
//TODO: this probably shouldn't use the enum name directly
|
||||||
$config->set(ServerProperties::GAME_MODE, $gamemode->name);
|
$config->set(ServerProperties::GAME_MODE, $gamemode->name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user