diff options
Diffstat (limited to 'plugin/src/main/kotlin/moe/nea/archenemy/mojang/MojangVersionMetadata.kt')
-rw-r--r-- | plugin/src/main/kotlin/moe/nea/archenemy/mojang/MojangVersionMetadata.kt | 61 |
1 files changed, 39 insertions, 22 deletions
diff --git a/plugin/src/main/kotlin/moe/nea/archenemy/mojang/MojangVersionMetadata.kt b/plugin/src/main/kotlin/moe/nea/archenemy/mojang/MojangVersionMetadata.kt index 4ef3313..1a6cf87 100644 --- a/plugin/src/main/kotlin/moe/nea/archenemy/mojang/MojangVersionMetadata.kt +++ b/plugin/src/main/kotlin/moe/nea/archenemy/mojang/MojangVersionMetadata.kt @@ -1,31 +1,48 @@ package moe.nea.archenemy.mojang import kotlinx.serialization.Serializable +import moe.nea.archenemy.util.OSUtil @Serializable data class MojangVersionMetadata( - val assetIndex: AssetIndex, - val downloads: Map<String, Download>, - val libraries: List<Library> + val assetIndex: AssetIndex, + val downloads: Map<String, Download>, + val libraries: List<Library> ) { - @Serializable - data class Library( - val name: String, - ) - @Serializable - data class Download( - val sha1: String, - val size: Long, - val url: String, - ) - - @Serializable - data class AssetIndex( - val id: String, - val sha1: String, - val size: Long, - val totalSize: Long, - val url: String, - ) + + fun getFilteredLibraries(): List<Library> { + return libraries.filter { !it.name.contains("twitch-platform") && !it.name.contains("twitch-external-platform") } + } + + @Serializable + data class Library( + val name: String, + val natives: Map<String, String>? = null, + val extract: ExtractOptions? = null, + ) : java.io.Serializable { + fun getArtifactCoordinate(): String { + val classifier = natives?.get(OSUtil.getOsClassifier()) + return name + (if (classifier != null) ":$classifier" else "") + } + + @Serializable + data class ExtractOptions(val exclude: List<String> = listOf()) : java.io.Serializable + } + + @Serializable + data class Download( + val sha1: String, + val size: Long, + val url: String, + ) + + @Serializable + data class AssetIndex( + val id: String, + val sha1: String, + val size: Long, + val totalSize: Long, + val url: String, + ) }
\ No newline at end of file |