diff --git a/src/main/java/cam72cam/universalmodcore/Config.java b/src/main/java/cam72cam/universalmodcore/Config.java index f3638a2..2ded76f 100644 --- a/src/main/java/cam72cam/universalmodcore/Config.java +++ b/src/main/java/cam72cam/universalmodcore/Config.java @@ -74,7 +74,7 @@ public UMC(JsonObject data) { } } - public Config(JsonObject data, String loaderBranch) throws GitAPIException, IOException { + public Config(JsonObject data, String loaderBranch, boolean useSSH) throws GitAPIException, IOException { mod = new Mod(data.get("mod").getAsJsonObject()); integration = data.has("integration") ? new Integration(data.get("integration").getAsJsonObject()) : null; umc = new UMC(data.get("umc").getAsJsonObject()); @@ -100,7 +100,7 @@ public Config(JsonObject data, String loaderBranch) throws GitAPIException, IOEx File temp = null; if (umc.path == null) { temp = Files.createTempDirectory("umc-loader").toFile(); - Util.gitClone("https://github.com/TeamOpenIndustry/UniversalModCore.git", loaderBranch, temp, false); + Util.gitClone("https://github.com/TeamOpenIndustry/UniversalModCore.git", loaderBranch, temp, useSSH); path = temp; } else { path = Paths.get(System.getProperty("user.dir"), umc.path).toFile(); diff --git a/src/main/java/cam72cam/universalmodcore/Setup.java b/src/main/java/cam72cam/universalmodcore/Setup.java index feb7a10..0cc0cc8 100644 --- a/src/main/java/cam72cam/universalmodcore/Setup.java +++ b/src/main/java/cam72cam/universalmodcore/Setup.java @@ -28,6 +28,7 @@ public static void main(String[] args) throws IOException, GitAPIException { System.err.println("No loader branch specified! Available branches can be found in the UniversalModCore GitHub repository."); return; } + String loaderBranch = args[0]; String[] split = loaderBranch.split("-"); if (split.length < 2 || !split[0].matches("1\\.\\d*\\.\\d*") || !split[1].matches("[\\w-]+")) { @@ -35,7 +36,8 @@ public static void main(String[] args) throws IOException, GitAPIException { return; } - Config config = new Config(configObj, loaderBranch); + boolean useSSH = args.length >= 2 && args[1].equals("ssh"); + Config config = new Config(configObj, loaderBranch, useSSH); ZipInputStream zip = new ZipInputStream(config.openJarStream()); for (ZipEntry entry = zip.getNextEntry(); entry != null; entry = zip.getNextEntry()) { @@ -105,7 +107,7 @@ public static void main(String[] args) throws IOException, GitAPIException { config.integration.repo, String.format(config.integration.branch, config.minecraftLoader), Paths.get(System.getProperty("user.dir"), config.integration.path).toFile(), - args.length != 2 ? null : !args[1].equals("https") + useSSH ); } }