This commit is contained in:
parent
c3c45a033e
commit
4199aa02bb
@ -1,5 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
**1.0.6**
|
||||
* Fix Crash (Again)
|
||||
|
||||
**1.0.5**
|
||||
* Fix Crash
|
||||
|
||||
|
@ -34,6 +34,7 @@ dependencies {
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadow]
|
||||
classifier 'shadow-dev'
|
||||
mergeServiceFiles()
|
||||
}
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
|
||||
|
@ -9,7 +9,7 @@ org.gradle.jvmargs = -Xmx1G
|
||||
fabric_loader_version = 0.8.8+build.202
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.5
|
||||
mod_version = 1.0.6
|
||||
maven_group = com.thebrokenrail
|
||||
|
||||
# Dependencies
|
||||
|
@ -33,18 +33,21 @@ class CurseForgeStrategy implements ModUpdateStrategy {
|
||||
return null;
|
||||
}
|
||||
|
||||
String data = Util.urlToString("https://addons-ecs.forgesvc.net/api/v2/addon/" + projectID + "/files");
|
||||
|
||||
Moshi moshi = new Moshi.Builder().build();
|
||||
JsonAdapter<CurseForgeFile[]> jsonAdapter = moshi.adapter(CurseForgeFile[].class);
|
||||
|
||||
CurseForgeFile[] files;
|
||||
String data;
|
||||
try {
|
||||
files = jsonAdapter.fromJson(data);
|
||||
data = Util.urlToString("https://addons-ecs.forgesvc.net/api/v2/addon/" + projectID + "/files");
|
||||
} catch (IOException e) {
|
||||
ModUpdater.getLogger().warn("Unable To Access CurseForge: " + name);
|
||||
return null;
|
||||
} catch (JsonDataException e) {
|
||||
}
|
||||
|
||||
CurseForgeFile[] files;
|
||||
try {
|
||||
Moshi moshi = new Moshi.Builder().build();
|
||||
JsonAdapter<CurseForgeFile[]> jsonAdapter = moshi.adapter(CurseForgeFile[].class);
|
||||
|
||||
files = jsonAdapter.fromJson(data);
|
||||
} catch (JsonDataException | IOException e) {
|
||||
ModUpdater.getLogger().warn("CurseForge Sent Invalid Data: ", e);
|
||||
return null;
|
||||
}
|
||||
|
@ -37,19 +37,22 @@ public class GitHubReleasesStrategy implements ModUpdateStrategy {
|
||||
return null;
|
||||
}
|
||||
|
||||
String data = Util.urlToString(String.format("https://api.github.com/repos/%s/%s/releases", owner, repo));
|
||||
|
||||
Moshi moshi = new Moshi.Builder().build();
|
||||
JsonAdapter<GitHubRelease[]> jsonAdapter = moshi.adapter(GitHubRelease[].class);
|
||||
|
||||
GitHubRelease[] releases;
|
||||
String data;
|
||||
try {
|
||||
// GitHub's API never omits values, they're always null
|
||||
releases = jsonAdapter.nonNull().fromJson(data);
|
||||
data = Util.urlToString(String.format("https://api.github.com/repos/%s/%s/releases", owner, repo));
|
||||
} catch (IOException e) {
|
||||
ModUpdater.getLogger().warn("Unable To Access GitHub: " + name);
|
||||
return null;
|
||||
} catch (JsonDataException e) {
|
||||
}
|
||||
|
||||
GitHubRelease[] releases;
|
||||
try {
|
||||
Moshi moshi = new Moshi.Builder().build();
|
||||
JsonAdapter<GitHubRelease[]> jsonAdapter = moshi.adapter(GitHubRelease[].class);
|
||||
|
||||
// GitHub's API never omits values, they're always null
|
||||
releases = jsonAdapter.nonNull().fromJson(data);
|
||||
} catch (JsonDataException | IOException e) {
|
||||
ModUpdater.getLogger().warn("GitHub Sent Invalid Data: ", e);
|
||||
return null;
|
||||
}
|
||||
|
@ -12,8 +12,7 @@ import org.dom4j.DocumentException;
|
||||
import org.dom4j.Node;
|
||||
import org.dom4j.io.SAXReader;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class MavenStrategy implements ModUpdateStrategy {
|
||||
@ -33,11 +32,19 @@ public class MavenStrategy implements ModUpdateStrategy {
|
||||
|
||||
String mavenRoot = String.format("%s/%s/%s", repository, group.replaceAll("\\.", "/"), artifact);
|
||||
|
||||
String data;
|
||||
try {
|
||||
data = Util.urlToString(mavenRoot + "/maven-metadata.xml");
|
||||
} catch (IOException e) {
|
||||
ModUpdater.getLogger().warn("Unable To Access Maven Repository: " + name);
|
||||
return null;
|
||||
}
|
||||
|
||||
Document doc;
|
||||
try {
|
||||
SAXReader reader = new SAXReader();
|
||||
doc = reader.read(new URL(mavenRoot + "/maven-metadata.xml"));
|
||||
} catch (MalformedURLException | DocumentException e) {
|
||||
doc = reader.read(data);
|
||||
} catch (DocumentException e) {
|
||||
ModUpdater.getLogger().warn("Unable To Access Maven Repository: " + name);
|
||||
return null;
|
||||
}
|
||||
|
@ -12,8 +12,7 @@ import java.net.URL;
|
||||
import java.util.Optional;
|
||||
|
||||
public class Util {
|
||||
public static String urlToString(String urlStr) {
|
||||
try {
|
||||
public static String urlToString(String urlStr) throws IOException {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
URL url = new URL(urlStr);
|
||||
|
||||
@ -26,10 +25,6 @@ public class Util {
|
||||
}
|
||||
|
||||
return stringBuilder.toString();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static final String JAR_EXTENSION = ".jar";
|
||||
|
Reference in New Issue
Block a user