Fixed colors on Windows using Jansi. New Loading sequence.

This commit is contained in:
KrewsOrg 2020-01-21 23:35:33 +00:00
parent 89ded239bc
commit e108796ad1
2 changed files with 47 additions and 22 deletions

24
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>com.eu.habbo</groupId> <groupId>com.eu.habbo</groupId>
<artifactId>Habbo</artifactId> <artifactId>Habbo</artifactId>
<version>2.2.2</version> <version>2.3.0</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -79,7 +79,11 @@
<repositories> <repositories>
<repository> <repository>
<id>central</id> <id>central</id>
<url>http://repo1.maven.org/maven2/</url> <url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>mvnrepo</id>
<url>https://mvnrepository.com/</url>
</repository> </repository>
</repositories> </repositories>
@ -91,6 +95,14 @@
<version>4.1.36.Final</version> <version>4.1.36.Final</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.fusesource.jansi/jansi -->
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.18</version>
</dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId> <artifactId>netty-codec-http</artifactId>
@ -182,4 +194,12 @@
</dependency> </dependency>
</dependencies> </dependencies>
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>Internal repo</name>
<url>file:///home/thara/testesb/in</url>
</repository>
</distributionManagement>
</project> </project>

View File

@ -17,6 +17,7 @@ import com.eu.habbo.plugin.events.emulator.EmulatorStartShutdownEvent;
import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent; import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent;
import com.eu.habbo.threading.ThreadPooling; import com.eu.habbo.threading.ThreadPooling;
import com.eu.habbo.util.imager.badges.BadgeImager; import com.eu.habbo.util.imager.badges.BadgeImager;
import org.fusesource.jansi.AnsiConsole;
import java.io.*; import java.io.*;
import java.security.MessageDigest; import java.security.MessageDigest;
@ -28,27 +29,30 @@ import java.util.Random;
public final class Emulator { public final class Emulator {
public final static int MAJOR = 2; public final static int MAJOR = 2;
public final static int MINOR = 3; public final static int MINOR = 3;
public final static int BUILD = 0; public final static int BUILD = 0;
public static final String ANSI_RED = "\u001B[31m";
public static final String ANSI_BLUE = "\u001B[34m";
public static final String ANSI_PURPLE = "\u001B[35m";
public static final String ANSI_WHITE = "\u001B[37m";
public static final String ANSI_YELLOW = "\u001B[33m";
public final static String PREVIEW = "RC-1"; public final static String PREVIEW = "RC-1";
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 =
"\n" + "\n" +
" __ ___ _ A R C T U R U S __ \n" + "███╗ ███╗ ██████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ ███████╗████████╗ █████╗ ██████╗ \n" +
" / |/ /___ _________ (_)___ ____ ______/ /_____ ______ \n" + "████╗ ████║██╔═══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗\n" +
" / /|_/ / __ \\/ ___/ __ \\/ / __ \\/ __ `/ ___/ __/ __ `/ ___/ \n" + "██╔████╔██║██║ ██║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗███████╗ ██║ ███████║██████╔╝\n" +
" / / / / /_/ / / / / / / / / / / /_/ (__ ) /_/ /_/ / / \n" + "██║╚██╔╝██║██║ ██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║╚════██║ ██║ ██╔══██║██╔══██╗\n" +
"/_/ /_/\\____/_/ /_/ /_/_/_/ /_/\\__, /____/\\__/\\__,_/_/ \n" + "██║ ╚═╝ ██║╚██████╔╝██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝███████║ ██║ ██║ ██║██║ ██║\n" +
" /____/ \n" ; "╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝\n" +
" ";
public static String build = ""; public static String build = "";
public static boolean isReady = false; public static boolean isReady = false;
public static boolean isShuttingDown = false; public static boolean isShuttingDown = false;
@ -81,14 +85,18 @@ public final class Emulator {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
try { try {
AnsiConsole.systemInstall();
Locale.setDefault(new Locale("en")); Locale.setDefault(new Locale("en"));
setBuild(); setBuild();
Emulator.stopped = false; Emulator.stopped = false;
ConsoleCommand.load(); ConsoleCommand.load();
Emulator.logging = new Logging(); Emulator.logging = new Logging();
Emulator.getLogging().logStart("\r" + Emulator.logo + System.out.println(ANSI_PURPLE + logo );
" Build: " + build + "\n"); System.out.println(ANSI_WHITE + "This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
System.out.println(ANSI_BLUE + "[VERSION] " + ANSI_WHITE + version);
System.out.println(ANSI_RED + "[BUILD] " + ANSI_WHITE + build + "\n");
System.out.println(ANSI_YELLOW + "[KREWS] " + ANSI_WHITE + "Remember to sign up your hotel to join our toplist beta at https://bit.ly/2NN0rxq" );
System.out.println(ANSI_YELLOW + "[KREWS] " + ANSI_WHITE + "Join our discord at https://discord.gg/syuqgN" + "\n");
random = new Random(); random = new Random();
long startTime = System.nanoTime(); long startTime = System.nanoTime();
@ -119,7 +127,6 @@ public final class Emulator {
Emulator.getLogging().logStart("Memory: " + (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024) + "/" + (runtime.freeMemory()) / (1024 * 1024) + "MB"); Emulator.getLogging().logStart("Memory: " + (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024) + "/" + (runtime.freeMemory()) / (1024 * 1024) + "MB");
Emulator.debugging = Emulator.getConfig().getBoolean("debug.mode"); Emulator.debugging = Emulator.getConfig().getBoolean("debug.mode");
if (debugging) { if (debugging) {
Emulator.getLogging().logDebugLine("Debugging Enabled!"); Emulator.getLogging().logDebugLine("Debugging Enabled!");
} }
@ -134,10 +141,6 @@ public final class Emulator {
Emulator.getThreading().run(() -> { Emulator.getThreading().run(() -> {
Emulator.getLogging().logStart("Please note, Arcturus Emulator is a project by TheGeneral, we take no credit for the original work, and only the work we have continued. If you'd like to support the project, join our discord at: ");
Emulator.getLogging().logStart("https://discord.gg/syuqgN");
Emulator.getLogging().logStart("Please report bugs on our git at Krews.org.");
System.out.println("Waiting for commands: ");
}, 1500); }, 1500);
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
@ -189,6 +192,7 @@ public final class Emulator {
} }
private static void dispose() { private static void dispose() {
Emulator.getThreading().setCanAdd(false); Emulator.getThreading().setCanAdd(false);
Emulator.isShuttingDown = true; Emulator.isShuttingDown = true;
Emulator.isReady = false; Emulator.isReady = false;
@ -245,16 +249,17 @@ public final class Emulator {
Emulator.gameServer.stop(); Emulator.gameServer.stop();
} catch (Exception e) { } catch (Exception e) {
} }
Emulator.getLogging().logShutdownLine("Stopped Arcturus Emulator " + version + "..."); Emulator.getLogging().logShutdownLine("Stopped Arcturus Emulator " + version + "...");
if (Emulator.database != null) { if (Emulator.database != null) {
Emulator.getDatabase().dispose(); Emulator.getDatabase().dispose();
} }
Emulator.stopped = true; Emulator.stopped = true;
AnsiConsole.systemUninstall();
try { try {
if (Emulator.threading != null) if (Emulator.threading != null)
Emulator.threading.shutDown(); Emulator.threading.shutDown();
} catch (Exception e) { } catch (Exception e) {
} }