mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 02:20:14 +08:00
Support for kotlin object PluginBase
This commit is contained in:
parent
df2a4a1b91
commit
227a0a5e1e
@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
package net.mamoe.mirai.console.plugins
|
package net.mamoe.mirai.console.plugins
|
||||||
|
|
||||||
import net.mamoe.mirai.console.command.Command
|
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import net.mamoe.mirai.console.MiraiConsole
|
import net.mamoe.mirai.console.MiraiConsole
|
||||||
|
import net.mamoe.mirai.console.command.Command
|
||||||
import net.mamoe.mirai.utils.DefaultLogger
|
import net.mamoe.mirai.utils.DefaultLogger
|
||||||
import net.mamoe.mirai.utils.MiraiLogger
|
import net.mamoe.mirai.utils.MiraiLogger
|
||||||
import net.mamoe.mirai.utils.SimpleLogger
|
import net.mamoe.mirai.utils.SimpleLogger
|
||||||
@ -294,7 +294,7 @@ object PluginManager {
|
|||||||
}
|
}
|
||||||
return try {
|
return try {
|
||||||
val subClass = pluginClass.asSubclass(PluginBase::class.java)
|
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
|
description.loaded = true
|
||||||
logger.info("successfully loaded plugin " + description.name + " version " + description.version + " by " + description.author)
|
logger.info("successfully loaded plugin " + description.name + " version " + description.version + " by " + description.author)
|
||||||
logger.info(description.info)
|
logger.info(description.info)
|
||||||
|
Loading…
Reference in New Issue
Block a user