From 2a528b4afb31566fd726bda29f1b2f44dc9747bc Mon Sep 17 00:00:00 2001
From: "Dylan K. Taylor" <dktapps@pmmp.io>
Date: Fri, 8 Sep 2023 16:15:07 +0100
Subject: [PATCH] SetupWizard: stop depending on Java gamemode IDs for option
 selection

---
 src/wizard/SetupWizard.php | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/wizard/SetupWizard.php b/src/wizard/SetupWizard.php
index 94158c16b..0f1a99f4b 100644
--- a/src/wizard/SetupWizard.php
+++ b/src/wizard/SetupWizard.php
@@ -27,7 +27,6 @@ declare(strict_types=1);
  */
 namespace pocketmine\wizard;
 
-use pocketmine\data\java\GameModeIdMap;
 use pocketmine\lang\KnownTranslationFactory;
 use pocketmine\lang\Language;
 use pocketmine\lang\LanguageNotFoundException;
@@ -168,8 +167,12 @@ LICENSE;
 		$this->message($this->lang->translate(KnownTranslationFactory::gamemode_info()));
 
 		do{
-			//TODO: drop the usage of internal Mojang IDs for this - we really just need a set of options to choose from
-			$gamemode = GameModeIdMap::getInstance()->fromId((int) $this->getInput($this->lang->translate(KnownTranslationFactory::default_gamemode()), (string) GameModeIdMap::getInstance()->toId(GameMode::SURVIVAL)));
+			$input = (int) $this->getInput($this->lang->translate(KnownTranslationFactory::default_gamemode()), "0");
+			$gamemode = match($input){
+				0 => GameMode::SURVIVAL,
+				1 => GameMode::CREATIVE,
+				default => null
+			};
 		}while($gamemode === null);
 		//TODO: this probably shouldn't use the enum name directly
 		$config->set(ServerProperties::GAME_MODE, $gamemode->name);