diff --git a/src/pid/Main.java b/src/pid/Main.java index b5299ae..f380a48 100644 --- a/src/pid/Main.java +++ b/src/pid/Main.java @@ -9,7 +9,7 @@ import java.util.logging.Level; public class Main extends JavaPlugin { @Override public void onEnable() { - getConfig().addDefault("PIDFile", "~/bukkit.pid"); + getConfig().addDefault("PIDFile", "bukkit.pid"); saveConfig(); String pid = getPid(); savePid(pid); @@ -28,6 +28,12 @@ public class Main extends JavaPlugin { private void savePid(String pid) { String pidLocation = getPidFileLocation(); try { + File file = new File(pidLocation); + if(file.exists()){ + file.delete(); + } + file.createNewFile(); + PrintWriter writer = new PrintWriter(pidLocation, StandardCharsets.UTF_8); writer.print(pid); writer.close();