Adds various fixes to make the two java versions work as expected

Makes it possible to load a controller without generating a GUI, for better testing
Makes sure not to try and parse empty profile lines
Saves controller settings in a more readable and appendable format
Adds code for using the correct java version for the occasion
Adds a new function for writing to files
This commit is contained in:
2021-08-02 21:06:22 +02:00
parent 6ec44f1f92
commit f1eead3807
21 changed files with 350 additions and 136 deletions

View File

@ -1,7 +1,7 @@
package net.knarcraft.minecraftserverlauncher.userinterface;
import net.knarcraft.minecraftserverlauncher.profile.Controller;
import net.knarcraft.minecraftserverlauncher.profile.Profile;
import net.knarcraft.minecraftserverlauncher.profile.ServerLauncherController;
import net.knarcraft.minecraftserverlauncher.utility.CommonFunctions;
import javax.swing.*;
@ -14,7 +14,7 @@ import java.util.Objects;
*/
public class ServerLauncherMenu implements ActionListener {
private JMenuBar menuBar;
private final JMenuBar menuBar;
//Options
private JCheckBoxMenuItem runInBackgroundCheckBoxMenuItem;
private JCheckBoxMenuItem delayStartupCheckBoxMenuItem;
@ -31,17 +31,17 @@ public class ServerLauncherMenu implements ActionListener {
private JMenuItem aboutMenuItem;
private JMenuItem storyMenuItem;
private Controller controller;
private ServerLauncherGUI serverLauncherGUI;
private final ServerLauncherController controller;
private final ServerLauncherGUI serverLauncherGUI;
/**
* Initializes a new server launcher menu
*
* @param menuBar <p>The menu bar to attach items to</p>
* @param menuBar <p>The menu bar to attach items to</p>
* @param serverLauncherGUI <p>The server launcher GUI to use</p>
*/
public ServerLauncherMenu(JMenuBar menuBar, ServerLauncherGUI serverLauncherGUI) {
this.controller = Controller.getInstance();
this.controller = ServerLauncherController.getInstance();
this.menuBar = menuBar;
this.serverLauncherGUI = serverLauncherGUI;
initialize();