Fix wrong initialization order

This commit is contained in:
Karlatemp 2020-06-20 20:46:00 +08:00
parent a21740ed3c
commit 4d69ae617f
No known key found for this signature in database
GPG Key ID: 21FBDDF664FF06F8

View File

@ -15,7 +15,6 @@ import kotlinx.io.charsets.Charset
import net.mamoe.mirai.Bot
import net.mamoe.mirai.console.plugin.PluginLoader
import net.mamoe.mirai.console.plugin.jvm.JarPluginLoader
import net.mamoe.mirai.console.plugin.jvm.JvmPlugin
import net.mamoe.mirai.utils.DefaultLogger
import net.mamoe.mirai.utils.MiraiExperimentalAPI
import net.mamoe.mirai.utils.MiraiLogger
@ -24,17 +23,23 @@ import java.io.File
import java.io.PrintStream
import kotlin.coroutines.CoroutineContext
/**
* mirai 控制台实例.
*/
object MiraiConsole : CoroutineScope, IMiraiConsole {
private lateinit var instance: IMiraiConsole
internal object MiraiConsoleInitializer {
internal lateinit var instance: IMiraiConsole
/** 由前端调用 */
internal fun init(instance: IMiraiConsole) {
this.instance = instance
}
}
/**
* mirai 控制台实例.
*/
object MiraiConsole : CoroutineScope, IMiraiConsole {
private val instance: IMiraiConsole
get() = MiraiConsoleInitializer.instance
/**
* `mirai-console` build
*/