mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-25 15:40:28 +08:00
Rename extension impls
This commit is contained in:
parent
3f0d123421
commit
7c3485ef9b
@ -11,6 +11,7 @@ package net.mamoe.mirai.console.extension
|
||||
|
||||
import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors
|
||||
import net.mamoe.mirai.console.command.parse.CommandCallParser
|
||||
import net.mamoe.mirai.console.command.resolve.CommandCallResolver
|
||||
import net.mamoe.mirai.console.extensions.*
|
||||
import net.mamoe.mirai.console.internal.extension.AbstractConcurrentComponentStorage
|
||||
import net.mamoe.mirai.console.permission.PermissionService
|
||||
@ -77,7 +78,7 @@ public class PluginComponentStorage(
|
||||
/** 注册一个 [PermissionServiceProvider] */
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
public fun contributePermissionService(lazyInstance: () -> PermissionService<*>): Unit =
|
||||
contribute(PermissionServiceProvider, plugin, LazyPermissionServiceProviderImpl(lazyInstance))
|
||||
contribute(PermissionServiceProvider, plugin, PermissionServiceProviderImplLazy(lazyInstance))
|
||||
|
||||
/** 注册一个 [PermissionServiceProvider] */
|
||||
@JvmName("contributePermissionServiceProvider")
|
||||
@ -90,7 +91,7 @@ public class PluginComponentStorage(
|
||||
/** 注册一个 [PluginLoaderProvider] */
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
public fun contributePluginLoader(lazyInstance: () -> PluginLoader<*, *>): Unit =
|
||||
contribute(PluginLoaderProvider, plugin, LazyPluginLoaderProviderImpl(lazyInstance))
|
||||
contribute(PluginLoaderProvider, plugin, PluginLoaderProviderImplLazy(lazyInstance))
|
||||
|
||||
/** 注册一个 [PluginLoaderProvider] */
|
||||
@JvmName("contributePluginLoaderProvider")
|
||||
@ -104,7 +105,7 @@ public class PluginComponentStorage(
|
||||
@ExperimentalCommandDescriptors
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
public fun contributeCommandCallParser(lazyInstance: () -> CommandCallParser): Unit =
|
||||
contribute(CommandCallParserProvider, plugin, LazyCommandCallParserProviderImpl(lazyInstance))
|
||||
contribute(CommandCallParserProvider, plugin, CommandCallParserProviderImplLazy(lazyInstance))
|
||||
|
||||
/** 注册一个 [CommandCallParserProvider] */
|
||||
@ExperimentalCommandDescriptors
|
||||
@ -112,4 +113,19 @@ public class PluginComponentStorage(
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
public fun contributeCommandCallParser(provider: CommandCallParserProvider): Unit =
|
||||
contribute(CommandCallParserProvider, plugin, provider)
|
||||
|
||||
/////////////////////////////////////
|
||||
|
||||
/** 注册一个 [CommandCallResolverProvider] */
|
||||
@ExperimentalCommandDescriptors
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
public fun contributeCommandCallResolver(lazyInstance: () -> CommandCallResolver): Unit =
|
||||
contribute(CommandCallResolverProvider, plugin, CommandCallResolverProviderImplLazy(lazyInstance))
|
||||
|
||||
/** 注册一个 [CommandCallResolverProvider] */
|
||||
@ExperimentalCommandDescriptors
|
||||
@JvmName("contributeCommandCallResolverProvider")
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
public fun contributeCommandCallParser(provider: CommandCallResolverProvider): Unit =
|
||||
contribute(CommandCallResolverProvider, plugin, provider)
|
||||
}
|
@ -30,6 +30,6 @@ public interface CommandCallParserProvider : InstanceExtension<CommandCallParser
|
||||
public class CommandCallParserProviderImpl(override val instance: CommandCallParser) : CommandCallParserProvider
|
||||
|
||||
@ExperimentalCommandDescriptors
|
||||
public class LazyCommandCallParserProviderImpl(instanceCalculator: () -> CommandCallParser) : CommandCallParserProvider {
|
||||
public class CommandCallParserProviderImplLazy(instanceCalculator: () -> CommandCallParser) : CommandCallParserProvider {
|
||||
override val instance: CommandCallParser by lazy(instanceCalculator)
|
||||
}
|
@ -32,6 +32,6 @@ public class PermissionServiceProviderImpl(override val instance: PermissionServ
|
||||
/**
|
||||
* @see PermissionServiceProvider
|
||||
*/
|
||||
public class LazyPermissionServiceProviderImpl(initializer: () -> PermissionService<*>) : PermissionServiceProvider {
|
||||
public class PermissionServiceProviderImplLazy(initializer: () -> PermissionService<*>) : PermissionServiceProvider {
|
||||
override val instance: PermissionService<*> by lazy(initializer)
|
||||
}
|
@ -24,7 +24,7 @@ import net.mamoe.mirai.console.plugin.loader.PluginLoader
|
||||
* @see Extension
|
||||
* @see PluginLoader
|
||||
*
|
||||
* @see LazyPluginLoaderProviderImpl
|
||||
* @see PluginLoaderProviderImplLazy
|
||||
*/
|
||||
public interface PluginLoaderProvider : InstanceExtension<PluginLoader<*, *>> {
|
||||
public companion object ExtensionPoint : AbstractExtensionPoint<PluginLoaderProvider>(PluginLoaderProvider::class)
|
||||
@ -32,6 +32,6 @@ public interface PluginLoaderProvider : InstanceExtension<PluginLoader<*, *>> {
|
||||
|
||||
public class PluginLoaderProviderImpl(override val instance: PluginLoader<*, *>) : PluginLoaderProvider
|
||||
|
||||
public class LazyPluginLoaderProviderImpl(initializer: () -> PluginLoader<*, *>) : PluginLoaderProvider {
|
||||
public class PluginLoaderProviderImplLazy(initializer: () -> PluginLoader<*, *>) : PluginLoaderProvider {
|
||||
override val instance: PluginLoader<*, *> by lazy(initializer)
|
||||
}
|
Loading…
Reference in New Issue
Block a user