Skip to content

Commit 00207ac

Browse files
committed
remove web dependency
1 parent 807714c commit 00207ac

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

lib/src/main/java/io/github/projectunified/mcserverupdater/updater/MohistUpdater.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public String getChecksum() {
5959
JSONObject download = getDownload();
6060
return download.getString("file_sha256");
6161
} catch (Exception e) {
62-
e.printStackTrace();
62+
debug("Failed to get checksum", e);
6363
return null;
6464
}
6565
}

lib/src/main/java/io/github/projectunified/mcserverupdater/updater/PufferfishUpdater.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
import io.github.projectunified.mcserverupdater.api.JenkinsUpdater;
44
import io.github.projectunified.mcserverupdater.util.VersionQuery;
5-
import me.hsgamer.hscore.web.UserAgent;
6-
import me.hsgamer.hscore.web.WebUtils;
5+
import io.github.projectunified.mcserverupdater.util.WebUtils;
76
import org.json.JSONArray;
87
import org.json.JSONObject;
98
import org.json.JSONTokener;
@@ -34,7 +33,7 @@ private void loadVersions() {
3433
String jobsUrl = jenkinsUrl + "api/json?tree=jobs[name]";
3534
debug("Getting jobs from " + jobsUrl);
3635
try {
37-
URLConnection connection = UserAgent.CHROME.assignToConnection(WebUtils.createConnection(jobsUrl));
36+
URLConnection connection = WebUtils.openConnection(jobsUrl, updateBuilder);
3837
InputStream inputStream = connection.getInputStream();
3938
JSONObject jsonObject = new JSONObject(new JSONTokener(inputStream));
4039
JSONArray jobsArray = jsonObject.getJSONArray("jobs");

lib/src/main/java/io/github/projectunified/mcserverupdater/updater/SpigotUpdater.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
import io.github.projectunified.mcserverupdater.api.DebugConsumer;
55
import io.github.projectunified.mcserverupdater.api.Updater;
66
import io.github.projectunified.mcserverupdater.util.VersionQuery;
7-
import me.hsgamer.hscore.web.UserAgent;
8-
import me.hsgamer.hscore.web.WebUtils;
7+
import io.github.projectunified.mcserverupdater.util.WebUtils;
98

109
import java.io.File;
1110
import java.io.IOException;
@@ -28,12 +27,12 @@ private File downloadBuildTools() {
2827
try {
2928
String buildToolsURL = "https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar";
3029
updateBuilder.debug("Downloading BuildTools from " + buildToolsURL);
31-
URLConnection connection = UserAgent.CHROME.assignToConnection(WebUtils.createConnection(buildToolsURL));
30+
URLConnection connection = WebUtils.openConnection(buildToolsURL, updateBuilder);
3231
InputStream inputStream = connection.getInputStream();
3332
Files.copy(inputStream, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
3433
return file;
3534
} catch (IOException e) {
36-
e.printStackTrace();
35+
debug("Failed to download BuildTools", e);
3736
return null;
3837
}
3938
}

0 commit comments

Comments
 (0)