added creation of file
This commit is contained in:
parent
54276dbab1
commit
d94e5b4fdf
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user