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 {
|
public class Main extends JavaPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
getConfig().addDefault("PIDFile", "~/bukkit.pid");
|
getConfig().addDefault("PIDFile", "bukkit.pid");
|
||||||
saveConfig();
|
saveConfig();
|
||||||
String pid = getPid();
|
String pid = getPid();
|
||||||
savePid(pid);
|
savePid(pid);
|
||||||
@ -28,6 +28,12 @@ public class Main extends JavaPlugin {
|
|||||||
private void savePid(String pid) {
|
private void savePid(String pid) {
|
||||||
String pidLocation = getPidFileLocation();
|
String pidLocation = getPidFileLocation();
|
||||||
try {
|
try {
|
||||||
|
File file = new File(pidLocation);
|
||||||
|
if(file.exists()){
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
file.createNewFile();
|
||||||
|
|
||||||
PrintWriter writer = new PrintWriter(pidLocation, StandardCharsets.UTF_8);
|
PrintWriter writer = new PrintWriter(pidLocation, StandardCharsets.UTF_8);
|
||||||
writer.print(pid);
|
writer.print(pid);
|
||||||
writer.close();
|
writer.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user