Fixes a FileNotFoundException caused by the version file not existing
Some checks failed
KnarCraft/Minecraft-Server-Launcher/pipeline/head There was a failure building this commit
Some checks failed
KnarCraft/Minecraft-Server-Launcher/pipeline/head There was a failure building this commit
This commit is contained in:
parent
0bf355c4de
commit
8e626d8097
@ -88,12 +88,18 @@ public class ServerVersionContainer implements java.io.Serializable {
|
||||
* Tries to save the state of this server version container
|
||||
*/
|
||||
public void saveState() {
|
||||
File saveFile = new File(versionFile);
|
||||
PrintWriter file;
|
||||
try {
|
||||
if (!saveFile.exists()) {
|
||||
if (!saveFile.createNewFile()) {
|
||||
throw new FileNotFoundException("Unable to create version file");
|
||||
}
|
||||
}
|
||||
file = new PrintWriter(versionFile);
|
||||
file.println(this.toString());
|
||||
file.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user