From 69a90dc806b7a02ba710d311372963aba3001c53 Mon Sep 17 00:00:00 2001 From: Gravit Date: Wed, 19 Dec 2018 20:02:08 +0700 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20isAgentStarted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/ru/gravit/launcher/server/ServerAgent.java | 2 +- .../main/java/ru/gravit/launcher/server/ServerWrapper.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerAgent.java b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerAgent.java index 57badd80..8f3578dc 100644 --- a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerAgent.java +++ b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerAgent.java @@ -35,7 +35,7 @@ public static void addJVMClassPath(JarFile file) throws IOException { inst.appendToSystemClassLoaderSearch(file); } - public boolean isAgentStarted() { + public static boolean isAgentStarted() { return isAgentStarted; } 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 057fd6e0..3b8cad0d 100644 --- a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java +++ b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java @@ -109,7 +109,7 @@ public static void main(String[] args) throws Throwable { if(config.customClassPath) { String[] cp = config.classpath.split(":"); - if(ServerAgent.inst == null) + if(!ServerAgent.isAgentStarted()) { LogHelper.warning("JavaAgent not found. Using URLClassLoader"); URL[] urls = Arrays.stream(cp).map(Paths::get).map(IOHelper::toURL).toArray(URL[]::new); @@ -126,7 +126,7 @@ public static void main(String[] args) throws Throwable { } if(config.autoloadLibraries) { - if(ServerAgent.inst == null) + if(!ServerAgent.isAgentStarted()) { throw new UnsupportedOperationException("JavaAgent not found, autoloadLibraries not available"); } @@ -142,6 +142,7 @@ public static void main(String[] args) throws Throwable { modulesManager.postInitModules(); LogHelper.info("ServerWrapper: Project %s, LaunchServer address: %s port %d. Title: %s",config.projectname,config.address,config.port,config.title); LogHelper.info("Minecraft Version (for profile): %s",wrapper.profile.getVersion().name); + LogHelper.info("Start Minecraft Server"); LogHelper.debug("Invoke main method %s", mainClass.getName()); mainMethod.invoke(real_args); }