mirror of
https://github.com/Anvilcraft/modpacktools
synced 2024-11-17 23:41:55 +01:00
Updated Addonscript
This commit is contained in:
parent
067545aa84
commit
93cef01984
4 changed files with 14 additions and 11 deletions
|
@ -22,7 +22,7 @@ dependencies {
|
|||
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.3.8'
|
||||
|
||||
//Other
|
||||
compile 'com.github.Anvilcraft:addonscript-java:c7b78418cc'
|
||||
compile 'com.github.Anvilcraft:addonscript-java:c412911790'
|
||||
|
||||
compile 'com.squareup.okhttp3:okhttp:4.8.0'
|
||||
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
|
||||
|
|
|
@ -32,7 +32,7 @@ object BuildTwitch : ICommand {
|
|||
val archiveName = "${wr.json.id}-${wr.defaultVersion.versionName}-twitch"
|
||||
val dir = File("./build")
|
||||
val toDownload = mutableMapOf<URL, Pair<File, String>>()
|
||||
val srcDir by lazy {CONFIG.config.getPath<String>("Locations/src")!!}
|
||||
val srcDir by lazy {File(CONFIG.config.getPath<String>("Locations/src")!!)}
|
||||
dir.mkdirs()
|
||||
tmp.mkdirs()
|
||||
downloadDir.mkdirs()
|
||||
|
@ -46,7 +46,9 @@ object BuildTwitch : ICommand {
|
|||
//TODO download & install files
|
||||
for(uf in ml.links) {
|
||||
if(uf.key.isFile) {
|
||||
val file = uf.key.getFile(srcDir)
|
||||
if (!uf.key.isASDirSet)
|
||||
uf.key.setASDir(srcDir)
|
||||
val file = uf.key.getFile()
|
||||
if(file.exists()) {
|
||||
installFile(uf.value, file).apply {println(this)}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ object CreateModlist : ICommand {
|
|||
val mods = mutableListOf<MetaData>()
|
||||
val toGet = mutableListOf<ArtifactDestination>()
|
||||
|
||||
for(rel in asJson!!.defaultVersion.getRelations(arrayOf("client"), null)) {
|
||||
for(rel in asJson!!.defaultVersion.getRelations(arrayOf("client"), arrayOf("mod", "modloader"))) {
|
||||
if(rel.hasLocalMeta())
|
||||
mods.add(rel.localMeta)
|
||||
else if(rel.hasFile() && rel.file.isArtifact)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ley.anvil.modpacktools.commands
|
||||
|
||||
import ley.anvil.addonscript.wrapper.ASWrapper
|
||||
import ley.anvil.addonscript.wrapper.FileOrLink
|
||||
import ley.anvil.modpacktools.MPJH
|
||||
import ley.anvil.modpacktools.command.CommandReturn
|
||||
import ley.anvil.modpacktools.command.CommandReturn.Companion.fail
|
||||
|
@ -26,16 +26,17 @@ object DownloadMods : ICommand {
|
|||
|
||||
|
||||
val json = MPJH.asWrapper
|
||||
val fileList = mutableListOf<ASWrapper.FileWrapper>()
|
||||
for (rel in json!!.defaultVersion!!.getRelations(arrayOf("client"), "mod")!!)
|
||||
val fileList = mutableListOf<FileOrLink>()
|
||||
for (rel in json!!.defaultVersion!!.getRelations(arrayOf("client"), arrayOf("mod"))!!)
|
||||
if (rel.hasFile())
|
||||
fileList.add(rel.file)
|
||||
fileList.add(rel.file.get())
|
||||
|
||||
FileDownloader(
|
||||
fileList.stream()
|
||||
.filter {it.isURL}
|
||||
.collect(toMap<ASWrapper.FileWrapper, URL, File>(
|
||||
{URL(it.link)}, //TODO Get the link using Multithreading
|
||||
.filter {it.installer == "internal.dir:mods"}
|
||||
.collect(toMap<FileOrLink, URL, File>(
|
||||
{URL(it.link)},
|
||||
{File(args[1], Paths.get(URL(it.link).path).fileName.toString())},
|
||||
{_: File, f: File -> f}
|
||||
)),
|
||||
|
@ -53,4 +54,4 @@ object DownloadMods : ICommand {
|
|||
}
|
||||
|
||||
private fun Array<out String>.checkArgs(): Boolean = this.size >= 2 && this.elementAtOrNull(2)?.equals("force") ?: true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue