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

@ -10,10 +10,10 @@ import java.util.Map;
/**
* This class acts as a container for all "latest" server versions
*/
public class ServerVersionContainer implements java.io.Serializable {
public class ServerVersionContainer {
private static ServerVersionContainer serverVersionContainer;
private String versionFile = Main.getApplicationWorkDirectory() + File.separator + "files" + File.separator + "versions.csv";
private final String versionFile = Main.getApplicationWorkDirectory() + File.separator + "files" + File.separator + "versions.csv";
private String vanillaVersion;
private String snapshotVersion;
private String bungeeVersion;
@ -273,15 +273,6 @@ public class ServerVersionContainer implements java.io.Serializable {
saveState();
}
/**
* Gets the entire sponge vanilla version map
*
* @return <p>The entire sponge vanilla version map</p>
*/
public Map<String, String> getSpongeVanillaVersions() {
return this.spongeVanillaVersions;
}
/**
* Gets a specific sponge vanilla version
*
@ -292,16 +283,6 @@ public class ServerVersionContainer implements java.io.Serializable {
return spongeVanillaVersions.get(versionKey);
}
/**
* Replaces the entire sponge vanilla version map
*
* @param newVersions <p>The new version map to use</p>
*/
public void setSpongeVanillaVersion(Map<String, String> newVersions) {
this.spongeVanillaVersions = newVersions;
saveState();
}
/**
* Sets the current version for a given sponge vanilla version
*