From 2b6f4d345a74f75781b435999e3f9c05c307965c Mon Sep 17 00:00:00 2001
From: Caedis <Caedis@users.noreply.github.com>
Date: Sat, 4 Jan 2025 17:31:40 -0600
Subject: [PATCH] Allow redirects when downloading (github mainly)

---
 src/main/java/GTNHNightlyUpdater/Main.java    | 3 +--
 src/main/java/GTNHNightlyUpdater/Updater.java | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/main/java/GTNHNightlyUpdater/Main.java b/src/main/java/GTNHNightlyUpdater/Main.java
index e96f69d..5a6fef9 100644
--- a/src/main/java/GTNHNightlyUpdater/Main.java
+++ b/src/main/java/GTNHNightlyUpdater/Main.java
@@ -50,7 +50,6 @@ public static void main(String[] args) {
             }
 
         } catch (CommandLine.ParameterException e) {
-            log.fatal(e);
             CommandLine.usage(options, System.out);
             System.exit(2);
         } catch (Exception e) {
@@ -93,7 +92,7 @@ static class Options {
         @CommandLine.Option(names = {"-l", "--latest"}, description = "Use the latest version of GTNH org mods instead of the latest nightly.")
         private boolean useLatest = false;
 
-        @CommandLine.ArgGroup(exclusive = false, multiplicity = "0..*")
+        @CommandLine.ArgGroup(exclusive = false, multiplicity = "1..*")
         List<Instance> instances;
 
         static class Instance {
diff --git a/src/main/java/GTNHNightlyUpdater/Updater.java b/src/main/java/GTNHNightlyUpdater/Updater.java
index 57e37bd..44c71f7 100644
--- a/src/main/java/GTNHNightlyUpdater/Updater.java
+++ b/src/main/java/GTNHNightlyUpdater/Updater.java
@@ -226,7 +226,7 @@ void updateModsFromMaven(Assets.Asset asset) throws IOException, InterruptedExce
 
     void cacheMods(Assets.Asset asset, Path modCacheDir) throws IOException, InterruptedException {
         log.info("Caching nightly mods");
-        @Cleanup HttpClient client = HttpClient.newHttpClient();
+        @Cleanup HttpClient client = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NORMAL).build();
         for (val mod : asset.mods()) {
             if ((mod.side() != null && mod.side().equals("NONE")) || mod.versions().isEmpty()) {
                 continue;