Changes a lot of things to make everything cleaner. Closes #3
All checks were successful
KnarCraft/Minecraft-Server-Launcher/pipeline/head This commit looks good

Drops the idea of using serializable
Adds a new controller object which takes care of profiles and saving
Moves profile independent settings to its own file
Makes saving and loading from file a lot cleaner
Fixes the bug preventing lastly used profile from loading
Makes the profile object only do profile things
Moves gui initialization to the controller object
Updates vanilla version from 1.16.1 to 1.16.2
Moves backup to common functions
This commit is contained in:
2020-08-17 21:41:38 +02:00
parent 2ed6b8bedb
commit a3de8a9f6c
24 changed files with 603 additions and 537 deletions

View File

@ -1,6 +1,6 @@
package net.knarcraft.minecraftserverlauncher.userinterface;
import net.knarcraft.minecraftserverlauncher.profile.Profile;
import net.knarcraft.minecraftserverlauncher.Main;
import net.knarcraft.minecraftserverlauncher.server.Server;
import net.knarcraft.minecraftserverlauncher.server.ServerTypeHandler;
import net.knarcraft.minecraftserverlauncher.server.servertypes.ServerType;
@ -29,7 +29,7 @@ public class ServerTab implements ActionListener {
public ServerTab(String name) throws ConfigurationException {
this.name = name;
panel = new JPanel();
Profile.getGUI().getPane().addTab(name, null, panel, null);
Main.getController().getGUI().getPane().addTab(name, null, panel, null);
SpringLayout sl_panel_3 = new SpringLayout();
panel.setLayout(sl_panel_3);
@ -197,9 +197,9 @@ public class ServerTab implements ActionListener {
* Removes the collection containing this ServerTab, and updates everything necessary.
*/
private void remove() {
Profile.getCurrent().removeCollection(this.name);
Profile.getGUI().update();
Profile.getCurrent().updateConsoles();
Main.getController().getCurrentProfile().removeCollection(this.name);
Main.getController().getGUI().update();
Main.getController().getCurrentProfile().updateConsoles();
}
/**