diff --git a/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugins/PluginBase.kt b/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugins/PluginBase.kt index 4d1bd6f07..f43aa1685 100644 --- a/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugins/PluginBase.kt +++ b/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugins/PluginBase.kt @@ -9,9 +9,9 @@ package net.mamoe.mirai.console.plugins -import net.mamoe.mirai.console.command.Command import kotlinx.coroutines.* import net.mamoe.mirai.console.MiraiConsole +import net.mamoe.mirai.console.command.Command import net.mamoe.mirai.utils.DefaultLogger import net.mamoe.mirai.utils.MiraiLogger import net.mamoe.mirai.utils.SimpleLogger @@ -294,7 +294,7 @@ object PluginManager { } return try { val subClass = pluginClass.asSubclass(PluginBase::class.java) - val plugin: PluginBase = subClass.getDeclaredConstructor().newInstance() + val plugin: PluginBase = subClass.kotlin.objectInstance ?: subClass.getDeclaredConstructor().newInstance() description.loaded = true logger.info("successfully loaded plugin " + description.name + " version " + description.version + " by " + description.author) logger.info(description.info)