diff --git a/src/main/kotlin/settingseditor/Json.kt b/src/main/kotlin/settingseditor/Json.kt index fb894ab..89f67d6 100644 --- a/src/main/kotlin/settingseditor/Json.kt +++ b/src/main/kotlin/settingseditor/Json.kt @@ -48,6 +48,16 @@ object Json { launcher["closeOnClientLaunch"] = SettingsWindow.closeLauncherOnLaunch.isToggled launcher["notifyUpdates"] = Settings.CHECK_FOR_UPDATES + val ip = when(SettingsWindow.profileMode.selectedIndex) + { + 0 -> "play.2009scape.org" + 1 -> "ryannathans.net" + else -> "localhost" + } + + data["ip_management"] = ip + data["ip_address"] = ip + FileWriter(CONF).use { writer -> writer.write(data.toJSONString()) writer.flush() @@ -106,6 +116,13 @@ object Json { SettingsWindow.closeLauncherOnLaunch.isToggled = launcher.getOrDefault("closeOnClientLaunch", true) as Boolean Settings.CHECK_FOR_UPDATES = launcher.getOrDefault("notifyUpdates", true) as Boolean + + SettingsWindow.profileMode.selectedIndex = when(data["ip_management"]) + { + "play.2009scape.org" -> 0 + "ryannathans.net" -> 1 + else -> 2 + } } catch (e: Exception) { println("error parsing settings, replacing with defaults...") e.printStackTrace() diff --git a/src/main/kotlin/settingseditor/SettingsWindow.kt b/src/main/kotlin/settingseditor/SettingsWindow.kt index 1a919c1..9fca10c 100644 --- a/src/main/kotlin/settingseditor/SettingsWindow.kt +++ b/src/main/kotlin/settingseditor/SettingsWindow.kt @@ -18,6 +18,7 @@ object SettingsWindow : JFrame("Client Settings") { val xpDropModeOptions = arrayOf("instant","incremental") val xpTrackModeOptions = arrayOf("total xp","recent skill") + val profileOptions = arrayOf("Live","Testing","Local") var tabs = ArrayList() var buttons = ArrayList() @@ -47,6 +48,7 @@ object SettingsWindow : JFrame("Client Settings") { val closeLauncherOnLaunch = Checkbox() val checkForLauncherUpdates = Checkbox() var RCMPreviewInitialized = false + val profileMode = JComboBox(profileOptions) init { isUndecorated = true @@ -283,6 +285,8 @@ object SettingsWindow : JFrame("Client Settings") { val closeLauncherOnLaunchLabel = getLabel("Close launcher when client starts") val checkForUpdatePanel = getThemedPanel(BorderLayout()) val checkForUpdateLabel = getLabel("Notify me of launcher updates") + val profilePanel = getThemedPanel(BorderLayout()) + val profileLabel = getLabel("Profile") checkForLauncherUpdates.onClick { checkForLauncherUpdates.isToggled = !checkForLauncherUpdates.isToggled @@ -297,6 +301,15 @@ object SettingsWindow : JFrame("Client Settings") { checkForUpdatePanel.add(checkForUpdateLabel, BorderLayout.WEST) checkForUpdatePanel.add(checkForLauncherUpdates, BorderLayout.EAST) pane.add(checkForUpdatePanel) + pane.add(getSeparator()) + + profileMode.size = Dimension(200,10) + profileMode.minimumSize = Dimension(200,10) + profileMode.maximumSize = Dimension(200,10) + profileMode.preferredSize = Dimension(200,10) + profilePanel.add(profileLabel, BorderLayout.WEST) + profilePanel.add(profileMode, BorderLayout.EAST) + pane.add(profilePanel) addTab(pane, button, getLabel("Launcher Settings")) }