Removes the annoying delay before starting the first server when enabling server delay
This commit is contained in:
parent
8b0423e231
commit
fa6a0df4c7
@ -137,8 +137,9 @@ public class Server {
|
|||||||
public static void startServers() {
|
public static void startServers() {
|
||||||
Controller controller = Main.getController();
|
Controller controller = Main.getController();
|
||||||
controller.getGUI().setStatus("Starting servers");
|
controller.getGUI().setStatus("Starting servers");
|
||||||
|
int serverNum = 0;
|
||||||
for (Collection collection : controller.getCurrentProfile().getCollections()) {
|
for (Collection collection : controller.getCurrentProfile().getCollections()) {
|
||||||
if (!collection.getServer().runServer()) {
|
if (!collection.getServer().runServer(serverNum++ == 0)) {
|
||||||
controller.getGUI().setStatus("An error occurred. Start aborted");
|
controller.getGUI().setStatus("An error occurred. Start aborted");
|
||||||
try {
|
try {
|
||||||
Server.stop();
|
Server.stop();
|
||||||
@ -359,14 +360,14 @@ public class Server {
|
|||||||
*
|
*
|
||||||
* @return <p>True if nothing went wrong</p>
|
* @return <p>True if nothing went wrong</p>
|
||||||
*/
|
*/
|
||||||
private boolean runServer() {
|
private boolean runServer(boolean isFirstServer) {
|
||||||
//Ignore a disabled server
|
//Ignore a disabled server
|
||||||
if (!this.enabled) {
|
if (!this.enabled) {
|
||||||
this.started = false;
|
this.started = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//Tries to do necessary pre-start work
|
//Tries to do necessary pre-start work
|
||||||
if (!initializeJarDownload() || !delayStartup()) {
|
if (!initializeJarDownload() || (!isFirstServer && !delayStartup())) {
|
||||||
this.started = false;
|
this.started = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user