mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-28 21:48:34 +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 {
|
public class BlueMapCLI {
|
||||||
|
|
||||||
|
private static boolean shutdownInProgress = false;
|
||||||
|
|
||||||
private String minecraftVersion = null;
|
private String minecraftVersion = null;
|
||||||
private Path configFolder = Path.of("config");
|
private Path configFolder = Path.of("config");
|
||||||
|
|
||||||
|
|
||||||
public void renderMaps(BlueMapService blueMap, boolean watch, Predicate<TileState> force, boolean forceGenerateWebapp,
|
public void renderMaps(BlueMapService blueMap, boolean watch, Predicate<TileState> force, boolean forceGenerateWebapp,
|
||||||
@Nullable String mapsToRender) throws ConfigurationException, IOException, InterruptedException {
|
@Nullable String mapsToRender) throws ConfigurationException, IOException, InterruptedException {
|
||||||
|
|
||||||
@ -190,7 +193,10 @@ public void run() {
|
|||||||
Logger.global.logInfo("Stopped.");
|
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);
|
Runtime.getRuntime().addShutdownHook(shutdownHook);
|
||||||
|
|
||||||
//metrics report
|
//metrics report
|
||||||
@ -201,6 +207,8 @@ public void run() {
|
|||||||
|
|
||||||
// wait until done, then shutdown if not watching
|
// wait until done, then shutdown if not watching
|
||||||
renderManager.awaitIdle();
|
renderManager.awaitIdle();
|
||||||
|
if (shutdownInProgress) return;
|
||||||
|
|
||||||
Logger.global.logInfo("Your maps are now all up-to-date!");
|
Logger.global.logInfo("Your maps are now all up-to-date!");
|
||||||
|
|
||||||
if (watch) {
|
if (watch) {
|
||||||
|
Loading…
Reference in New Issue
Block a user