diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/game/HMCLModpack.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/game/HMCLModpack.kt index 28d2836a6..b8fb96737 100644 --- a/HMCL/src/main/kotlin/org/jackhuang/hmcl/game/HMCLModpack.kt +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/game/HMCLModpack.kt @@ -33,6 +33,9 @@ import sun.tools.jar.resources.jar import java.util.Collections.addAll import java.util.ArrayList import java.util.Arrays +import com.sun.javafx.scene.layout.region.BorderStyleConverter.HIDDEN + + @@ -49,16 +52,18 @@ import java.util.Arrays @Throws(IOException::class, JsonParseException::class) fun readHMCLModpackManifest(f: File): Modpack { val manifestJson = readTextFromZipFile(f, "modpack.json") - val manifest = GSON.fromJson(manifestJson) ?: throw JsonParseException("`modpack.json` not found. Not a valid HMCL modpack.") + val manifest = GSON.fromJson(manifestJson) ?: throw JsonParseException("`modpack.json` not found. $f is not a valid HMCL modpack.") val gameJson = readTextFromZipFile(f, "minecraft/pack.json") - val game = GSON.fromJson(gameJson) ?: throw JsonParseException("`minecraft/pack.json` not found. Not a valid HMCL modpack.") - return if (game.jar == null) manifest.copy(manifest = HMCLModpackManifest) + val game = GSON.fromJson(gameJson) ?: throw JsonParseException("`minecraft/pack.json` not found. $f iot a valid HMCL modpack.") + return if (game.jar == null) + if (manifest.gameVersion.isNullOrBlank()) throw JsonParseException("Cannot recognize the game version of modpack $f.") + else manifest.copy(manifest = HMCLModpackManifest) else manifest.copy(manifest = HMCLModpackManifest, gameVersion = game.jar!!) } object HMCLModpackManifest -class HMCLModpackInstallTask(profile: Profile, private val zipFile: File, private val name: String): Task() { +class HMCLModpackInstallTask(profile: Profile, private val zipFile: File, private val modpack: Modpack, private val name: String): Task() { private val dependency = profile.dependency private val repository = profile.repository override val dependencies = mutableListOf() @@ -68,9 +73,8 @@ class HMCLModpackInstallTask(profile: Profile, private val zipFile: File, privat check(!repository.hasVersion(name), { "Version $name already exists." }) val json = readTextFromZipFile(zipFile, "minecraft/pack.json") var version = GSON.fromJson(json)!! - val jar = version.jar!! version = version.copy(jar = null) - dependents += dependency.gameBuilder().name(name).gameVersion(jar).buildAsync() + dependents += dependency.gameBuilder().name(name).gameVersion(modpack.gameVersion!!).buildAsync() dependencies += dependency.checkGameCompletionAsync(version) dependencies += VersionJSONSaveTask(dependency, version) } @@ -86,36 +90,76 @@ class HMCLModpackInstallTask(profile: Profile, private val zipFile: File, privat } val MODPACK_BLACK_LIST = listOf("usernamecache.json", "asm", "logs", "backups", "versions", "assets", "usercache.json", "libraries", "crash-reports", "launcher_profiles.json", "NVIDIA", "AMD", "TCNodeTracker", "screenshots", "natives", "native", "\$native", "pack.json", "launcher.jar", "minetweaker.log", "launcher.pack.lzma", "hmclmc.log") -val MODPACK_SUGGESTED_BLACK_LIST = listOf("fonts", "saves", "servers.dat", "options.txt", "optionsof.txt", "journeymap", "optionsshaders.txt", "mods/VoxelMods") +val MODPACK_NORMAL_LIST = listOf("fonts", "saves", "servers.dat", "options.txt", "optionsof.txt", "journeymap", "optionsshaders.txt", "mods/VoxelMods") + +/** + * + * @author huang + */ +interface ModAdviser { + + fun advise(fileName: String, isDirectory: Boolean): ModSuggestion + + enum class ModSuggestion { + SUGGESTED, + NORMAL, + HIDDEN + } + +} + +private fun match(l: List, fileName: String, isDirectory: Boolean): Boolean { + for (s in l) + if (isDirectory) { + if (fileName.startsWith(s + "/")) + return true + } else if (fileName == s) + return true + return false +} + +var MODPACK_PREDICATE = object : ModAdviser { + override fun advise(fileName: String, isDirectory: Boolean): ModAdviser.ModSuggestion { + return if (match(MODPACK_BLACK_LIST, fileName, isDirectory)) + ModAdviser.ModSuggestion.HIDDEN + else if (match(MODPACK_NORMAL_LIST, fileName, isDirectory)) + ModAdviser.ModSuggestion.NORMAL + else + ModAdviser.ModSuggestion.SUGGESTED + } +} class HMCLModpackExportTask @JvmOverloads constructor( private val repository: DefaultGameRepository, private val version: String, - private val blacklist: List, + private val whitelist: List, private val modpack: Modpack, private val output: File, override val id: String = ID): TaskResult() { override fun execute() { - val b = ArrayList(MODPACK_BLACK_LIST) - b.addAll(blacklist) - b.add(version + ".jar") - b.add(version + ".json") + val blackList = ArrayList(MODPACK_BLACK_LIST) + blackList.add(version + ".jar") + blackList.add(version + ".json") LOG.info("Compressing game files without some files in blacklist, including files or directories: usernamecache.json, asm, logs, backups, versions, assets, usercache.json, libraries, crash-reports, launcher_profiles.json, NVIDIA, TCNodeTracker") ZipEngine(output).use { zip -> - zip.putDirectory(repository.getRunDirectory(version)) a@ { x: String, y: Boolean -> - for (s in b) - if (y) { - if (x.startsWith(s + "/")) + zip.putDirectory(repository.getRunDirectory(version)) a@ { pathName: String, isDirectory: Boolean -> + for (s in blackList) { + if (isDirectory) { + if (pathName.startsWith(s + "/")) return@a null - } else if (x == s) + } else if (pathName == s) return@a null - "minecraft/" + x + } + for (s in whitelist) + if (s + (if (isDirectory) "/" else "") == pathName) + return@a "minecraft/" + pathName + null } val mv = repository.getVersion(version).resolve(repository) val gameVersion = minecraftVersion(repository.getVersionJar(version)) ?: throw IllegalStateException("Cannot parse the version of $version") - zip.putTextFile(GSON.toJson(mv), "minecraft/pack.json") - zip.putTextFile(GSON.toJson(modpack.copy(gameVersion = gameVersion)), "modpack.json") + zip.putTextFile(GSON.toJson(mv.copy(jar = gameVersion)), "minecraft/pack.json") // Making "jar" to gameVersion is to be compatible with old HMCL. + zip.putTextFile(GSON.toJson(modpack.copy(gameVersion = gameVersion)), "modpack.json") // Newer HMCL only reads 'gameVersion' field. } } diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/AccountsPage.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/AccountsPage.kt index 642c8f585..60a12e056 100644 --- a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/AccountsPage.kt +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/AccountsPage.kt @@ -57,15 +57,8 @@ class AccountsPage() : StackPane(), DecoratorPage { scrollPane.smoothScrolling() - txtUsername.textProperty().addListener { _ -> - txtUsername.validate() - } - txtUsername.validate() - - txtPassword.textProperty().addListener { _ -> - txtPassword.validate() - } - txtPassword.validate() + txtUsername.setValidateWhileTextChanged() + txtPassword.setValidateWhileTextChanged() cboType.selectionModel.selectedIndexProperty().onChange { val visible = it != 0 diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/Decorator.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/Decorator.kt index d9080dfc5..0551136e4 100644 --- a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/Decorator.kt +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/Decorator.kt @@ -141,8 +141,8 @@ class Decorator @JvmOverloads constructor(private val primaryStage: Stage, priva animationHandler = TransitionHandler(contentPlaceHolder) - setOverflowHidden(lookup("#contentPlaceHolderRoot") as Pane) - setOverflowHidden(drawerWrapper) + (lookup("#contentPlaceHolderRoot") as Pane).setOverflowHidden() + drawerWrapper.setOverflowHidden() } fun onMouseMoved(mouseEvent: MouseEvent) { @@ -369,7 +369,7 @@ class Decorator @JvmOverloads constructor(private val primaryStage: Stage, priva if (content is Region) { content.setMinSize(0.0, 0.0) - setOverflowHidden(content) + content.setOverflowHidden() } backNavButton.isDisable = !wizardController.canPrev() diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/FXUtils.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/FXUtils.kt index f16aa33e8..1fcb8837e 100644 --- a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/FXUtils.kt +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/FXUtils.kt @@ -108,11 +108,11 @@ fun takeSnapshot(node: Parent, width: Double, height: Double): WritableImage { return scene.snapshot(null) } -fun setOverflowHidden(node: Region) { +fun Region.setOverflowHidden() { val rectangle = Rectangle() - rectangle.widthProperty().bind(node.widthProperty()) - rectangle.heightProperty().bind(node.heightProperty()) - node.clip = rectangle + rectangle.widthProperty().bind(widthProperty()) + rectangle.heightProperty().bind(heightProperty()) + clip = rectangle } val stylesheets = arrayOf( @@ -238,4 +238,14 @@ fun Node.installTooltip(openDelay: Double = 1000.0, visibleDelay: Double = 5000. LOG.log(Level.SEVERE, "Cannot install tooltip by reflection", e) Tooltip.install(this, tooltip) } +} + +fun JFXTextField.setValidateWhileTextChanged() { + textProperty().addListener { _ -> validate() } + validate() +} + +fun JFXPasswordField.setValidateWhileTextChanged() { + textProperty().addListener { _ -> validate() } + validate() } \ No newline at end of file diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/VersionPage.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/VersionPage.kt index b81a0d1e8..b1ca75eba 100644 --- a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/VersionPage.kt +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/VersionPage.kt @@ -29,6 +29,7 @@ import javafx.scene.layout.StackPane import org.jackhuang.hmcl.download.game.GameAssetIndexDownloadTask import org.jackhuang.hmcl.i18n import org.jackhuang.hmcl.setting.Profile +import org.jackhuang.hmcl.ui.export.ExportWizardProvider import org.jackhuang.hmcl.ui.wizard.DecoratorPage class VersionPage : StackPane(), DecoratorPage { @@ -40,6 +41,7 @@ class VersionPage : StackPane(), DecoratorPage { @FXML lateinit var managementList: JFXListView<*> @FXML lateinit var btnBrowseMenu: JFXButton @FXML lateinit var btnManagementMenu: JFXButton + @FXML lateinit var btnExport: JFXButton val browsePopup: JFXPopup val managementPopup: JFXPopup lateinit var profile: Profile @@ -56,6 +58,7 @@ class VersionPage : StackPane(), DecoratorPage { btnBrowseMenu.installTooltip(openDelay = 0.0, closeDelay = 0.0, tooltip = Tooltip(i18n("settings.explore"))) btnManagementMenu.installTooltip(openDelay = 0.0, closeDelay = 0.0, tooltip = Tooltip(i18n("settings.manage"))) + btnExport.installTooltip(openDelay = 0.0, closeDelay = 0.0, tooltip = Tooltip(i18n("modpack.task.save"))) } fun load(id: String, profile: Profile) { @@ -77,6 +80,10 @@ class VersionPage : StackPane(), DecoratorPage { managementPopup.show(btnManagementMenu, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.RIGHT, -12.0, 15.0) } + fun onExport() { + Controllers.decorator.startWizard(ExportWizardProvider(profile, version), i18n("modpack.wizard")) + } + fun onBrowse() { openFolder(profile.repository.getRunDirectory(version).resolve(when (browseList.selectionModel.selectedIndex) { 0 -> "" diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/VersionSettingsController.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/VersionSettingsController.kt index 411d0cd71..c1488d258 100644 --- a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/VersionSettingsController.kt +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/VersionSettingsController.kt @@ -84,17 +84,16 @@ class VersionSettingsController { chkNoGameCheck.limitHeight(limitHeight) chkShowLogs.limitHeight(limitHeight) - fun validation(field: JFXTextField) = InvalidationListener { field.validate() } fun validator(nullable: Boolean = false) = NumberValidator(nullable).apply { message = "Must be a number." } txtWidth.setValidators(validator()) - txtWidth.textProperty().addListener(validation(txtWidth)) + txtWidth.setValidateWhileTextChanged() txtHeight.setValidators(validator()) - txtHeight.textProperty().addListener(validation(txtHeight)) + txtHeight.setValidateWhileTextChanged() txtMaxMemory.setValidators(validator()) - txtMaxMemory.textProperty().addListener(validation(txtMaxMemory)) + txtMaxMemory.setValidateWhileTextChanged() txtMetaspace.setValidators(validator(true)) - txtMetaspace.textProperty().addListener(validation(txtMetaspace)) + txtMetaspace.setValidateWhileTextChanged() javaPane.children.clear() javaPane.children += createJavaPane(JavaVersion.fromCurrentEnvironment(), javaGroup) diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/WebStage.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/WebStage.kt new file mode 100644 index 000000000..c6a4d2e09 --- /dev/null +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/WebStage.kt @@ -0,0 +1,32 @@ +/* + * Hello Minecraft! Launcher. + * Copyright (C) 2017 huangyuhui + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see {http://www.gnu.org/licenses/}. + */ +package org.jackhuang.hmcl.ui + +import javafx.scene.Scene +import javafx.scene.image.Image +import javafx.scene.web.WebView +import javafx.stage.Stage + +class WebStage: Stage() { + val webView = WebView() + init { + scene = Scene(webView, 800.0, 480.0) + scene.stylesheets.addAll(*stylesheets) + icons += Image("/assets/img/icon.png") + } +} \ No newline at end of file diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/download/DownloadWizardProvider.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/download/DownloadWizardProvider.kt index c41d53cfc..413be4797 100644 --- a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/download/DownloadWizardProvider.kt +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/download/DownloadWizardProvider.kt @@ -81,7 +81,7 @@ class DownloadWizardProvider(): WizardProvider() { return when (modpack.manifest) { is CurseForgeModpackManifest -> CurseForgeModpackInstallTask(profile.dependency, selectedFile, modpack.manifest as CurseForgeModpackManifest, name) - is HMCLModpackManifest -> HMCLModpackInstallTask(profile, selectedFile, name) + is HMCLModpackManifest -> HMCLModpackInstallTask(profile, selectedFile, modpack, name) else -> throw Error() } with finalizeTask } @@ -95,12 +95,10 @@ class DownloadWizardProvider(): WizardProvider() { } override fun createPage(controller: WizardController, step: Int, settings: MutableMap): Node { - - return when (step) { 0 -> InstallTypePage(controller) 1 -> when (settings[InstallTypePage.INSTALL_TYPE]) { - 0 -> VersionsPage(controller, "", BMCLAPIDownloadProvider, "game", { controller.onNext(InstallersPage(controller, BMCLAPIDownloadProvider)) }) + 0 -> VersionsPage(controller, "", BMCLAPIDownloadProvider, "game") { controller.onNext(InstallersPage(controller, profile.repository, BMCLAPIDownloadProvider)) } 1 -> ModpackPage(controller) else -> throw Error() } diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/download/InstallersPage.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/download/InstallersPage.kt index fb9a6fdae..122a7acdb 100644 --- a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/download/InstallersPage.kt +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/download/InstallersPage.kt @@ -17,18 +17,22 @@ */ package org.jackhuang.hmcl.ui.download +import com.jfoenix.controls.JFXButton import com.jfoenix.controls.JFXListView import com.jfoenix.controls.JFXTextField import javafx.fxml.FXML import javafx.scene.control.Label import javafx.scene.layout.StackPane import org.jackhuang.hmcl.download.DownloadProvider +import org.jackhuang.hmcl.game.GameRepository +import org.jackhuang.hmcl.i18n +import org.jackhuang.hmcl.ui.construct.Validator import org.jackhuang.hmcl.ui.loadFXML import org.jackhuang.hmcl.ui.wizard.WizardController import org.jackhuang.hmcl.ui.wizard.WizardPage import org.jackhuang.hmcl.util.onChange -class InstallersPage(private val controller: WizardController, private val downloadProvider: DownloadProvider): StackPane(), WizardPage { +class InstallersPage(private val controller: WizardController, private val repository: GameRepository, private val downloadProvider: DownloadProvider): StackPane(), WizardPage { @FXML lateinit var list: JFXListView @FXML lateinit var lblGameVersion: Label @@ -36,11 +40,16 @@ class InstallersPage(private val controller: WizardController, private val downl @FXML lateinit var lblLiteLoader: Label @FXML lateinit var lblOptiFine: Label @FXML lateinit var txtName: JFXTextField + @FXML lateinit var btnInstall: JFXButton init { loadFXML("/assets/fxml/download/installers.fxml") val gameVersion = controller.settings["game"] as String + txtName.validators += Validator { !repository.hasVersion(it) && it.isNotBlank() }.apply { message = i18n("version.already_exists") } + txtName.textProperty().addListener { _ -> + btnInstall.isDisable = !txtName.validate() + } txtName.text = gameVersion list.selectionModel.selectedIndexProperty().onChange { diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/download/ModpackPage.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/download/ModpackPage.kt index d74dcc8f0..130a8a3ba 100644 --- a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/download/ModpackPage.kt +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/download/ModpackPage.kt @@ -17,34 +17,35 @@ */ package org.jackhuang.hmcl.ui.download -import com.google.gson.JsonParseException import com.jfoenix.controls.JFXButton import com.jfoenix.controls.JFXTextField import javafx.application.Platform import javafx.fxml.FXML import javafx.scene.control.Label +import javafx.scene.layout.BorderPane +import javafx.scene.layout.Region import javafx.scene.layout.StackPane import javafx.stage.FileChooser import org.jackhuang.hmcl.game.readModpackManifest import org.jackhuang.hmcl.i18n -import org.jackhuang.hmcl.mod.readCurseForgeModpackManifest +import org.jackhuang.hmcl.mod.Modpack import org.jackhuang.hmcl.setting.Profile -import org.jackhuang.hmcl.ui.Controllers +import org.jackhuang.hmcl.ui.* import org.jackhuang.hmcl.ui.construct.Validator -import org.jackhuang.hmcl.ui.loadFXML import org.jackhuang.hmcl.ui.wizard.WizardController import org.jackhuang.hmcl.ui.wizard.WizardPage -import java.io.IOException class ModpackPage(private val controller: WizardController): StackPane(), WizardPage { - override val title: String = "Install a modpack" + override val title: String = i18n("modpack.task.install") + @FXML lateinit var borderPane: Region @FXML lateinit var lblName: Label @FXML lateinit var lblVersion: Label @FXML lateinit var lblAuthor: Label @FXML lateinit var lblModpackLocation: Label @FXML lateinit var txtModpackName: JFXTextField @FXML lateinit var btnInstall: JFXButton + var manifest: Modpack? = null init { loadFXML("/assets/fxml/download/modpack.fxml") @@ -53,29 +54,33 @@ class ModpackPage(private val controller: WizardController): StackPane(), Wizard val chooser = FileChooser() chooser.title = i18n("modpack.choose") - chooser.extensionFilters += FileChooser.ExtensionFilter("Zip", "*.zip") + chooser.extensionFilters += FileChooser.ExtensionFilter(i18n("modpack"), "*.zip") val selectedFile = chooser.showOpenDialog(Controllers.stage) if (selectedFile == null) Platform.runLater { controller.onFinish() } else { // TODO: original HMCL modpack support. controller.settings[MODPACK_FILE] = selectedFile lblModpackLocation.text = selectedFile.absolutePath - txtModpackName.text = selectedFile.nameWithoutExtension - txtModpackName.validators += Validator { !profile.repository.hasVersion(it) } + txtModpackName.validators += Validator { !profile.repository.hasVersion(it) && it.isNotBlank() }.apply { message = i18n("version.already_exists") } txtModpackName.textProperty().addListener { _ -> - btnInstall.isDisabled = !txtModpackName.validate() + btnInstall.isDisable = !txtModpackName.validate() } try { - val manifest = readModpackManifest(selectedFile) - controller.settings[MODPACK_CURSEFORGE_MANIFEST] = manifest - lblName.text = manifest.name - lblVersion.text = manifest.version - lblAuthor.text = manifest.author + manifest = readModpackManifest(selectedFile) + controller.settings[MODPACK_CURSEFORGE_MANIFEST] = manifest!! + lblName.text = manifest!!.name + lblVersion.text = manifest!!.version + lblAuthor.text = manifest!!.author + txtModpackName.text = manifest!!.name + "-" + manifest!!.version } catch (e: Exception) { // TODO + txtModpackName.text = i18n("modpack.task.install.error") } } + + //borderPane.limitHeight(100.0) + borderPane.limitWidth(500.0) } override fun cleanup(settings: MutableMap) { @@ -88,6 +93,14 @@ class ModpackPage(private val controller: WizardController): StackPane(), Wizard controller.onFinish() } + fun onDescribe() { + if (manifest != null) + WebStage().apply { + webView.engine.loadContent(manifest!!.description) + title = i18n("modpack.wizard.step.3") + }.showAndWait() + } + companion object { val MODPACK_FILE = "MODPACK_FILE" val MODPACK_NAME = "MODPACK_NAME" diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/export/ExportWizardProvider.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/export/ExportWizardProvider.kt new file mode 100644 index 000000000..734d8a51c --- /dev/null +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/export/ExportWizardProvider.kt @@ -0,0 +1,56 @@ +/* + * Hello Minecraft! Launcher. + * Copyright (C) 2017 huangyuhui + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see {http://www.gnu.org/licenses/}. + */ +package org.jackhuang.hmcl.ui.export + +import javafx.scene.Node +import org.jackhuang.hmcl.game.HMCLModpackExportTask +import org.jackhuang.hmcl.game.MODPACK_PREDICATE +import org.jackhuang.hmcl.mod.Modpack +import org.jackhuang.hmcl.setting.Profile +import org.jackhuang.hmcl.ui.wizard.WizardController +import org.jackhuang.hmcl.ui.wizard.WizardProvider +import java.io.File + +class ExportWizardProvider(private val profile: Profile, private val version: String) : WizardProvider() { + override fun start(settings: MutableMap) { + } + + override fun finish(settings: MutableMap): Any? { + @Suppress("UNCHECKED_CAST") + return HMCLModpackExportTask(profile.repository, version, settings[ModpackFileSelectionPage.MODPACK_FILE_SELECTION] as List, + Modpack( + name = settings[ModpackInfoPage.MODPACK_NAME] as String, + author = settings[ModpackInfoPage.MODPACK_AUTHOR] as String, + version = settings[ModpackInfoPage.MODPACK_VERSION] as String, + description = settings[ModpackInfoPage.MODPACK_DESCRIPTION] as String + ), settings[ModpackInfoPage.MODPACK_FILE] as File) + } + + override fun createPage(controller: WizardController, step: Int, settings: MutableMap): Node { + return when(step) { + 0 -> ModpackInfoPage(controller, version) + 1 -> ModpackFileSelectionPage(controller, profile, version, MODPACK_PREDICATE) + else -> throw IllegalArgumentException("step") + } + } + + override fun cancel(): Boolean { + return true + } + +} \ No newline at end of file diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/export/ModpackFileSelectionPage.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/export/ModpackFileSelectionPage.kt new file mode 100644 index 000000000..5b2b1e87c --- /dev/null +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/export/ModpackFileSelectionPage.kt @@ -0,0 +1,143 @@ +/* + * Hello Minecraft! Launcher. + * Copyright (C) 2017 huangyuhui + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see {http://www.gnu.org/licenses/}. + */ +package org.jackhuang.hmcl.ui.export + +import com.jfoenix.controls.JFXTreeView +import javafx.fxml.FXML +import javafx.scene.control.CheckBox +import javafx.scene.control.CheckBoxTreeItem +import javafx.scene.control.Label +import javafx.scene.control.TreeItem +import javafx.scene.layout.HBox +import javafx.scene.layout.StackPane +import org.jackhuang.hmcl.game.ModAdviser +import org.jackhuang.hmcl.i18n +import org.jackhuang.hmcl.setting.Profile +import org.jackhuang.hmcl.ui.construct.NoneMultipleSelectionModel +import org.jackhuang.hmcl.ui.loadFXML +import org.jackhuang.hmcl.ui.wizard.WizardController +import org.jackhuang.hmcl.ui.wizard.WizardPage +import java.io.File +import java.util.* + +class ModpackFileSelectionPage(private val controller: WizardController, profile: Profile, private val version: String, private val adviser: ModAdviser): StackPane(), WizardPage { + override val title: String = i18n("modpack.wizard.step.2.title") + @FXML lateinit var treeView: JFXTreeView + private val rootNode: CheckBoxTreeItem? + init { + loadFXML("/assets/fxml/modpack/selection.fxml") + + rootNode = getTreeItem(profile.repository.getRunDirectory(version), "minecraft") + treeView.root = rootNode + treeView.selectionModel = NoneMultipleSelectionModel>() + } + + private fun getTreeItem(file: File, basePath: String): CheckBoxTreeItem? { + var state = ModAdviser.ModSuggestion.SUGGESTED + if (basePath.length > "minecraft/".length) { + state = adviser.advise(basePath.substringAfter("minecraft/") + (if (file.isDirectory) "/" else ""), file.isDirectory) + if (file.isFile && file.nameWithoutExtension == version) + state = ModAdviser.ModSuggestion.HIDDEN + if (file.isDirectory && file.name == version + "-natives") + state = ModAdviser.ModSuggestion.HIDDEN + if (state == ModAdviser.ModSuggestion.HIDDEN) + return null + } + + val node = CheckBoxTreeItem(basePath.substringAfterLast("/")) + if (state == ModAdviser.ModSuggestion.SUGGESTED) + node.isSelected = true + + if (file.isDirectory) { + file.listFiles()?.forEach { + val subNode = getTreeItem(it, basePath + "/" + it.name) + if (subNode != null) { + node.isSelected = subNode.isSelected or node.isSelected + if (!subNode.isSelected) + node.isIndeterminate = true + node.children += subNode + } + } + if (!node.isSelected) node.isIndeterminate = false + + // Empty folder need not to be displayed. + if (node.children.isEmpty()) + return null + } + + return node.apply { + graphic = HBox().apply { + val checkbox = CheckBox() + checkbox.selectedProperty().bindBidirectional(node.selectedProperty()) + checkbox.indeterminateProperty().bindBidirectional(node.indeterminateProperty()) + children += checkbox + if (TRANSLATION.containsKey(basePath)) + children += Label().apply { + text = TRANSLATION[basePath] + style = "-fx-text-fill: gray;" + isMouseTransparent = true + } + isPickOnBounds = false + isExpanded = basePath == "minecraft" + } + } + } + + private fun getFilesNeeded(node: CheckBoxTreeItem?, basePath: String, list: MutableList) { + if (node == null) + return + if (node.isSelected) { + if (basePath.length > "minecraft/".length) + list += basePath.substring("minecraft/".length) + for (child in node.children) + getFilesNeeded(child as? CheckBoxTreeItem?, basePath + "/" + child.value, list) + return + } + } + + override fun cleanup(settings: MutableMap) { + controller.settings.remove(MODPACK_FILE_SELECTION) + } + + fun onNext() { + val list = LinkedList() + getFilesNeeded(rootNode, "minecraft", list) + controller.settings[MODPACK_FILE_SELECTION] = list + controller.onFinish() + } + + companion object { + val MODPACK_FILE_SELECTION = "modpack.accepted" + + private val TRANSLATION = mapOf( + "minecraft/servers.dat" to i18n("modpack.files.servers_dat"), + "minecraft/saves" to i18n("modpack.files.saves"), + "minecraft/mods" to i18n("modpack.files.mods"), + "minecraft/config" to i18n("modpack.files.config"), + "minecraft/liteconfig" to i18n("modpack.files.liteconfig"), + "minecraft/resourcepacks" to i18n("modpack.files.resourcepacks"), + "minecraft/resources" to i18n("modpack.files.resourcepacks"), + "minecraft/options.txt" to i18n("modpack.files.options_txt"), + "minecraft/optionsshaders.txt" to i18n("modpack.files.optionsshaders_txt"), + "minecraft/mods/VoxelMods" to i18n("modpack.files.mods.voxelmods"), + "minecraft/dumps" to i18n("modpack.files.dumps"), + "minecraft/blueprints" to i18n("modpack.files.blueprints"), + "minecraft/scripts" to i18n("modpack.files.scripts") + ) + } +} \ No newline at end of file diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/export/ModpackInfoPage.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/export/ModpackInfoPage.kt new file mode 100644 index 000000000..ac0ec6460 --- /dev/null +++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/export/ModpackInfoPage.kt @@ -0,0 +1,99 @@ +/* + * Hello Minecraft! Launcher. + * Copyright (C) 2017 huangyuhui + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see {http://www.gnu.org/licenses/}. + */ +package org.jackhuang.hmcl.ui.export + +import com.jfoenix.controls.JFXButton +import com.jfoenix.controls.JFXTextArea +import com.jfoenix.controls.JFXTextField +import com.jfoenix.controls.JFXToggleButton +import javafx.fxml.FXML +import javafx.scene.control.Label +import javafx.scene.control.ScrollPane +import javafx.scene.layout.StackPane +import javafx.stage.FileChooser +import org.jackhuang.hmcl.i18n +import org.jackhuang.hmcl.setting.Profile +import org.jackhuang.hmcl.setting.Settings +import org.jackhuang.hmcl.ui.Controllers +import org.jackhuang.hmcl.ui.loadFXML +import org.jackhuang.hmcl.ui.smoothScrolling +import org.jackhuang.hmcl.ui.wizard.WizardController +import org.jackhuang.hmcl.ui.wizard.WizardPage + +class ModpackInfoPage(private val controller: WizardController, version: String): StackPane(), WizardPage { + override val title: String = i18n("modpack.wizard.step.1.title") + @FXML lateinit var lblVersionName: Label + @FXML lateinit var txtModpackName: JFXTextField + @FXML lateinit var txtModpackAuthor: JFXTextField + @FXML lateinit var txtModpackVersion: JFXTextField + @FXML lateinit var txtModpackDescription: JFXTextArea + @FXML lateinit var chkIncludeLauncher: JFXToggleButton + @FXML lateinit var btnNext: JFXButton + @FXML lateinit var scroll: ScrollPane + + init { + loadFXML("/assets/fxml/modpack/info.fxml") + scroll.smoothScrolling() + txtModpackName.text = version + txtModpackName.textProperty().addListener { _ -> checkValidation() } + txtModpackAuthor.textProperty().addListener { _ -> checkValidation() } + txtModpackVersion.textProperty().addListener { _ -> checkValidation() } + txtModpackAuthor.text = Settings.selectedAccount?.username ?: "" + lblVersionName.text = version + } + + fun checkValidation() { + btnNext.isDisable = !txtModpackName.validate() || !txtModpackVersion.validate() || !txtModpackAuthor.validate() + } + + fun onNext() { + val fileChooser = FileChooser() + fileChooser.title = i18n("modpack.wizard.step.initialization.save") + fileChooser.extensionFilters += FileChooser.ExtensionFilter(i18n("modpack"), "*.zip") + val file = fileChooser.showSaveDialog(Controllers.stage) + if (file == null) { + Controllers.navigate(null) + return + } + controller.settings[MODPACK_NAME] = txtModpackName.text + controller.settings[MODPACK_VERSION] = txtModpackVersion.text + controller.settings[MODPACK_AUTHOR] = txtModpackAuthor.text + controller.settings[MODPACK_FILE] = file + controller.settings[MODPACK_DESCRIPTION] = txtModpackDescription.text + controller.settings[MODPACK_INCLUDE_LAUNCHER] = chkIncludeLauncher.isSelected + controller.onNext() + } + + override fun cleanup(settings: MutableMap) { + controller.settings.remove(MODPACK_NAME) + controller.settings.remove(MODPACK_VERSION) + controller.settings.remove(MODPACK_AUTHOR) + controller.settings.remove(MODPACK_DESCRIPTION) + controller.settings.remove(MODPACK_INCLUDE_LAUNCHER) + controller.settings.remove(MODPACK_FILE) + } + + companion object { + const val MODPACK_NAME = "modpack.name" + const val MODPACK_VERSION = "modpack.version" + const val MODPACK_AUTHOR = "modpack.author" + const val MODPACK_DESCRIPTION = "modpack.description" + const val MODPACK_INCLUDE_LAUNCHER = "modpack.include_launcher" + const val MODPACK_FILE = "modpack.file" + } +} \ No newline at end of file diff --git a/HMCL/src/main/resources/assets/css/jfoenix-main-demo.css b/HMCL/src/main/resources/assets/css/jfoenix-main-demo.css index bfa4cbc73..d09624959 100644 --- a/HMCL/src/main/resources/assets/css/jfoenix-main-demo.css +++ b/HMCL/src/main/resources/assets/css/jfoenix-main-demo.css @@ -498,7 +498,7 @@ } .jfx-text-area .viewport { - -fx-background-color: #F4F4F4; + -fx-background-color: #ffffff; } /******************************************************************************* diff --git a/HMCL/src/main/resources/assets/fxml/download/installers.fxml b/HMCL/src/main/resources/assets/fxml/download/installers.fxml index cea2b8283..e4bd743c3 100644 --- a/HMCL/src/main/resources/assets/fxml/download/installers.fxml +++ b/HMCL/src/main/resources/assets/fxml/download/installers.fxml @@ -48,7 +48,7 @@ - + diff --git a/HMCL/src/main/resources/assets/fxml/download/modpack.fxml b/HMCL/src/main/resources/assets/fxml/download/modpack.fxml index db94ebabf..a414583fb 100644 --- a/HMCL/src/main/resources/assets/fxml/download/modpack.fxml +++ b/HMCL/src/main/resources/assets/fxml/download/modpack.fxml @@ -5,27 +5,26 @@ + + - - + + + + + + + + + + + + + + + + + diff --git a/HMCL/src/main/resources/assets/fxml/modpack/info.fxml b/HMCL/src/main/resources/assets/fxml/modpack/info.fxml new file mode 100644 index 000000000..414495350 --- /dev/null +++ b/HMCL/src/main/resources/assets/fxml/modpack/info.fxml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+
diff --git a/HMCL/src/main/resources/assets/fxml/modpack/selection.fxml b/HMCL/src/main/resources/assets/fxml/modpack/selection.fxml new file mode 100644 index 000000000..90b7cfb4b --- /dev/null +++ b/HMCL/src/main/resources/assets/fxml/modpack/selection.fxml @@ -0,0 +1,24 @@ + + + + + + + + + + + +
+ +
+ + + + + +
+
diff --git a/HMCL/src/main/resources/assets/fxml/version.fxml b/HMCL/src/main/resources/assets/fxml/version.fxml index 1d9ec61a7..f4d308881 100644 --- a/HMCL/src/main/resources/assets/fxml/version.fxml +++ b/HMCL/src/main/resources/assets/fxml/version.fxml @@ -16,6 +16,11 @@ + + + + + diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index d5bc88ad0..0e94890dc 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -176,8 +176,8 @@ ui.message.update_java=Please upgrade your Java. ui.message.open_jdk=We have found that you started this application using OpenJDK, which will cause so many troubles drawing the UI. We suggest you using Oracle JDK instead. ui.label.settings=Settings -ui.label.crashing=Hello Minecraft! Launcher has crashed! -ui.label.crashing_out_dated=Hello Minecraft! Launcher has crashed! Your launcher is outdated. Update it! +ui.label.crashing=Hello Minecraft! Launcher has crashed! +ui.label.crashing_out_dated=Hello Minecraft! Launcher has crashed! Your launcher is outdated. Update it! ui.label.failed_set=Failed to set: download=Download @@ -227,8 +227,8 @@ settings.failed_load=Failed to load settings file. Remove it? settings.test_game=Test game settings.type.none=No version here, please turn to game download tab. -settings.type.global=Click here to switch to version specialized setting. Now it is global setting. -settings.type.special=Click here to switch to global setting. Not it is version specialized setting. +settings.type.global=Click here to switch to version specialized setting. Now it is global setting. +settings.type.special=Click here to switch to global setting. Not it is version specialized setting. modpack=Mod pack modpack.choose=Choose a modpack zip file which you want to import. If you want to update the modpack, please enter the version you want to update. @@ -249,9 +249,9 @@ modpack.wizard.step.1.title=Set the basic options to the modpack. modpack.wizard.step.initialization.include_launcher=Include the launcher modpack.wizard.step.initialization.exported_version=The exported game version modpack.wizard.step.initialization.save=Choose a location to export the game files to -modpack.wizard.step.initialization.warning=Before making modpack, you should ensure that your game can launch successfully,
and that your Minecraft is release, not snapshot.
and that it is not allowed to add mods which is not allowed to distribute to the modpack. +modpack.wizard.step.initialization.warning=Before making modpack, you should ensure that your game can launch successfully,\nand that your Minecraft is release, not snapshot.\nand that it is not allowed to add mods which is not allowed to distribute to the modpack. modpack.wizard.step.2=Files selection -modpack.wizard.step.2.title=Choose the files you do not want to put in the modpack. +modpack.wizard.step.2.title=Choose the files you want to put into the modpack. modpack.wizard.step.3=Description modpack.wizard.step.3.title=Describe your modpack. @@ -281,7 +281,7 @@ mods.choose_mod=Choose your mods mods.failed=Failed to add mods mods.add=Add mods.remove=Remove -mods.default_information=Please ensure that you have installed Forge or LiteLoader before installing mods!
You can drop your mod files from explorer/finder, and delete mods by the delete button.
Disable a mod by leaving the check box unchecked; Choose an item to get the information.
+mods.default_information=Please ensure that you have installed Forge or LiteLoader before installing mods!\nYou can drop your mod files from explorer/finder, and delete mods by the delete button.\nDisable a mod by leaving the check box unchecked; Choose an item to get the information. advancedsettings=Advanced advancedsettings.launcher_visible=Launcher Visibility @@ -311,7 +311,7 @@ mainwindow.enter_script_name=Enter the script name. mainwindow.make_launch_succeed=Finished script creation. mainwindow.no_version=No version found. Switch to Game Downloads Tab? -launcher.about=About Author
Minecraft Forum ID: klkl6523
Copyright (c) 2013 huangyuhui
Opened source under GPL v3 license:http://github.com/huanghongxun/HMCL/
This software used project Gson which is under Apache License 2.0, thanks contributors. +launcher.about=About Author\nMinecraft Forum ID: klkl6523\nCopyright (c) 2013 huangyuhui\nOpened source under GPL v3 license:http://github.com/huanghongxun/HMCL/\nThis software used project Gson which is under Apache License 2.0, thanks contributors. launcher.download_source=Download Source launcher.background_location=Background Location launcher.common_location=Common Location @@ -321,8 +321,8 @@ launcher.versions_json_not_matched_cannot_auto_completion=The version %s lost ve launcher.versions_json_not_formatted=The version information of %s is malformed! Redownload it? launcher.choose_bgpath=Choose background path. launcher.choose_commonpath=Choose common path. -launcher.commpath_tooltip=This app will save all game libraries and assets here unless there are existant files in game folder. -launcher.background_tooltip=The laucher uses a default background.
If you use custom background.png, link it and it will be used.
If there is "bg" subdirectory, this app will chooses one picture in "bgskin" randomly.
If you set the background setting, this app will use it. +launcher.commpath_tooltip=This app will save all game libraries and assets here unless there are existant files in game folder. +launcher.background_tooltip=The laucher uses a default background.\nIf you use custom background.png, link it and it will be used.\nIf there is "bg" subdirectory, this app will chooses one picture in "bgskin" randomly.\nIf you set the background setting, this app will use it. launcher.update_launcher=Check for update launcher.enable_shadow=Enable Window Shadow launcher.enable_animation=Enable Animation @@ -330,7 +330,7 @@ launcher.enable_blur=Enable Blur launcher.theme=Theme launcher.proxy=Proxy launcher.decorated=Enable system window border(in order to fix the problem that the ui become all gray in Linux OS) -launcher.modpack=Documentations for modpacks. +launcher.modpack=Documentations for modpacks. launcher.lang=Language launcher.restart=Options will be in operations only if restart this app. launcher.log_font=Log Font diff --git a/HMCL/src/main/resources/assets/lang/I18N_ru.properties b/HMCL/src/main/resources/assets/lang/I18N_ru.properties index 660d983d2..16aaa89e8 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ru.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ru.properties @@ -176,8 +176,8 @@ ui.message.update_java=Пожалуйста, обновите ваш Java. ui.message.open_jdk=Мы уже выяснили, что вы начали это приложение, используя OpenJDK, который станет причиной стольких бед для рисования интерфейса. Мы предлагаем Вам вместо того, чтобы с помощью Oracle версии JDK. ui.label.settings=Настройки -ui.label.crashing=Launcher крашнулся! -ui.label.crashing_out_dated=Launcher крашнулся! Ваш лаунчер устарел. Обновить его +ui.label.crashing=Launcher крашнулся! +ui.label.crashing_out_dated=Launcher крашнулся! Ваш лаунчер устарел. Обновить его ui.label.failed_set=Не удалось установить: download=Скачать @@ -227,8 +227,8 @@ settings.failed_load=Не смог файл загрузить настройк settings.test_game=Тестовая игра settings.type.none=Нет версии игры, пожалуйста, откройте раздел скачать игру. -settings.type.global=Нажмите здесь, чтобы перейти в специализированных версий. Сейчас это глобальная настройка. -settings.type.special=Нажмите здесь, чтобы перейти в глобальные настройки. Не это версии специализированных условиях. +settings.type.global=Нажмите здесь, чтобы перейти в специализированных версий. Сейчас это глобальная настройка. +settings.type.special=Нажмите здесь, чтобы перейти в глобальные настройки. Не это версии специализированных условиях. modpack=Мод пак modpack.choose=Выбрать zip-файл, пакет, который вы хотите импортировать. Если вы хотите обновить пакет, пожалуйста, введите версию вы хотите обновить. @@ -249,7 +249,7 @@ modpack.wizard.step.1.title=Набор основных вариантов modpa modpack.wizard.step.initialization.include_launcher=Включить лаунчер modpack.wizard.step.initialization.exported_version=Экспортируемые версии игры modpack.wizard.step.initialization.save=Выберите папку для экспорта игровых файлов для -modpack.wizard.step.initialization.warning=Прежде чем сделать modpack, вы должны убедиться, что ваша игра сможет успешно запустить,
и что ваш minecraft-это релиз, а не снимок.
а что нельзя добавить модов, которые не позволили раздавать modpack. +modpack.wizard.step.initialization.warning=Прежде чем сделать modpack, вы должны убедиться, что ваша игра сможет успешно запустить,\nи что ваш minecraft-это релиз, а не снимок.\nа что нельзя добавить модов, которые не позволили раздавать modpack. modpack.wizard.step.2=Выбор файлов modpack.wizard.step.2.title=Выберите файлы, которые Вы не хотите положить в modpack. modpack.wizard.step.3=Описание @@ -281,7 +281,7 @@ mods.choose_mod=Выбрать ваши моды mods.failed=Не удалось добавить моды mods.add=Добавить mods.remove=Удалить -mods.default_information=Пожалуйста, убедитесь, что у вас есть установленный Forge или LiteLoader перед установкой модов!
Вы можете оставить свой mod файл из проводника/Finder и удаление модов с помощью кнопки удалить.
Отключить мод, оставив флажок снят; выбрать товар, чтобы получить информацию.
+mods.default_information=Пожалуйста, убедитесь, что у вас есть установленный Forge или LiteLoader перед установкой модов!\nВы можете оставить свой mod файл из проводника/Finder и удаление модов с помощью кнопки удалить.\nОтключить мод, оставив флажок снят; выбрать товар, чтобы получить информацию. advancedsettings=Расширенный advancedsettings.launcher_visible=При запуске Minecraft @@ -311,7 +311,7 @@ mainwindow.enter_script_name=Введите имя скрипта. mainwindow.make_launch_succeed=Закончил создание скрипта. mainwindow.no_version=Версии Minecraft не найдены. Переключить на вкладку загрузки версии для игры в Minecraft? -launcher.about=Об Авторе
Майнкрафт форум ID: klkl6523
Copyright (c) 2013 huangyuhui
Opened source under GPL v3 license:http://github.com/huanghongxun/HMCL/
This software used project Gson which is under Apache License 2.0, thanks contributors. +launcher.about=Об Авторе\nМайнкрафт форум ID: klkl6523\nCopyright (c) 2013 huangyuhui\nOpened source under GPL v3 license:http://github.com/huanghongxun/HMCL/\nThis software used project Gson which is under Apache License 2.0, thanks contributors. launcher.download_source=Скачать Исходники launcher.background_location=Фон Расположение launcher.common_location=Общее Расположение @@ -321,8 +321,8 @@ launcher.versions_json_not_matched_cannot_auto_completion=Версия %s пот launcher.versions_json_not_formatted=Сведения о версии %s уродлив! Повторная загрузка? launcher.choose_bgpath=Выберите фоновый пути. launcher.choose_commonpath=Выбрать общий путь. -launcher.commpath_tooltip=Это приложение будет сохранять все игровые библиотеки здесь, если там нет файлов в папке с игрой. -launcher.background_tooltip=Лаучер использует по умолчанию фон.
Если вы используете пользовательский фон.PNG, ссылку и оно будет использоваться.
Если есть "БГ" подкаталог, это приложение выбирает одну картинку в "bgskin" случайно.
Если вы установите параметр фон, это приложение будет использовать его. +launcher.commpath_tooltip=Это приложение будет сохранять все игровые библиотеки здесь, если там нет файлов в папке с игрой. +launcher.background_tooltip=Лаучер использует по умолчанию фон.\nЕсли вы используете пользовательский фон.PNG, ссылку и оно будет использоваться.\nЕсли есть "БГ" подкаталог, это приложение выбирает одну картинку в "bgskin" случайно.\nЕсли вы установите параметр фон, это приложение будет использовать его. launcher.update_launcher=Проверить обновления launcher.enable_shadow=Включить тень окна launcher.enable_animation=Включить анимацию @@ -330,7 +330,7 @@ launcher.enable_blur=Включить размытие launcher.theme=Тема launcher.proxy=Прокси launcher.decorated=Включить границы окна(для того, чтобы исправить проблему, если в пользовательском интерфейсе становится все серое в ОС Linux) -launcher.modpack=Документация по modpacks. +launcher.modpack=Документация по modpacks. launcher.lang=Язык (Language) launcher.restart=Варианты будут в операции, только если перезапустить это приложение. launcher.log_font=Шрифт лога diff --git a/HMCL/src/main/resources/assets/lang/I18N_vi.properties b/HMCL/src/main/resources/assets/lang/I18N_vi.properties index 5dccf6d98..477e9a4a3 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_vi.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_vi.properties @@ -173,8 +173,8 @@ ui.message.sure_remove=Bạn có chắc chắn xóa cấu hình %s không? ui.message.update_java=Hãy cập nhật phiên bản java của bạn. ui.label.settings=Cài đặt -ui.label.crashing=HMCL Minecraft Launcher đã bị crash! -ui.label.crashing_out_dated=HL Minecraft Launcher đã bị crash! Và launcher của bạn không phải là phiên bản mới nhất. cập nhật nó đi! +ui.label.crashing=HMCL Minecraft Launcher đã bị crash! +ui.label.crashing_out_dated=HL Minecraft Launcher đã bị crash! Và launcher của bạn không phải là phiên bản mới nhất. cập nhật nó đi! ui.label.failed_set=Failed to set: ui.message.open_jdk=We have found that you started this application using OpenJDK, which will cause so many troubles drawing the UI. We suggest you using Oracle JDK instead. @@ -225,8 +225,8 @@ settings.failed_load=Đọc file cấu hình thất bại. Xóa nó không? settings.test_game=Chạy thử game settings.type.none=No version here, please turn to game download tab. -settings.type.global=Click here to switch to version specialized setting. Now it is global setting. -settings.type.special=Click here to switch to global setting. Not it is version specialized setting. +settings.type.global=Click here to switch to version specialized setting. Now it is global setting. +settings.type.special=Click here to switch to global setting. Not it is version specialized setting. modpack=Mod pack modpack.choose=Chọn modpack zip file mà bạn muốn nhập vào. Nếu bạn muốn cập nhật phiên bản của modpack, Hãy nhập vào phiên bản bạn muốn cập nhật. @@ -247,7 +247,7 @@ modpack.wizard.step.1.title=Chọn các tùy chọn cơ bản cho modpack. modpack.wizard.step.initialization.include_launcher=Include the launcher modpack.wizard.step.initialization.exported_version=Phiên bản đã được xuất modpack.wizard.step.initialization.save=Chọn một thư mục mà bạn muốn xuất game data -modpack.wizard.step.initialization.warning=Trước khi tạo modpack, bạn phải chắc chắn rằng minecraft có thể chạy,
và phiên bản minecraft là chính thức, không phải là snapshot.
và nó không cho thêm mods mà không có quyền để tạo modpack. +modpack.wizard.step.initialization.warning=Trước khi tạo modpack, bạn phải chắc chắn rằng minecraft có thể chạy,\nvà phiên bản minecraft là chính thức, không phải là snapshot.\nvà nó không cho thêm mods mà không có quyền để tạo modpack. modpack.wizard.step.2=Chọn file modpack.wizard.step.2.title=Chọn file bạn không muốn thêm vào modpack modpack.wizard.step.3=Miêu tả @@ -279,7 +279,7 @@ mods.choose_mod=Chọn mods mods.failed=Tải mods thất bại mods.add=Thêm mods.remove=Xóa -mods.default_information=Bạn hãy chắc chắn rằng bạn đã cài Forge hoặc LiteLoader trước khi cài mods!
Bạn có thể kéo file mods vào trong cửa sổ này để thêm, và xóa mods bằng cách ấn nút xóa.
Tắt mods bằng cách bỏ dấu v ở chỗ hộp kiểm; Chọn một mục để biết thêm thông tin.
+mods.default_information=Bạn hãy chắc chắn rằng bạn đã cài Forge hoặc LiteLoader trước khi cài mods!\nBạn có thể kéo file mods vào trong cửa sổ này để thêm, và xóa mods bằng cách ấn nút xóa.\nTắt mods bằng cách bỏ dấu v ở chỗ hộp kiểm; Chọn một mục để biết thêm thông tin. advancedsettings=Nâng cao advancedsettings.launcher_visible=Sự hiển thị của launcher @@ -309,7 +309,7 @@ mainwindow.enter_script_name=Nhập tên của đoạn mã. mainwindow.make_launch_succeed=Đã tạo đoạn mã. mainwindow.no_version=Không có phiên bản minecraft nào được tìm thấy. Chuyển sang tab Game Download? -launcher.about=Về tác giả
Minecraft Forum ID: klkl6523
Copyright (c) 2013 huangyuhui
http://github.com/huanghongxun/HMCL/
Phần mềm này dùng project Gson, cảm ơn người đóng góp. +launcher.about=Về tác giả\nMinecraft Forum ID: klkl6523\nCopyright (c) 2013 huangyuhui\nhttp://github.com/huanghongxun/HMCL/\nPhần mềm này dùng project Gson, cảm ơn người đóng góp. launcher.download_source=Download Source launcher.background_location=Background Location launcher.common_location=Common Location @@ -319,8 +319,8 @@ launcher.versions_json_not_matched_cannot_auto_completion=The version %s lost ve launcher.versions_json_not_formatted=The version information of %s is malformed! Redownload it? launcher.choose_bgpath=Choose background path. launcher.choose_commonpath=Choose common path. -launcher.commpath_tooltip=This app will save all game libraries and assets here unless there are existant files in game folder. -launcher.background_tooltip=This app uses the default background at first.
If there is background.png in the directory, it will be used.
If there is "bg" subdirectory, this app will chooses one picture in "bgskin" randomly.
If you set the background setting, this app will use it. +launcher.commpath_tooltip=This app will save all game libraries and assets here unless there are existant files in game folder. +launcher.background_tooltip=This app uses the default background at first.\nIf there is background.png in the directory, it will be used.\nIf there is "bg" subdirectory, this app will chooses one picture in "bgskin" randomly.\nIf you set the background setting, this app will use it. launcher.update_launcher=Check for update launcher.enable_shadow=Enable Window Shadow launcher.enable_animation=Enable Animation @@ -328,7 +328,7 @@ launcher.enable_blur=Enable Blur launcher.theme=Theme launcher.proxy=Proxy launcher.decorated=Enable system window border(in order to fix the problem that the ui become all gray in Linux OS) -launcher.modpack=Documentations for modpacks. +launcher.modpack=Documentations for modpacks. launcher.lang=Language launcher.restart=Options will be in operations only if restart this app. launcher.log_font=Log Font diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index 04ebfa863..62631e2d0 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -176,8 +176,8 @@ ui.message.update_java=請更新您的Java ui.message.open_jdk=我們發現到您正在使用OpenJDK,這可能會導致很多介面問題,我們建議您更換Oracle JDK。 ui.label.settings=選項 -ui.label.crashing=Hello Minecraft! Launcher遇到了無法處理的錯誤,請複制下列內容並通過mcbbs、貼吧或Minecraft Forum反饋bug。 -ui.label.crashing_out_dated=Hello Minecraft! Launcher遇到了無法處理的錯誤,已檢測到您的啟動器不是最新版本,請更新後再試! +ui.label.crashing=Hello Minecraft! Launcher遇到了無法處理的錯誤,請複制下列內容並通過mcbbs、貼吧或Minecraft Forum反饋bug。 +ui.label.crashing_out_dated=Hello Minecraft! Launcher遇到了無法處理的錯誤,已檢測到您的啟動器不是最新版本,請更新後再試! ui.label.failed_set=設定失敗: download=下載 @@ -227,8 +227,8 @@ settings.failed_load=設定資料加載失敗,可能是升級了啟動器或 settings.test_game=測試遊戲 settings.type.none=缺少游戲版本,請切換到遊戲下載頁下載遊戲 -settings.type.global=點擊此處切換為版本特定設定。該版本正在使用全局設定,修改以下設定會影響到其他使用全局設定的版本 -settings.type.special=點擊此處切換為全局設定。該版本正在使用版本特定設定,修改以下設定不會影響到其他版本設定 +settings.type.global=點擊此處切換為版本特定設定。該版本正在使用全局設定,修改以下設定會影響到其他使用全局設定的版本 +settings.type.special=點擊此處切換為全局設定。該版本正在使用版本特定設定,修改以下設定不會影響到其他版本設定 modpack=懶人包 modpack.choose=選擇要導入的遊戲懶人包資料,如果您希望更新懶人包,請輸入要更新的版本名 @@ -249,9 +249,9 @@ modpack.wizard.step.1.title=設定懶人包的主要資訊 modpack.wizard.step.initialization.include_launcher=包含啟動器 modpack.wizard.step.initialization.exported_version=要導出的遊戲版本 modpack.wizard.step.initialization.save=選擇要導出到的遊戲懶人包位置 -modpack.wizard.step.initialization.warning=在製作懶人包前,請您確認您選擇的版本可以正常啟動,
並保證您的Minecraft是正式版而非快照版,
而且不應當將不允許非官方途徑傳播的Mod、材質包等納入整合包。
懶人包會保存您目前的下載源設定 +modpack.wizard.step.initialization.warning=在製作懶人包前,請您確認您選擇的版本可以正常啟動,\n並保證您的Minecraft是正式版而非快照版,\n而且不應當將不允許非官方途徑傳播的Mod、材質包等納入整合包。\n懶人包會保存您目前的下載源設定 modpack.wizard.step.2=資料選擇 -modpack.wizard.step.2.title=選中你不想加到懶人包中的資料(夾) +modpack.wizard.step.2.title=選中你想加到懶人包中的資料(夾) modpack.wizard.step.3=懶人包描述 modpack.wizard.step.3.title=描述你要製作的懶人包。 @@ -281,7 +281,7 @@ mods.choose_mod=選擇模組 mods.failed=添加失敗 mods.add=添加 mods.remove=刪除 -mods.default_information=您可以拖動mod到列表中來添加mod,同時使用刪除鍵可快速刪除選中mod
選擇mod可以獲取mod資訊 +mods.default_information=您可以拖動mod到列表中來添加mod,同時使用刪除鍵可快速刪除選中mod\n選擇mod可以獲取mod資訊 advancedsettings=進階設定 advancedsettings.launcher_visible=啟動器可見性 @@ -311,7 +311,7 @@ mainwindow.enter_script_name=輸入要生成腳本的資料名 mainwindow.make_launch_succeed=啟動腳本已生成完畢: mainwindow.no_version=未找到任何版本,是否進入遊戲下載? -launcher.about=預設背景圖感謝gamerteam提供。
關於作者:
百度ID:huanghongxun20
mcbbs:huanghongxun
Minecraft Forum ID: klkl6523
歡迎提交Bug哦
Copyright (c) 2013-2016 huangyuhui.
免責聲明:Minecraft軟體版權歸Mojang AB所有,遊戲由於誤操作本啟動器而丟失數據的概不負責。
本啟動器在GPLv3協議下開源:http://github.com/huanghongxun/HMCL/ ,感謝issues和pull requests貢獻者
本軟體使用了基於Apache License 2.0的Gson項目,感謝貢獻者。 +launcher.about=預設背景圖感謝gamerteam提供。\n關於作者:\n百度ID:huanghongxun20\nmcbbs:huanghongxun\nMinecraft Forum ID: klkl6523\n歡迎提交Bug哦\nCopyright (c) 2013-2016 huangyuhui.\n免責聲明:Minecraft軟體版權歸Mojang AB所有,遊戲由於誤操作本啟動器而丟失數據的概不負責。\n本啟動器在GPLv3協議下開源:http://github.com/huanghongxun/HMCL/ ,感謝issues和pull requests貢獻者\n本軟體使用了基於Apache License 2.0的Gson項目,感謝貢獻者。 launcher.download_source=下載源 launcher.background_location=背景地址 launcher.common_location=公用資料夾 @@ -321,8 +321,8 @@ launcher.versions_json_not_matched_cannot_auto_completion=版本%s缺失必要 launcher.versions_json_not_formatted=版本%s資訊資料格式錯誤,是否重新下載? launcher.choose_bgpath=選擇背景路徑 launcher.choose_commonpath=選擇公用路徑 -launcher.commpath_tooltip=啟動器將所有遊戲資源跟執行庫檔案放在此處集中管理。如果遊戲資料夾有現成的將不會使用公用庫檔案。 -launcher.background_tooltip=啟動器預設使用自帶的背景
如果當前目錄有background.png,則會使用該資料作為背景
如果當前目錄有bg子目錄,則會隨機使用裡面的一張圖作為背景
如果該背景位址被修改,則會使用背景位址裡的一張圖作為背景
背景位址允許有多個位址,使用半形分號";"(不包含雙引號)分隔 +launcher.commpath_tooltip=啟動器將所有遊戲資源跟執行庫檔案放在此處集中管理。如果遊戲資料夾有現成的將不會使用公用庫檔案。 +launcher.background_tooltip=啟動器預設使用自帶的背景\n如果當前目錄有background.png,則會使用該資料作為背景\n如果當前目錄有bg子目錄,則會隨機使用裡面的一張圖作為背景\n如果該背景位址被修改,則會使用背景位址裡的一張圖作為背景\n背景位址允許有多個位址,使用半形分號";"(不包含雙引號)分隔 launcher.update_launcher=檢查更新 launcher.enable_shadow=啟用窗口陰影 launcher.enable_animation=啟用動態效果 @@ -330,7 +330,7 @@ launcher.enable_blur=啟用主介面模糊 launcher.theme=主題 launcher.proxy=代理 launcher.decorated=啟用視窗邊框(Linux下可解決程式介面全灰問題) -launcher.modpack=整合包作者幫助 +launcher.modpack=整合包作者幫助 launcher.lang=語言 launcher.restart=本介面選項需要重啟本啟動器生效 launcher.log_font=日誌字體 diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index 71ca14f88..083505d52 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -176,8 +176,8 @@ ui.message.update_java=请更新您的Java ui.message.open_jdk=我们发现您正在使用OpenJDK,这会导致很多界面问题,我们建议您更换Oracle JDK。 ui.label.settings=选项 -ui.label.crashing=Hello Minecraft!遇到了无法处理的错误,请复制下列内容并通过mcbbs、贴吧、Github或Minecraft Forum反馈bug。 -ui.label.crashing_out_dated=Hello Minecraft! Launcher遇到了无法处理的错误,已检测到您的启动器不是最新版本,请更新后再试! +ui.label.crashing=Hello Minecraft!遇到了无法处理的错误,请复制下列内容并通过mcbbs、贴吧、Github或Minecraft Forum反馈bug。 +ui.label.crashing_out_dated=Hello Minecraft! Launcher遇到了无法处理的错误,已检测到您的启动器不是最新版本,请更新后再试! ui.label.failed_set=设置失败: download=下载 @@ -227,8 +227,8 @@ settings.failed_load=设置文件加载失败,可能是升级了启动器或 settings.test_game=测试游戏 settings.type.none=缺少游戏版本,请切换到游戏下载页下载游戏 -settings.type.global=点击此处切换为版本特定设置。该版本正在使用全局设置,修改以下设置会影响到其他使用全局设置的版本 -settings.type.special=点击此处切换为全局设置。该版本正在使用版本特定设置,修改以下设置不会影响到其他版本设置 +settings.type.global=点击此处切换为版本特定设置。该版本正在使用全局设置,修改以下设置会影响到其他使用全局设置的版本 +settings.type.special=点击此处切换为全局设置。该版本正在使用版本特定设置,修改以下设置不会影响到其他版本设置 modpack=整合包 modpack.choose=选择要导入的游戏整合包文件,如果您希望更新整合包,请输入要更新的版本名 @@ -237,6 +237,7 @@ modpack.export_finished=整合包导出完成,参见 modpack.included_launcher=整合包已包含启动器,可直接发布 modpack.not_included_launcher=整合包未包含启动器,可使用本软件的导入整合包功能导入整合包 modpack.enter_name=给游戏起个你喜欢的名字 +modpack.author=作者 modpack.task.save=导出整合包 modpack.task.install=导入整合包 @@ -249,9 +250,9 @@ modpack.wizard.step.1.title=设置整合包的主要信息 modpack.wizard.step.initialization.include_launcher=包含启动器 modpack.wizard.step.initialization.exported_version=要导出的游戏版本 modpack.wizard.step.initialization.save=选择要导出到的游戏整合包位置 -modpack.wizard.step.initialization.warning=在制作整合包前,请您确认您选择的版本可以正常启动,
并保证您的Minecraft是正式版而非快照版,
而且不应当将不允许非官方途径传播的Mod、材质包等纳入整合包。
整合包会保存您目前的下载源设置 +modpack.wizard.step.initialization.warning=在制作整合包前,请您确认您选择的版本可以正常启动,\n并保证您的Minecraft是正式版而非快照版,\n而且不应当将不允许非官方途径传播的Mod、材质包等纳入整合包。\n整合包会保存您目前的下载源设置 modpack.wizard.step.2=文件选择 -modpack.wizard.step.2.title=选中你不想加到整合包中的文件(夹) +modpack.wizard.step.2.title=选中你想加到整合包中的文件(夹) modpack.wizard.step.3=整合包描述 modpack.wizard.step.3.title=描述你要制作的整合包 @@ -281,7 +282,7 @@ mods.choose_mod=选择模组 mods.failed=添加失败 mods.add=添加 mods.remove=删除 -mods.default_information=安装Mod前你需要确保已安装Forge或LiteLoader!
您可以从资源管理器拖动mod文件到列表中来添加mod,同时使用删除键可快速删除选中mod
点掉mod前面的勾可禁用mod,不会加载;选择mod可以获取mod信息
+mods.default_information=安装Mod前你需要确保已安装Forge或LiteLoader!\n您可以从资源管理器拖动mod文件到列表中来添加mod,同时使用删除键可快速删除选中mod\n点掉mod前面的勾可禁用mod,不会加载;选择mod可以获取mod信息 advancedsettings=高级设置 advancedsettings.launcher_visible=启动器可见性 @@ -311,7 +312,7 @@ mainwindow.enter_script_name=输入要生成脚本的文件名 mainwindow.make_launch_succeed=启动脚本已生成完毕: mainwindow.no_version=未找到任何版本,是否进入游戏下载? -launcher.about=默认背景图感谢gamerteam提供。
关于作者:
百度ID:huanghongxun20
mcbbs:huanghongxun
Minecraft Forum ID: klkl6523
欢迎提交Bug哦
Copyright (c) 2013-2017 huangyuhui.
免责声明:Minecraft软件版权归Mojang AB所有,使用本软件产生的版权问题本软件制作方概不负责。
本启动器在GPLv3协议下开源:https://github.com/huanghongxun/HMCL/ ,感谢issues和pull requests贡献者
本软件使用了基于Apache License 2.0的Gson项目,感谢贡献者。 +launcher.about=默认背景图感谢gamerteam提供。\n关于作者:\n百度ID:huanghongxun20\nmcbbs:huanghongxun\nMinecraft Forum ID: klkl6523\n欢迎提交Bug哦\nCopyright (c) 2013-2017 huangyuhui.\n免责声明:Minecraft软件版权归Mojang AB所有,使用本软件产生的版权问题本软件制作方概不负责。\n本启动器在GPLv3协议下开源:https://github.com/huanghongxun/HMCL/ ,感谢issues和pull requests贡献者\n本软件使用了基于Apache License 2.0的Gson项目,感谢贡献者。 launcher.download_source=下载源 launcher.background_location=背景地址 launcher.common_location=公共文件夹 @@ -321,8 +322,8 @@ launcher.versions_json_not_matched_cannot_auto_completion=版本%s缺失必要 launcher.versions_json_not_formatted=版本%s信息文件格式错误,是否重新下载? launcher.choose_bgpath=选择背景路径 launcher.choose_commonpath=选择公共路径 -launcher.commpath_tooltip=启动器将所有游戏资源及依赖库文件放于此集中管理,如果游戏文件夹内有现成的将不会使用公共库文件 -launcher.background_tooltip=启动器默认使用自带的背景
如果当前目录有background.png,则会使用该文件作为背景
如果当前目录有bg子目录,则会随机使用里面的一张图作为背景
如果该背景地址被修改,则会使用背景地址里的一张图作为背景
背景地址允许有多个地址,使用半角分号";"(不包含双引号)分隔 +launcher.commpath_tooltip=启动器将所有游戏资源及依赖库文件放于此集中管理,如果游戏文件夹内有现成的将不会使用公共库文件 +launcher.background_tooltip=启动器默认使用自带的背景\n如果当前目录有background.png,则会使用该文件作为背景\n如果当前目录有bg子目录,则会随机使用里面的一张图作为背景\n如果该背景地址被修改,则会使用背景地址里的一张图作为背景\n背景地址允许有多个地址,使用半角分号";"(不包含双引号)分隔 launcher.update_launcher=检查更新 launcher.enable_shadow=启用窗口阴影 launcher.enable_animation=启用动态效果 @@ -330,7 +331,7 @@ launcher.enable_blur=启用主界面模糊 launcher.theme=主题 launcher.proxy=代理 launcher.decorated=启用窗口边框(Linux下可解决程序界面全灰问题) -launcher.modpack=整合包作者帮助 +launcher.modpack=整合包作者帮助 launcher.lang=语言 launcher.restart=本界面选项需要重启本启动器生效 launcher.log_font=日志字体 diff --git a/HMCLCore/src/main/kotlin/org/jackhuang/hmcl/launch/Log4jHandler.kt b/HMCLCore/src/main/kotlin/org/jackhuang/hmcl/launch/Log4jHandler.kt index 9e2e14d6d..f353d9c22 100644 --- a/HMCLCore/src/main/kotlin/org/jackhuang/hmcl/launch/Log4jHandler.kt +++ b/HMCLCore/src/main/kotlin/org/jackhuang/hmcl/launch/Log4jHandler.kt @@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicBoolean * This class is to parse log4j classic XML layout logging, since only vanilla Minecraft will enable this layout. * Also supports plain logs. */ -internal class Log4jHandler(val callback: (String, Log4jLevel) -> Unit) : Thread() { +internal class Log4jHandler(private val callback: (String, Log4jLevel) -> Unit) : Thread() { val reader = XMLReaderFactory.createXMLReader().apply { contentHandler = Log4jHandlerImpl() } @@ -94,10 +94,10 @@ internal class Log4jHandler(val callback: (String, Log4jLevel) -> Unit) : Thread message = StringBuilder() val d = Date(attributes.getValue("timestamp").toLong()) date = df.format(d) - try { - l = Log4jLevel.valueOf(attributes.getValue("level")) + l = try { + Log4jLevel.valueOf(attributes.getValue("level")) } catch (e: IllegalArgumentException) { - l = Log4jLevel.INFO + Log4jLevel.INFO } thread = attributes.getValue("thread") diff --git a/HMCLCore/src/main/kotlin/org/jackhuang/hmcl/mod/Modpack.kt b/HMCLCore/src/main/kotlin/org/jackhuang/hmcl/mod/Modpack.kt index 1fcae50fe..86f829ede 100644 --- a/HMCLCore/src/main/kotlin/org/jackhuang/hmcl/mod/Modpack.kt +++ b/HMCLCore/src/main/kotlin/org/jackhuang/hmcl/mod/Modpack.kt @@ -19,9 +19,9 @@ package org.jackhuang.hmcl.mod data class Modpack @JvmOverloads constructor( val name: String = "", - val author: String = "", - val version: String = "", - val gameVersion: String = "", - val description: String = "", + val author: String? = null, + val version: String? = null, + val gameVersion: String? = null, + val description: String? = null, val manifest: Any? = null ) \ No newline at end of file diff --git a/HMCLCore/src/test/java/org/jackhuang/hmcl/Test.kt b/HMCLCore/src/test/java/org/jackhuang/hmcl/Test.kt index 2a2456d37..74531a9c2 100644 --- a/HMCLCore/src/test/java/org/jackhuang/hmcl/Test.kt +++ b/HMCLCore/src/test/java/org/jackhuang/hmcl/Test.kt @@ -30,6 +30,7 @@ import org.jackhuang.hmcl.launch.ProcessListener import org.jackhuang.hmcl.util.makeCommand import org.jackhuang.hmcl.task.Task import org.jackhuang.hmcl.task.TaskListener +import org.jackhuang.hmcl.util.Log4jLevel import java.io.File import java.net.InetSocketAddress import java.net.Proxy @@ -53,15 +54,11 @@ class Test { account = OfflineAccount.fromUsername("player007").logIn(), options = LaunchOptions(gameDir = repository.baseDirectory), listener = object : ProcessListener { - override fun onLog(log: String) { + override fun onLog(log: String, level: Log4jLevel) { println(log) } - override fun onErrorLog(log: String) { - System.err.println(log) - } - - override fun onExit(exitCode: Int) { + override fun onExit(exitCode: Int, exitType: ProcessListener.ExitType) { println("Process exited then exit code $exitCode") }