diff --git a/Loader/src/main/java/de/com/baseband/launcher/Loader.java b/Loader/src/main/java/de/com/baseband/launcher/Loader.java index bf86bec..2617125 100644 --- a/Loader/src/main/java/de/com/baseband/launcher/Loader.java +++ b/Loader/src/main/java/de/com/baseband/launcher/Loader.java @@ -363,7 +363,7 @@ public class Loader implements Util { } options.set("build-name", branches.getSub(options.getString("branch")).getString("name")); - HashMap data = downloadFromSPL("https://download.baseband.com.de/download/client/" + options.getString("branch")); + HashMap data = downloadFromSPL("https://download.baseband.com.de/download/client/" + options.getString("branch"), null); LOGGER.info("BaseBand downloaded: {} chunks.", data.size()); LOGGER.info("Booting BaseBand {} @ {}", options.getString("build-name"), new String(data.get("commit")).trim()); classLoader = new GameClassLoader(data); @@ -374,7 +374,7 @@ public class Loader implements Util { private static void splUpdate() { LOGGER.info("BaseBand is downloading a significant update..."); - SimpleClassLoader loaderReloader = new SimpleClassLoader(downloadFromSPL("https://download.baseband.com.de/download/loader")); + SimpleClassLoader loaderReloader = new SimpleClassLoader(downloadFromSPL("https://download.baseband.com.de/download/loader", HTTPUtils.decodeUTF8(Loader.class.getProtectionDomain().getCodeSource().getLocation().getFile()))); LOGGER.info("BaseBand has downloaded a significant update. Applying..."); try { loaderReloader.loadClass(Tweaker.class.getName()).getMethod("load").invoke(null); @@ -385,9 +385,18 @@ public class Loader implements Util { } } - private static HashMap downloadFromSPL(String url) { + private static HashMap downloadFromSPL(String url, String filename) { HashMap data = new HashMap<>(); - try (ZipInputStream jar = new ZipInputStream(new URL(url).openStream())) { + try (InputStream urlStream = new URL(url).openStream()) { + InputStream stream = urlStream; + if(filename != null) { + byte[] bytes = new StreamReader(stream).readAllAsBytes(); + try(FileOutputStream os = new FileOutputStream(filename)) { + os.write(bytes); + } + stream = new ByteArrayInputStream(bytes); + } + ZipInputStream jar = new ZipInputStream(stream); ZipEntry entry; while ((entry = jar.getNextEntry()) != null) { byte[] bytes = new StreamReader(jar).readAllAsBytes();