From 354cab5542687c1272c8aab3f26834ecdc93de39 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 12 Jun 2022 17:25:44 +0200 Subject: update version --- build.gradle | 2 +- .../cc/polyfrost/oneconfigloader/OneConfigLoader.java | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 26c705e..fdd3f7c 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins { id "java" } -version = "1.0.0-alpha5" +version = "1.0.0-alpha6" group = "cc.polyfrost" archivesBaseName = rootProject.name diff --git a/src/main/java/cc/polyfrost/oneconfigloader/OneConfigLoader.java b/src/main/java/cc/polyfrost/oneconfigloader/OneConfigLoader.java index 9259b36..892d524 100644 --- a/src/main/java/cc/polyfrost/oneconfigloader/OneConfigLoader.java +++ b/src/main/java/cc/polyfrost/oneconfigloader/OneConfigLoader.java @@ -65,16 +65,9 @@ public class OneConfigLoader implements IFMLLoadingPlugin { String downloadUrl = jsonObject.getAsJsonObject(channel).get("url").getAsString(); if (!oneConfigFile.exists() || !checksum.equals(getChecksum(oneConfigFile))) { - logger.info("Updating OneConfig..."); - File newOneConfigFile = new File(oneConfigDir, "OneConfig-NEW (1.8.9).jar"); downloadFile(downloadUrl, newOneConfigFile); - String newChecksum = getChecksum(newOneConfigFile); - if (!checksum.equals(newChecksum)) { - newOneConfigFile.delete(); - throw new SecurityException("Checksum mismatch! Expected " + checksum + ", but got " + newChecksum + "!"); - } - if (newOneConfigFile.exists()) { + if (newOneConfigFile.exists() && checksum.equals(getChecksum(newOneConfigFile))) { try { Files.move(newOneConfigFile.toPath(), oneConfigFile.toPath(), StandardCopyOption.REPLACE_EXISTING); logger.info("Updated OneConfig"); @@ -126,13 +119,9 @@ public class OneConfigLoader implements IFMLLoadingPlugin { DownloadUI ui = new DownloadUI(); try { URLConnection con = new URL(url).openConnection(); - con.setUseCaches(false); con.setRequestProperty("User-Agent", "OneConfig-Loader"); int length = con.getContentLength(); - if (location.exists()) { - logger.info("Deleting old file..."); - location.delete(); - } + if (location.exists()) location.delete(); location.createNewFile(); logger.info("Downloading new version of OneConfig... (" + length / 1024f + "KB)"); Thread downloader = new Thread(() -> { -- cgit