Merge pull request #318 from mworzala/no_terminal_vm_arg

Add an option to start the server with no terminal
This commit is contained in:
TheMode 2021-06-12 15:08:09 +02:00 committed by GitHub
commit e098b2a89f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -138,6 +138,7 @@ public final class MinecraftServer {
private static int compressionThreshold = 256; private static int compressionThreshold = 256;
private static boolean packetCaching = true; private static boolean packetCaching = true;
private static boolean groupedPacket = true; private static boolean groupedPacket = true;
private static boolean terminalEnabled = System.getProperty("minestom.terminal.disabled") == null;
private static ResponseDataConsumer responseDataConsumer; private static ResponseDataConsumer responseDataConsumer;
private static String brandName = "Minestom"; private static String brandName = "Minestom";
private static Difficulty difficulty = Difficulty.NORMAL; private static Difficulty difficulty = Difficulty.NORMAL;
@ -615,6 +616,24 @@ public final class MinecraftServer {
MinecraftServer.groupedPacket = groupedPacket; MinecraftServer.groupedPacket = groupedPacket;
} }
/**
* Gets if the built in Minestom terminal is enabled.
* @return true if the terminal is enabled
*/
public static boolean isTerminalEnabled() {
return terminalEnabled;
}
/**
* Enabled/disables the built in Minestom terminal.
*
* @param enabled true to enable, false to disable
*/
public static void setTerminalEnabled(boolean enabled) {
Check.stateCondition(started, "Terminal settings may not be changed after starting the server.");
MinecraftServer.terminalEnabled = enabled;
}
/** /**
* Gets the consumer executed to show server-list data. * Gets the consumer executed to show server-list data.
* *
@ -795,7 +814,9 @@ public final class MinecraftServer {
LOGGER.info("Minestom server started successfully."); LOGGER.info("Minestom server started successfully.");
MinestomTerminal.start(); if (terminalEnabled) {
MinestomTerminal.start();
}
} }
/** /**