mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
shutdown: await log
This fixes that the help is not printed when providing invalid arguments
This commit is contained in:
parent
8ebe09f9eb
commit
95996ccb9d
@ -70,6 +70,7 @@ object Minosoft {
|
|||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val start = nanos()
|
val start = nanos()
|
||||||
Log::class.java.forceInit()
|
Log::class.java.forceInit()
|
||||||
|
ShutdownManager.addHook { Log.await() }
|
||||||
CommandLineArguments.parse(args)
|
CommandLineArguments.parse(args)
|
||||||
Log.log(LogMessageType.OTHER, LogLevels.INFO) { "Starting minosoft..." }
|
Log.log(LogMessageType.OTHER, LogLevels.INFO) { "Starting minosoft..." }
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ import de.bixilon.minosoft.protocol.network.connection.status.StatusConnection
|
|||||||
import de.bixilon.minosoft.protocol.network.network.client.netty.NettyClient
|
import de.bixilon.minosoft.protocol.network.network.client.netty.NettyClient
|
||||||
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
||||||
import de.bixilon.minosoft.protocol.protocol.buffers.OutByteBuffer
|
import de.bixilon.minosoft.protocol.protocol.buffers.OutByteBuffer
|
||||||
|
import de.bixilon.minosoft.terminal.RunConfiguration
|
||||||
import de.bixilon.minosoft.util.account.microsoft.MicrosoftOAuthUtils
|
import de.bixilon.minosoft.util.account.microsoft.MicrosoftOAuthUtils
|
||||||
import de.bixilon.minosoft.util.json.Jackson
|
import de.bixilon.minosoft.util.json.Jackson
|
||||||
import de.bixilon.minosoft.util.url.ResourceURLHandler
|
import de.bixilon.minosoft.util.url.ResourceURLHandler
|
||||||
@ -293,9 +294,11 @@ object KUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ShutdownManager += {
|
ShutdownManager += {
|
||||||
|
if (!RunConfiguration.DISABLE_EROS) {
|
||||||
Platform.exit()
|
Platform.exit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val Any.charCount: Int
|
val Any.charCount: Int
|
||||||
get() {
|
get() {
|
||||||
|
@ -114,10 +114,7 @@ object Log {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
val setLevel = levels?.get(type) ?: LogLevels.INFO
|
val setLevel = levels?.get(type) ?: LogLevels.INFO
|
||||||
if (setLevel.ordinal < level.ordinal) {
|
return setLevel.ordinal < level.ordinal
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun log(type: LogMessageType, level: LogLevels = LogLevels.INFO, additionalPrefix: ChatComponent? = null, message: Any?, vararg formatting: Any) {
|
fun log(type: LogMessageType, level: LogLevels = LogLevels.INFO, additionalPrefix: ChatComponent? = null, message: Any?, vararg formatting: Any) {
|
||||||
@ -191,4 +188,10 @@ object Log {
|
|||||||
}
|
}
|
||||||
log(type, additionalPrefix = null, messageBuilder = messageBuilder)
|
log(type, additionalPrefix = null, messageBuilder = messageBuilder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun await() {
|
||||||
|
while (this.QUEUE.isNotEmpty()) {
|
||||||
|
Thread.sleep(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user