HMCL modpack export
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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
|
||||
)
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user