From 07eaa0c69163f8a05a0ecceebcbc268371c4f9ca Mon Sep 17 00:00:00 2001 From: Gravit Date: Tue, 27 Nov 2018 18:34:39 +0700 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D0=B2=D0=BE=D0=B4=20=D0=B8=D0=BD?= =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BE=20?= =?UTF-8?q?=D0=BB=D0=B8=D1=86=D0=B5=D0=BD=D0=B7=D0=B8=D0=B8=20=D0=B2=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=81=D0=BE=D0=BB=D1=8C=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ru/gravit/launchserver/LaunchServer.java | 1 + .../launcher/ClientLauncherWrapper.java | 9 +++++++- .../ru/gravit/launcher/LauncherEngine.java | 1 + .../gravit/launcher/server/ServerWrapper.java | 2 ++ .../ru/gravit/utils/helper/LogHelper.java | 21 +++++++++++++++++-- 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index a696c718..e348ac81 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -275,6 +275,7 @@ public static void main(String... args) throws Throwable { JVMHelper.verifySystemProperties(LaunchServer.class, true); LogHelper.addOutput(IOHelper.WORKING_DIR.resolve("LaunchServer.log")); LogHelper.printVersion("LaunchServer"); + LogHelper.printLicense("LauncherServer"); // Start LaunchServer Instant start = Instant.now(); diff --git a/Launcher/src/main/java/ru/gravit/launcher/ClientLauncherWrapper.java b/Launcher/src/main/java/ru/gravit/launcher/ClientLauncherWrapper.java index b0a7fc10..08114be7 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/ClientLauncherWrapper.java +++ b/Launcher/src/main/java/ru/gravit/launcher/ClientLauncherWrapper.java @@ -17,6 +17,9 @@ public class ClientLauncherWrapper { @LauncherAPI public static void main(String[] arguments) throws IOException, InterruptedException { LogHelper.printVersion("Launcher"); + LogHelper.printLicense("Launcher"); + LogHelper.info("Restart Launcher witch JavaAgent..."); + LogHelper.info("If need debug output use -Dlauncher.debug=true"); JVMHelper.checkStackTrace(ClientLauncherWrapper.class); JVMHelper.verifySystemProperties(Launcher.class, true); EnvHelper.checkDangerousParams(); @@ -39,7 +42,11 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep if (!LogHelper.isDebugEnabled()) { Thread.sleep(3000); if (!process.isAlive()) { - LogHelper.error("Process error code: %d", process.exitValue()); + int errorcode = process.exitValue(); + if(errorcode != 0) + LogHelper.error("Process exit witch error code: %d", errorcode); + else + LogHelper.info("Process exit witch code 0"); } else { LogHelper.debug("Process started success"); } diff --git a/Launcher/src/main/java/ru/gravit/launcher/LauncherEngine.java b/Launcher/src/main/java/ru/gravit/launcher/LauncherEngine.java index b79cea7e..85716e02 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/LauncherEngine.java +++ b/Launcher/src/main/java/ru/gravit/launcher/LauncherEngine.java @@ -163,6 +163,7 @@ public static void main(String... args) throws Throwable { EnvHelper.checkDangerousParams(); //if(!LauncherAgent.isStarted()) throw new SecurityException("JavaAgent not set"); LogHelper.printVersion("Launcher"); + LogHelper.printLicense("Launcher"); // Start Launcher Instant start = Instant.now(); try { diff --git a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java index 9d13308c..681b25d8 100644 --- a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java +++ b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java @@ -76,6 +76,8 @@ public static boolean loopAuth(ServerWrapper wrapper, int count, int sleeptime) public static void main(String[] args) throws Throwable { ServerWrapper wrapper = new ServerWrapper(); + LogHelper.printVersion("ServerWrapper"); + LogHelper.printLicense("ServerWrapper"); modulesManager = new ModulesManager(wrapper); modulesManager.autoload(Paths.get("srv_modules")); //BungeeCord using modules dir Launcher.modulesManager = modulesManager; diff --git a/libLauncher/src/main/java/ru/gravit/utils/helper/LogHelper.java b/libLauncher/src/main/java/ru/gravit/utils/helper/LogHelper.java index 68bfd8fa..46cfa1a3 100644 --- a/libLauncher/src/main/java/ru/gravit/utils/helper/LogHelper.java +++ b/libLauncher/src/main/java/ru/gravit/utils/helper/LogHelper.java @@ -117,6 +117,10 @@ public static void log(Level level, String message, boolean sub) { public static void printVersion(String product) { println(JANSI ? ansiFormatVersion(product) : formatVersion(product)); } + @LauncherAPI + public static void printLicense(String product) { + println(JANSI ? ansiFormatLicense(product) : formatLicense(product)); + } @LauncherAPI public static synchronized void println(String message) { @@ -234,13 +238,23 @@ private static String ansiFormatLog(Level level, String dateTime, String message private static String ansiFormatVersion(String product) { return new Ansi().bold(). // Setup - fgBright(Color.MAGENTA).a("sashok724's "). // sashok724's + fgBright(Color.MAGENTA).a("GravitLauncher "). // sashok724's + fgBright(Color.BLUE).a("(fork sashok724's Launcher) "). fgBright(Color.CYAN).a(product). // Product fgBright(Color.WHITE).a(" v").fgBright(Color.BLUE).a(Launcher.getVersion().toString()). // Version fgBright(Color.WHITE).a(" (build #").fgBright(Color.RED).a(Launcher.getVersion().build).fgBright(Color.WHITE).a(')'). // Build# reset().toString(); // To string } + private static String ansiFormatLicense(String product) { + return new Ansi().bold(). // Setup + fgBright(Color.MAGENTA).a("License for "). // sashok724's + fgBright(Color.CYAN).a(product). // Product + fgBright(Color.WHITE).a(" GPLv3").fgBright(Color.WHITE).a(". SourceCode: "). // Version + fgBright(Color.YELLOW).a("https://github.com/GravitLauncher/Launcher"). + reset().toString(); // To string + } + private static String formatLog(Level level, String message, String dateTime, boolean sub) { if (sub) { message = ' ' + message; @@ -249,7 +263,10 @@ private static String formatLog(Level level, String message, String dateTime, bo } private static String formatVersion(String product) { - return String.format("sashok724's %s v%s", product, Launcher.getVersion().toString()); + return String.format("GravitLauncher (fork sashok724's Launcher) %s v%s", product, Launcher.getVersion().toString()); + } + private static String formatLicense(String product) { + return String.format("License for %s GPLv3. SourceCode: https://github.com/GravitLauncher/Launcher", product); } static {