mirror of
https://github.com/JonasunderscoreJones/McWebserver.git
synced 2025-10-23 11:29:19 +02:00
fixed server stopping issue
This commit is contained in:
parent
5a765e32a7
commit
dcb5972eb4
1 changed files with 16 additions and 14 deletions
|
@ -35,25 +35,27 @@ public class McWebserver implements ModInitializer {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!mcserveractive) {
|
if (!mcserveractive) {
|
||||||
LOGGER.info("LMFAFMAKONJDGOADJINGOADNGHOADNHGOADNHOADHON");
|
sleep(2);
|
||||||
try {
|
for (int i = 0; i < 2; i++) {
|
||||||
TimeUnit.SECONDS.sleep(2);
|
CUrl curl = new CUrl("http://localhost:" + WEB_PORT + "/index.html").timeout(1, 1);
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
System.out.print("curl 127.0.0.1:" + WEB_PORT);
|
|
||||||
CUrl curl = new CUrl("curl http://localhost:" + WEB_PORT + "/index.html");
|
|
||||||
curl.exec();
|
curl.exec();
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
LOGGER.info("Webserver Stopped!");
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
System.out.print(mcserveractive);
|
sleep(2);
|
||||||
try {
|
|
||||||
TimeUnit.SECONDS.sleep(2);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sleep(int seconds) {
|
||||||
|
try {
|
||||||
|
TimeUnit.SECONDS.sleep(seconds);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue