mirror of
https://github.com/Minestom/Minestom.git
synced 2024-10-01 07:57:41 +02:00
Try to close the terminal when shutting down the server
This commit is contained in:
parent
b066b6029a
commit
5cb4be26ff
@ -17,11 +17,11 @@ public class MinestomTerminal {
|
|||||||
private static final CommandManager COMMAND_MANAGER = MinecraftServer.getCommandManager();
|
private static final CommandManager COMMAND_MANAGER = MinecraftServer.getCommandManager();
|
||||||
private static final String PROMPT = "> ";
|
private static final String PROMPT = "> ";
|
||||||
|
|
||||||
|
private static volatile Terminal terminal;
|
||||||
private static volatile boolean running = false;
|
private static volatile boolean running = false;
|
||||||
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public static void start() {
|
public static void start() {
|
||||||
Terminal terminal = null;
|
|
||||||
try {
|
try {
|
||||||
terminal = TerminalBuilder.terminal();
|
terminal = TerminalBuilder.terminal();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -47,6 +47,13 @@ public class MinestomTerminal {
|
|||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public static void stop() {
|
public static void stop() {
|
||||||
running = false;
|
running = false;
|
||||||
|
if (terminal != null) {
|
||||||
|
try {
|
||||||
|
terminal.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user