diff --git a/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java b/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java index 4959506..f6cd2d8 100644 --- a/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java +++ b/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java @@ -190,7 +190,9 @@ Artifact virtualArtifact = new Artifact(); virtualArtifact.setUrl(url); - virtualArtifact.setPath(mavenNameToPath(name)); + if (getName() != null) { + virtualArtifact.setPath(mavenNameToPath(getName())); + } Downloads downloads = new Downloads(); downloads.setArtifact(virtualArtifact); @@ -198,13 +200,28 @@ setDownloads(downloads); } + public void setName(String name) { + this.name = name; + + // [DEEP SIGH] + // Sometimes 'name' comes after 'url', and I can't figure out how to get Jackson to enforce order + // So we have to do this silly check to make sure we have a path. + if (getDownloads() != null) { + if (getDownloads().getArtifact() == null) return; + + if (getDownloads().getArtifact().getPath() == null) { + getDownloads().getArtifact().setPath(mavenNameToPath(name)); + } + } + } + /** * BACKWARDS COMPATIBILITY: * Some old Forge distributions use a parameter called "serverreq" to indicate that the dependency should * be fetched from the Minecraft library source; this setter handles that. */ public void setServerreq(boolean value) { - if (value) { + if (value && getDownloads() == null) { setUrl("https://libraries.minecraft.net/"); // TODO get this from properties? } }