mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 10:30:13 +08:00
Allow overriding MiraiConsole impl when stopped
This commit is contained in:
parent
c3fbff1807
commit
39f0eeb508
@ -265,7 +265,12 @@ public interface MiraiConsoleImplementation : CoroutineScope {
|
||||
@ConsoleFrontEndImplementation
|
||||
@Throws(MalformedMiraiConsoleImplementationError::class)
|
||||
public fun MiraiConsoleImplementation.start(): Unit = initLock.withLock {
|
||||
if (::instance.isInitialized) error("Mirai Console is already initialized.")
|
||||
if (::instance.isInitialized && instance.isActive) {
|
||||
error(
|
||||
"Mirai Console is already initialized and is currently running. " +
|
||||
"Run MiraiConsole.cancel to kill old instance before starting another instance."
|
||||
)
|
||||
}
|
||||
this@Companion.instance = this
|
||||
kotlin.runCatching {
|
||||
MiraiConsoleImplementationBridge.doStart()
|
||||
|
Loading…
Reference in New Issue
Block a user