Fixed ansi colors in IntelliJ Debug and on UNIX Systems.

This commit is contained in:
KrewsOrg 2020-01-23 19:55:53 +00:00
parent 6ca2973d87
commit 0e23a04ccb
3 changed files with 12 additions and 5 deletions

View File

@ -40,7 +40,7 @@ public final class Emulator {
public static final String ANSI_YELLOW = "\u001B[33m"; public static final String ANSI_YELLOW = "\u001B[33m";
public final static String PREVIEW = "RC-1"; public final static String PREVIEW = "RC-2";
public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW; public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW;
private static final String logo = private static final String logo =
@ -58,6 +58,8 @@ public final class Emulator {
public static boolean isShuttingDown = false; public static boolean isShuttingDown = false;
public static boolean stopped = false; public static boolean stopped = false;
public static boolean debugging = false; public static boolean debugging = false;
private static String classPath = System.getProperty("java.class.path");
private static String osName = System.getProperty("os.name");
private static int timeStarted = 0; private static int timeStarted = 0;
private static Runtime runtime; private static Runtime runtime;
private static ConfigurationManager config; private static ConfigurationManager config;
@ -85,7 +87,9 @@ public final class Emulator {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
try { try {
AnsiConsole.systemInstall(); if (osName.startsWith("Windows") && (!classPath.contains("idea_rt.jar"))) {
AnsiConsole.systemInstall();
}
Locale.setDefault(new Locale("en")); Locale.setDefault(new Locale("en"));
setBuild(); setBuild();
Emulator.stopped = false; Emulator.stopped = false;
@ -197,7 +201,8 @@ public final class Emulator {
Emulator.isShuttingDown = true; Emulator.isShuttingDown = true;
Emulator.isReady = false; Emulator.isReady = false;
Emulator.getLogging().logShutdownLine("Stopping Arcturus Emulator " + version + "..."); Emulator.getLogging().logShutdownLine("Stopping Arcturus Emulator " + version + "...");
String classPath = System.getProperty("java.class.path");
String osName = System.getProperty("os.name");
try { try {
if (Emulator.getPluginManager() != null) if (Emulator.getPluginManager() != null)
Emulator.getPluginManager().fireEvent(new EmulatorStartShutdownEvent()); Emulator.getPluginManager().fireEvent(new EmulatorStartShutdownEvent());
@ -255,8 +260,10 @@ public final class Emulator {
Emulator.getDatabase().dispose(); Emulator.getDatabase().dispose();
} }
Emulator.stopped = true; Emulator.stopped = true;
AnsiConsole.systemUninstall();
if (osName.startsWith("Windows") && (!classPath.contains("idea_rt.jar"))) {
AnsiConsole.systemUninstall();
}
try { try {
if (Emulator.threading != null) if (Emulator.threading != null)

View File

@ -134,7 +134,7 @@ public class Logging {
if (Emulator.getConfig().getBoolean("logging.debug")) { if (Emulator.getConfig().getBoolean("logging.debug")) {
this.write(debugFileWriter, line.toString()); this.write(debugFileWriter, line.toString());
} }
System.out.println("[" + Logging.ANSI_BRIGHT + Logging.ANSI_GREEN + "SHUTDOWN" + Logging.ANSI_RESET + "] " + line.toString()); System.out.println("[" + Logging.ANSI_BRIGHT + Logging.ANSI_RED + "SHUTDOWN" + Logging.ANSI_RESET + "] " + line.toString());
} }
public void logUserLine(Object line) { public void logUserLine(Object line) {