use the config in the dependency loader for toggling downloads

This commit is contained in:
FalsePattern committed 2022-06-09 22:18:49 +02:00
1 parent ed7ca48321
commit c02b787786
1 file changed
+10
@@ -15,6 +15,8 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.net.ssl.HttpsURLConnection;
import com.falsepattern.lib.internal.LibraryConfig;
import lombok.Builder;
import lombok.NonNull;
import lombok.val;
@@ -127,6 +129,14 @@ public class DependencyLoader {
}
}
}
if (!LibraryConfig.ENABLE_LIBRARY_DOWNLOADS) {
val errorMessage = "Failed to load library " + groupId + ":" + artifactId + ":" + preferredVersion +
((suffix != null) ? ":" + suffix : "") + ": FalsePatternLib library downloading has " +
"been disabled in the config, and the library is not present on disk! Requested by mod: " +
loadingModId;
FalsePatternLib.getLog().fatal(errorMessage);
throw new IllegalStateException(errorMessage);
}
for (var repo : mavenRepositories) {
try {
if (!repo.endsWith("/")) {