- Joined
- Apr 10, 2008
- Messages
- 4,087
- Reaction score
- 1,264
So, there's a cool library called Jansi, which allows your program to use Ansi Escape Sequences, even on Windows. That's a cool way to pump up your server, by coloring the console however you want - coloring exceptions and errors in the red color, information in blue, or whatever. This really helps rather than a console full of a wall of text of one color.
This is one of the results you can achieve (Taken from Jansi website), which is pretty awesome!:
How to install the Jansi library into my project?
Simply download the Jansi library, located
In your server's starting method, where ever it loads everything - place this line to load the Jansi Console.
Now, you may also add the following fields at the top, for easier color indicating.
How to use the colors, real time?
Here's a quick example, to print something in the red color.
So, basically, what is done here?
Self explainatory, pretty much, this will help you to see things better in my opinion rather than one color console.
Good luck~
This is one of the results you can achieve (Taken from Jansi website), which is pretty awesome!:
How to install the Jansi library into my project?
Simply download the Jansi library, located
You must be registered to see links
and add the .jar file into your dist folder. When you're about to compile your server, also add the jar to your referenced libraries - like you add the jars in the dist folder.In your server's starting method, where ever it loads everything - place this line to load the Jansi Console.
Code:
AnsiConsole.systemInstall();
Now, you may also add the following fields at the top, for easier color indicating.
Code:
public static final String BLACK = "\u001B[0;30m";
public static final String RED = "\u001B[0;31m";
public static final String GREEN = "\u001B[0;32m";
public static final String YELLOW = "\u001B[0;33m";
public static final String BLUE = "\u001B[0;34m";
public static final String MAGENTA = "\u001B[0;35m";
public static final String CYAN = "\u001B[0;36m";
public static final String WHITE = "\u001B[0;37m";
How to use the colors, real time?
Here's a quick example, to print something in the red color.
Code:
AnsiConsole.out.println(RED + "Error loading MySQL Database!" + WHITE);
So, basically, what is done here?
Code:
AnsiConsole.out.println(COLOR_FOR_TEXT + "Text" + DEFAULT_CONSOLE_COLOR);
Self explainatory, pretty much, this will help you to see things better in my opinion rather than one color console.
Good luck~
Last edited: