Skip to content

Commit

Permalink
unregister command when disable
Browse files Browse the repository at this point in the history
  • Loading branch information
PeratX committed Apr 11, 2022
1 parent c4ba713 commit 367f78a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/kotlin/org/itxtech/mcl/addon/PluginMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

package org.itxtech.mcl.addon

import net.mamoe.mirai.console.command.CommandManager.INSTANCE.unregister
import net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription
import net.mamoe.mirai.console.plugin.jvm.KotlinPlugin

Expand All @@ -43,11 +44,15 @@ object PluginMain : KotlinPlugin(
override fun onEnable() {
try {
Class.forName("org.itxtech.mcl.Loader")
addon = Addon()
} catch (e: Exception) {
logger.error("Mirai Console 并未通过 iTXTech Mirai Console Loader 加载。")
logger.error("请访问 https://github.com/iTXTech/mirai-console-loader")
return
}
addon = Addon()
}

override fun onDisable() {
MclcCommand.unregister()
MclCommand.unregister()
}
}

0 comments on commit 367f78a

Please sign in to comment.