Fixes some messages and some jar downloads
All checks were successful
KnarCraft/Minecraft-Server-Launcher/pipeline/head This commit looks good

This commit is contained in:
2020-08-07 02:59:09 +02:00
parent 26cc5370e2
commit b144bbb903
5 changed files with 8 additions and 14 deletions

View File

@ -10,7 +10,7 @@ public interface GUI {
*
* @param message <p>The message contents</p>
*/
void printMessageToGUI(String message);
void setStatus(String message);
/**
* Displays an error to the user as an independent box

View File

@ -90,11 +90,7 @@ public class ServerLauncherGUI extends MessageHandler implements ActionListener,
return this.serversPane;
}
/**
* Sets the text of the status label.
*
* @param text The new text
*/
@Override
public void setStatus(String text) {
this.lblStatuslabel.setText(text);
try (PrintWriter file = new PrintWriter(new FileWriter(Main.getApplicationWorkDirectory() + File.separator + "latestrun.log", true))) {
@ -803,9 +799,4 @@ public class ServerLauncherGUI extends MessageHandler implements ActionListener,
}
}
}
@Override
public void printMessageToGUI(String message) {
setStatus(message);
}
}

View File

@ -40,9 +40,11 @@ public class JarDownloader {
throw new FileNotFoundException("Unable to create jars folder");
}
try {
gui.setStatus("Downloading all jars...");
downloadAll();
gui.printMessageToGUI("Finished downloading jars");
gui.setStatus("Finished downloading jars");
} catch (FileNotFoundException | ConfigurationException e) {
gui.setStatus(e.getMessage());
throw new FileNotFoundException("One or more downloads failed: " + e.getMessage());
}
}
@ -58,6 +60,7 @@ public class JarDownloader {
continue;
}
for (String version : type.getVersions()) {
gui.setStatus("Downloading " + type.getName() + version + "...");
boolean success = type.downloadJar(jarDirectory, version);
if (!success) {
throw new FileNotFoundException("Unable to download the jar file for " + type.getName() + version);