diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/BuiltInPermissionServices.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/BuiltInPermissionServices.kt index 42989b3c5..aa4a36d70 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/BuiltInPermissionServices.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/BuiltInPermissionServices.kt @@ -12,6 +12,7 @@ package net.mamoe.mirai.console.permission import net.mamoe.mirai.console.data.AutoSavePluginConfig import java.util.concurrent.ConcurrentHashMap import kotlin.reflect.KClass +import kotlin.reflect.full.createType @ExperimentalPermission @@ -84,5 +85,9 @@ internal object BuiltInPermissionService : AbstractConcurrentPermissionService
= - StorablePermissionService.ConcurrentSaveData("PermissionService", AutoSavePluginConfig()) + StorablePermissionService.ConcurrentSaveData( + PermissionImpl::class.createType(), + "PermissionService", + AutoSavePluginConfig() + ) } \ No newline at end of file diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/StorablePermissionService.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/StorablePermissionService.kt index e04bf965a..f0b37efba 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/StorablePermissionService.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/StorablePermissionService.kt @@ -3,8 +3,13 @@ package net.mamoe.mirai.console.permission import net.mamoe.mirai.console.data.PluginConfig import net.mamoe.mirai.console.data.PluginDataExtensions.withDefault import net.mamoe.mirai.console.data.value +import net.mamoe.mirai.console.data.valueFromKType import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.CopyOnWriteArrayList +import kotlin.reflect.KType +import kotlin.reflect.KTypeProjection +import kotlin.reflect.KVariance +import kotlin.reflect.full.createType @ExperimentalPermission public interface StorablePermissionService
: PermissionService
{ @@ -14,13 +19,34 @@ public interface StorablePermissionService
: PermissionService
( + public class ConcurrentSaveData
private constructor(
+ permissionType: KType,
public override val saveName: String,
- delegate: PluginConfig
+ delegate: PluginConfig,
+ @Suppress("UNUSED_PARAMETER") primaryConstructorMark: Any?
) : PluginConfig by delegate {
- public val permissions: MutableMap invoke(
+ permissionType: KType,
+ saveName: String,
+ delegate: PluginConfig,
+ ): ConcurrentSaveData = ConcurrentSaveData(permissionType, saveName, delegate, null)
+ }
}
}