This commit is contained in:
Him188 2020-09-09 20:07:32 +08:00
parent 2926e55590
commit 72df43db27
2 changed files with 1 additions and 12 deletions

View File

@ -9,11 +9,7 @@
package net.mamoe.mirai.console.permission
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.Serializer
import kotlinx.serialization.builtins.serializer
import net.mamoe.mirai.console.internal.data.map
/**
@ -34,14 +30,6 @@ public data class PermissionId(
}
}
@Serializer(forClass = PermissionId::class)
public object AsClassSerializer
public object AsStringSerializer : KSerializer<PermissionId> by String.serializer().map(
serializer = { it.namespace + ":" + it.id },
deserializer = ::parseFromString
)
public override fun toString(): String {
return "$namespace:$id"
}

View File

@ -60,6 +60,7 @@ public interface PermissionService<P : Permission> {
}
}
@ExperimentalPermission
internal fun PermissionService<*>.allocatePermissionIdForPlugin(name: String, id: String) =
PermissionId("plugin.${name.toLowerCase()}", id.toLowerCase())