mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-25 03:55:26 +01:00
Fix cli errors when using ctrl+c to stop
This commit is contained in:
parent
f42ebdbc79
commit
458daaa325
@ -68,9 +68,12 @@
|
||||
|
||||
public class BlueMapCLI {
|
||||
|
||||
private static boolean shutdownInProgress = false;
|
||||
|
||||
private String minecraftVersion = null;
|
||||
private Path configFolder = Path.of("config");
|
||||
|
||||
|
||||
public void renderMaps(BlueMapService blueMap, boolean watch, Predicate<TileState> force, boolean forceGenerateWebapp,
|
||||
@Nullable String mapsToRender) throws ConfigurationException, IOException, InterruptedException {
|
||||
|
||||
@ -190,7 +193,10 @@ public void run() {
|
||||
Logger.global.logInfo("Stopped.");
|
||||
};
|
||||
|
||||
Thread shutdownHook = new Thread(shutdown, "BlueMap-CLI-ShutdownHook");
|
||||
Thread shutdownHook = new Thread(() -> {
|
||||
shutdownInProgress = true;
|
||||
shutdown.run();
|
||||
}, "BlueMap-CLI-ShutdownHook");
|
||||
Runtime.getRuntime().addShutdownHook(shutdownHook);
|
||||
|
||||
//metrics report
|
||||
@ -201,6 +207,8 @@ public void run() {
|
||||
|
||||
// wait until done, then shutdown if not watching
|
||||
renderManager.awaitIdle();
|
||||
if (shutdownInProgress) return;
|
||||
|
||||
Logger.global.logInfo("Your maps are now all up-to-date!");
|
||||
|
||||
if (watch) {
|
||||
|
Loading…
Reference in New Issue
Block a user