mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-27 17:00:14 +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.descriptor.ExperimentalCommandDescriptors
|
||||||
import net.mamoe.mirai.console.command.parse.CommandCallParser
|
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.extensions.*
|
||||||
import net.mamoe.mirai.console.internal.extension.AbstractConcurrentComponentStorage
|
import net.mamoe.mirai.console.internal.extension.AbstractConcurrentComponentStorage
|
||||||
import net.mamoe.mirai.console.permission.PermissionService
|
import net.mamoe.mirai.console.permission.PermissionService
|
||||||
@ -77,7 +78,7 @@ public class PluginComponentStorage(
|
|||||||
/** 注册一个 [PermissionServiceProvider] */
|
/** 注册一个 [PermissionServiceProvider] */
|
||||||
@OverloadResolutionByLambdaReturnType
|
@OverloadResolutionByLambdaReturnType
|
||||||
public fun contributePermissionService(lazyInstance: () -> PermissionService<*>): Unit =
|
public fun contributePermissionService(lazyInstance: () -> PermissionService<*>): Unit =
|
||||||
contribute(PermissionServiceProvider, plugin, LazyPermissionServiceProviderImpl(lazyInstance))
|
contribute(PermissionServiceProvider, plugin, PermissionServiceProviderImplLazy(lazyInstance))
|
||||||
|
|
||||||
/** 注册一个 [PermissionServiceProvider] */
|
/** 注册一个 [PermissionServiceProvider] */
|
||||||
@JvmName("contributePermissionServiceProvider")
|
@JvmName("contributePermissionServiceProvider")
|
||||||
@ -90,7 +91,7 @@ public class PluginComponentStorage(
|
|||||||
/** 注册一个 [PluginLoaderProvider] */
|
/** 注册一个 [PluginLoaderProvider] */
|
||||||
@OverloadResolutionByLambdaReturnType
|
@OverloadResolutionByLambdaReturnType
|
||||||
public fun contributePluginLoader(lazyInstance: () -> PluginLoader<*, *>): Unit =
|
public fun contributePluginLoader(lazyInstance: () -> PluginLoader<*, *>): Unit =
|
||||||
contribute(PluginLoaderProvider, plugin, LazyPluginLoaderProviderImpl(lazyInstance))
|
contribute(PluginLoaderProvider, plugin, PluginLoaderProviderImplLazy(lazyInstance))
|
||||||
|
|
||||||
/** 注册一个 [PluginLoaderProvider] */
|
/** 注册一个 [PluginLoaderProvider] */
|
||||||
@JvmName("contributePluginLoaderProvider")
|
@JvmName("contributePluginLoaderProvider")
|
||||||
@ -104,7 +105,7 @@ public class PluginComponentStorage(
|
|||||||
@ExperimentalCommandDescriptors
|
@ExperimentalCommandDescriptors
|
||||||
@OverloadResolutionByLambdaReturnType
|
@OverloadResolutionByLambdaReturnType
|
||||||
public fun contributeCommandCallParser(lazyInstance: () -> CommandCallParser): Unit =
|
public fun contributeCommandCallParser(lazyInstance: () -> CommandCallParser): Unit =
|
||||||
contribute(CommandCallParserProvider, plugin, LazyCommandCallParserProviderImpl(lazyInstance))
|
contribute(CommandCallParserProvider, plugin, CommandCallParserProviderImplLazy(lazyInstance))
|
||||||
|
|
||||||
/** 注册一个 [CommandCallParserProvider] */
|
/** 注册一个 [CommandCallParserProvider] */
|
||||||
@ExperimentalCommandDescriptors
|
@ExperimentalCommandDescriptors
|
||||||
@ -112,4 +113,19 @@ public class PluginComponentStorage(
|
|||||||
@OverloadResolutionByLambdaReturnType
|
@OverloadResolutionByLambdaReturnType
|
||||||
public fun contributeCommandCallParser(provider: CommandCallParserProvider): Unit =
|
public fun contributeCommandCallParser(provider: CommandCallParserProvider): Unit =
|
||||||
contribute(CommandCallParserProvider, plugin, provider)
|
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
|
public class CommandCallParserProviderImpl(override val instance: CommandCallParser) : CommandCallParserProvider
|
||||||
|
|
||||||
@ExperimentalCommandDescriptors
|
@ExperimentalCommandDescriptors
|
||||||
public class LazyCommandCallParserProviderImpl(instanceCalculator: () -> CommandCallParser) : CommandCallParserProvider {
|
public class CommandCallParserProviderImplLazy(instanceCalculator: () -> CommandCallParser) : CommandCallParserProvider {
|
||||||
override val instance: CommandCallParser by lazy(instanceCalculator)
|
override val instance: CommandCallParser by lazy(instanceCalculator)
|
||||||
}
|
}
|
@ -32,6 +32,6 @@ public class PermissionServiceProviderImpl(override val instance: PermissionServ
|
|||||||
/**
|
/**
|
||||||
* @see PermissionServiceProvider
|
* @see PermissionServiceProvider
|
||||||
*/
|
*/
|
||||||
public class LazyPermissionServiceProviderImpl(initializer: () -> PermissionService<*>) : PermissionServiceProvider {
|
public class PermissionServiceProviderImplLazy(initializer: () -> PermissionService<*>) : PermissionServiceProvider {
|
||||||
override val instance: PermissionService<*> by lazy(initializer)
|
override val instance: PermissionService<*> by lazy(initializer)
|
||||||
}
|
}
|
@ -24,7 +24,7 @@ import net.mamoe.mirai.console.plugin.loader.PluginLoader
|
|||||||
* @see Extension
|
* @see Extension
|
||||||
* @see PluginLoader
|
* @see PluginLoader
|
||||||
*
|
*
|
||||||
* @see LazyPluginLoaderProviderImpl
|
* @see PluginLoaderProviderImplLazy
|
||||||
*/
|
*/
|
||||||
public interface PluginLoaderProvider : InstanceExtension<PluginLoader<*, *>> {
|
public interface PluginLoaderProvider : InstanceExtension<PluginLoader<*, *>> {
|
||||||
public companion object ExtensionPoint : AbstractExtensionPoint<PluginLoaderProvider>(PluginLoaderProvider::class)
|
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 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)
|
override val instance: PluginLoader<*, *> by lazy(initializer)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user