Some updates

This commit is contained in:
Timo Ley 2020-06-01 16:24:27 +02:00
parent 1f10d8a59a
commit ce5ee87317
3 changed files with 22 additions and 3 deletions

View File

@ -1,6 +1,5 @@
package ley.anvil.addonscript.curse;
import com.therandomlabs.curseapi.file.CurseFile;
import ley.anvil.addonscript.v1.AddonscriptJSON;
import java.util.ArrayList;
@ -27,7 +26,19 @@ public class CurseTools {
}
public static String toArtifact(int projectID, int fileID) {
return "curse:" + projectID + ":" + fileID;
return "curse>" + projectID + ":" + fileID;
}
public static boolean isCurseArtifact(String artifact, AddonscriptJSON as) {
String[] parts = artifact.split(">");
if (parts.length == 2 && as.repositories != null) {
for (AddonscriptJSON.Repository repo : as.repositories) {
if (repo.type != null && repo.type.equals("curseforge") && parts[0].equals(repo.id)) {
return true;
}
}
}
return false;
}
}

View File

@ -44,7 +44,7 @@ public class ForgeTools {
rel.type = "included";
}
rel.installer = "internal.forge";
rel.file = forgeVersion;
rel.file = "forge>"+ forgeVersion;
if (ver.relations == null) {
ver.relations = new ArrayList<>();
}

View File

@ -1,7 +1,15 @@
package ley.anvil.addonscript.util;
/**
* Interface for all repository types
*/
public interface IRepository {
/**
* Gets the file URL from an artifact
* @param artifact The artifact without the repo ID prefix
* @return The URL of the file
*/
String getFileURL(String artifact);
}