Rename BuiltInExtensionSelector to SingletonExtensionSelectorImpl

This commit is contained in:
Him188 2021-12-26 18:56:41 +00:00
parent 1b0f30c4bf
commit 1cde9029b7
3 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@ import net.mamoe.mirai.console.extension.AbstractExtensionPoint
import net.mamoe.mirai.console.extension.Extension
import net.mamoe.mirai.console.extension.FunctionExtension
import net.mamoe.mirai.console.extension.SingletonExtension
import net.mamoe.mirai.console.internal.extension.BuiltInSingletonExtensionSelector
import net.mamoe.mirai.console.internal.extension.SingletonExtensionSelectorImpl
import net.mamoe.mirai.console.internal.extension.ExtensionRegistry
import net.mamoe.mirai.console.internal.extension.GlobalComponentStorage
import net.mamoe.mirai.console.plugin.Plugin
@ -55,7 +55,7 @@ public interface SingletonExtensionSelector : FunctionExtension {
check(instanceField == null) { "Internal error: reinitialize SingletonExtensionSelector" }
val instances = GlobalComponentStorage.run { SingletonExtensionSelector.getExtensions() }
instanceField = when {
instances.isEmpty() -> BuiltInSingletonExtensionSelector
instances.isEmpty() -> SingletonExtensionSelectorImpl
instances.size == 1 -> {
instances.single().also { (plugin, ext) ->
MiraiConsole.mainLogger.info { "Loaded SingletonExtensionSelector: $ext from ${plugin?.name ?: "<builtin>"}" }

View File

@ -32,7 +32,7 @@ import net.mamoe.mirai.console.internal.data.builtins.AutoLoginConfig.Account.Co
import net.mamoe.mirai.console.internal.data.builtins.AutoLoginConfig.Account.PasswordKind.MD5
import net.mamoe.mirai.console.internal.data.builtins.AutoLoginConfig.Account.PasswordKind.PLAIN
import net.mamoe.mirai.console.internal.data.builtins.LoggerConfig
import net.mamoe.mirai.console.internal.extension.BuiltInSingletonExtensionSelector
import net.mamoe.mirai.console.internal.extension.SingletonExtensionSelectorImpl
import net.mamoe.mirai.console.internal.extension.GlobalComponentStorage
import net.mamoe.mirai.console.internal.logging.LoggerControllerImpl
import net.mamoe.mirai.console.internal.logging.MiraiConsoleLogger
@ -164,7 +164,7 @@ internal object MiraiConsoleImplementationBridge : CoroutineScope,
phase("load SingletonExtensionSelector") {
SingletonExtensionSelector.init()
val instance = SingletonExtensionSelector.instance
if (instance is BuiltInSingletonExtensionSelector) {
if (instance is SingletonExtensionSelectorImpl) {
consoleDataScope.addAndReloadConfig(instance.config)
}
}

View File

@ -21,7 +21,7 @@ import net.mamoe.mirai.console.util.ConsoleInput
import net.mamoe.mirai.utils.info
import kotlin.reflect.KClass
internal object BuiltInSingletonExtensionSelector : SingletonExtensionSelector {
internal object SingletonExtensionSelectorImpl : SingletonExtensionSelector {
internal val config: SaveData = SaveData()