Change to have an actual option which can be changed before startup

This commit is contained in:
Matt Worzala 2021-06-12 09:07:09 -04:00
parent 8529249b85
commit e5076832b1
No known key found for this signature in database
GPG Key ID: 439DBBE092854841

View File

@ -138,6 +138,7 @@ public final class MinecraftServer {
private static int compressionThreshold = 256;
private static boolean packetCaching = true;
private static boolean groupedPacket = true;
private static boolean terminalEnabled = System.getProperty("minestom.terminal.disabled") == null;
private static ResponseDataConsumer responseDataConsumer;
private static String brandName = "Minestom";
private static Difficulty difficulty = Difficulty.NORMAL;
@ -615,6 +616,24 @@ public final class MinecraftServer {
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.
*
@ -795,8 +814,9 @@ public final class MinecraftServer {
LOGGER.info("Minestom server started successfully.");
if (System.getProperty("minestom.terminal.disabled") == null)
if (terminalEnabled) {
MinestomTerminal.start();
}
}
/**