From 33795a90a9c5944392e65c656be3a5314a221025 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Tue, 3 Aug 2021 10:16:43 +0200 Subject: [PATCH] Prevents jars from being built as part of jar downloading --- .../minecraftserverlauncher/utility/JarDownloader.java | 3 +++ .../utility/CommonFunctionsTest.java | 7 ------- .../minecraftserverlauncher/utility/JarDownloaderTest.java | 6 +++++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/utility/JarDownloader.java b/src/main/java/net/knarcraft/minecraftserverlauncher/utility/JarDownloader.java index 48f2313..07b53f5 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/utility/JarDownloader.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/utility/JarDownloader.java @@ -60,6 +60,9 @@ public final class JarDownloader { continue; } for (String version : type.getVersions()) { + if ((type.getName().equals("Spigot") || type.getName().equals("Bukkit")) && version.equals("Latest")) { + continue; + } gui.setStatus("Downloading " + type.getName() + version + "..."); boolean success = type.downloadJar(jarDirectory, version); if (!success) { diff --git a/src/test/java/net/knarcraft/minecraftserverlauncher/utility/CommonFunctionsTest.java b/src/test/java/net/knarcraft/minecraftserverlauncher/utility/CommonFunctionsTest.java index 82a3580..a1a4a1a 100644 --- a/src/test/java/net/knarcraft/minecraftserverlauncher/utility/CommonFunctionsTest.java +++ b/src/test/java/net/knarcraft/minecraftserverlauncher/utility/CommonFunctionsTest.java @@ -1,6 +1,5 @@ package net.knarcraft.minecraftserverlauncher.utility; -import net.knarcraft.minecraftserverlauncher.Main; import org.junit.jupiter.api.Test; import static net.knarcraft.minecraftserverlauncher.utility.CommonFunctions.stringBetween; @@ -8,12 +7,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; public class CommonFunctionsTest { - @Test - public void saveProfileTest() { - Main.getController().addProfile("Test"); - Main.getController().saveState(); - } - @Test public void stringBetweenTest() { String substring = stringBetween("fish'nchips", "f", "'"); diff --git a/src/test/java/net/knarcraft/minecraftserverlauncher/utility/JarDownloaderTest.java b/src/test/java/net/knarcraft/minecraftserverlauncher/utility/JarDownloaderTest.java index ed4bdc3..8715dc2 100644 --- a/src/test/java/net/knarcraft/minecraftserverlauncher/utility/JarDownloaderTest.java +++ b/src/test/java/net/knarcraft/minecraftserverlauncher/utility/JarDownloaderTest.java @@ -58,7 +58,7 @@ public class JarDownloaderTest { } @Test - public void craftbukkitDownloadTest() throws ConfigurationException, IOException { + public void craftBukkitDownloadTest() throws ConfigurationException, IOException { singleDownloadTest(ServerTypeHandler.getByName("Bukkit")); } @@ -96,6 +96,10 @@ public class JarDownloaderTest { private void singleDownloadTest(ServerType serverType) throws IOException { assertNotNull(serverType); for (String serverVersion : serverType.getVersions()) { + if ((serverType.getName().equals("Spigot") || serverType.getName().equals("Bukkit")) + && serverVersion.equals("Latest")) { + continue; + } System.out.println("Downloading " + serverType.getName() + serverVersion + ".jar"); serverType.downloadJar(targetDirectory, serverVersion); assertTrue(new File(targetDirectory + serverType.getName() + serverVersion + ".jar").exists());