mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
Check version on init for PluginDependency
This commit is contained in:
parent
06895e2a6d
commit
b2ad961e8d
@ -46,6 +46,7 @@ public data class PluginDependency @JvmOverloads constructor(
|
||||
init {
|
||||
kotlin.runCatching {
|
||||
PluginDescription.checkPluginId(id)
|
||||
if (versionRequirement != null) SemVersion.parseRangeRequirement(versionRequirement)
|
||||
}.getOrElse {
|
||||
throw IllegalArgumentException(it)
|
||||
}
|
||||
@ -63,7 +64,10 @@ public data class PluginDependency @JvmOverloads constructor(
|
||||
|
||||
public override fun toString(): String = buildString {
|
||||
append(id)
|
||||
versionRequirement?.let(::append)
|
||||
versionRequirement?.let {
|
||||
append(":")
|
||||
append(it)
|
||||
}
|
||||
if (isOptional) {
|
||||
append('?')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user