Commit e284267d authored by jiahua.liu's avatar jiahua.liu

mirai console shutdown logic

parent 2a82fe6b
...@@ -49,6 +49,8 @@ object MiraiConsole { ...@@ -49,6 +49,8 @@ object MiraiConsole {
var coreVersion = "v0.15.1" var coreVersion = "v0.15.1"
val build = "Beta" val build = "Beta"
var allDown = false
lateinit var frontEnd: MiraiConsoleUI lateinit var frontEnd: MiraiConsoleUI
fun start( fun start(
frontEnd: MiraiConsoleUI frontEnd: MiraiConsoleUI
...@@ -80,6 +82,7 @@ object MiraiConsole { ...@@ -80,6 +82,7 @@ object MiraiConsole {
fun stop() { fun stop() {
PluginManager.disableAllPlugins() PluginManager.disableAllPlugins()
allDown = true
bots.forEach { bots.forEach {
it.get()?.close() it.get()?.close()
} }
...@@ -290,6 +293,9 @@ object MiraiConsole { ...@@ -290,6 +293,9 @@ object MiraiConsole {
} }
tailrec fun processNextCommandLine() { tailrec fun processNextCommandLine() {
if (allDown) {
return
}
var fullCommand = commandChannel.poll() var fullCommand = commandChannel.poll()
if (fullCommand != null) { if (fullCommand != null) {
if (!fullCommand.startsWith("/")) { if (!fullCommand.startsWith("/")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment