diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/server/ServerVersionContainer.java b/src/main/java/net/knarcraft/minecraftserverlauncher/server/ServerVersionContainer.java index 7d31d0e..d0ed61f 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/server/ServerVersionContainer.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/server/ServerVersionContainer.java @@ -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(); } }