diff --git a/launcher/src/main/java/com/skcraft/launcher/update/BaseUpdater.java b/launcher/src/main/java/com/skcraft/launcher/update/BaseUpdater.java index fac401dad..15dfd48bc 100644 --- a/launcher/src/main/java/com/skcraft/launcher/update/BaseUpdater.java +++ b/launcher/src/main/java/com/skcraft/launcher/update/BaseUpdater.java @@ -34,8 +34,11 @@ import javax.swing.*; import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.*; import java.util.logging.Level; @@ -274,18 +277,28 @@ protected void installLibraries(@NonNull Installer installer, } } - // Fetch logging config + // Use our custom logging config depending on what the manifest specifies if (versionManifest.getLogging() != null) { VersionManifest.LoggingConfig config = versionManifest.getLogging().getClient(); VersionManifest.Artifact file = config.getFile(); File targetFile = new File(librariesDir, file.getId()); + InputStream embeddedConfig = Launcher.class.getResourceAsStream("logging/" + file.getId()); - if (!targetFile.exists() || !Objects.equals(config.getFile().getHash(), FileUtils.getShaHash(targetFile))) { + if (embeddedConfig == null) { + // No embedded config, just use whatever the server gives us File tempFile = installer.getDownloader().download(url(file.getUrl()), file.getHash(), file.getSize(), file.getId()); log.info("Downloading logging config " + file.getId() + " from " + file.getUrl()); installer.queue(new FileMover(tempFile, targetFile)); + } else if (!targetFile.exists() || FileUtils.getShaHash(targetFile).equals(file.getHash())) { + // Use our embedded replacement + + Path tempFile = installer.getTempDir().toPath().resolve(file.getId()); + Files.copy(embeddedConfig, tempFile); + + log.info("Substituting embedded logging config " + file.getId()); + installer.queue(new FileMover(tempFile.toFile(), targetFile)); } } } diff --git a/launcher/src/main/resources/com/skcraft/launcher/logging/client-1.12.xml b/launcher/src/main/resources/com/skcraft/launcher/logging/client-1.12.xml new file mode 100644 index 000000000..2e9ac98e5 --- /dev/null +++ b/launcher/src/main/resources/com/skcraft/launcher/logging/client-1.12.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/launcher/src/main/resources/com/skcraft/launcher/logging/client-1.7.xml b/launcher/src/main/resources/com/skcraft/launcher/logging/client-1.7.xml new file mode 100644 index 000000000..87f3dea8e --- /dev/null +++ b/launcher/src/main/resources/com/skcraft/launcher/logging/client-1.7.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + +