Improved checking for abnormally closed servers
This commit is contained in:
@ -409,6 +409,7 @@ public class GUI implements ActionListener {
|
||||
trayIcon = new TrayIcon(trayImage, "Minecraft Server Launcher", popup);
|
||||
trayIcon.setImageAutoSize(true);
|
||||
ActionListener exitListener= e -> {
|
||||
stop();
|
||||
try {
|
||||
Profile.getCurrent().save();
|
||||
} catch (FileNotFoundException e1) {
|
||||
@ -445,12 +446,12 @@ public class GUI implements ActionListener {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
stop();
|
||||
try {
|
||||
Profile.getCurrent().save();
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
stop();
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
@ -509,8 +510,6 @@ public class GUI implements ActionListener {
|
||||
background();
|
||||
} else if (e.getSource() == chckbxmntmDelayStartup) {
|
||||
delay();
|
||||
} else if (e.getSource() == targetServer) {
|
||||
updatePlayers();
|
||||
} else if (e.getSource() == chckbxmntmDownloadJars) {
|
||||
downloadJars();
|
||||
} else if (e.getSource() == mntmErrors) {
|
||||
@ -555,12 +554,12 @@ public class GUI implements ActionListener {
|
||||
} else if (e.getSource() == mntmStory) {
|
||||
goToURL("https://knarcraft.net/Bungeeminecraftserverlauncher/Story/");
|
||||
} else if (e.getSource() == btnStartServer) {
|
||||
try {
|
||||
Profile.getCurrent().save();
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
Executors.newSingleThreadExecutor().execute(Server::startServers);
|
||||
try {
|
||||
Profile.getCurrent().save();
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
Executors.newSingleThreadExecutor().execute(Server::startServers);
|
||||
} else if (e.getSource() == btnStopServer) {
|
||||
stop();
|
||||
} else if (e.getSource() == addServer) {
|
||||
@ -580,11 +579,11 @@ public class GUI implements ActionListener {
|
||||
updateProfiles();
|
||||
}
|
||||
} else if (e.getSource() == profiles) {
|
||||
try {
|
||||
changeProfile();
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
try {
|
||||
changeProfile();
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
} else if (e.getSource() == btnKick) {
|
||||
if (selectedServerValue != null && selectedPlayerValue != null) {
|
||||
Profile.getCurrent().sendCommand(selectedServerValue, "kick " + selectedPlayerValue);
|
||||
@ -616,9 +615,25 @@ public class GUI implements ActionListener {
|
||||
}
|
||||
} else if (e.getSource() == btnServerConsoles) {
|
||||
ServerConsoles.show();
|
||||
} else if (e.getSource() == targetServer) {
|
||||
updatePlayers();
|
||||
}
|
||||
}
|
||||
|
||||
public void running() {
|
||||
profiles.setEnabled(false);
|
||||
addProfile.setEnabled(false);
|
||||
delProfile.setEnabled(false);
|
||||
btnStartServer.setEnabled(false);
|
||||
}
|
||||
|
||||
public void stopped() {
|
||||
profiles.setEnabled(true);
|
||||
addProfile.setEnabled(true);
|
||||
delProfile.setEnabled(true);
|
||||
btnStartServer.setEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the previous profile and loads data from the new profile.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user