Использование isAgentStarted

This commit is contained in:
Gravit 2018-12-19 20:02:08 +07:00
parent c5d96f173d
commit 69a90dc806
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 4 additions and 3 deletions

View file

@ -35,7 +35,7 @@ public static void addJVMClassPath(JarFile file) throws IOException {
inst.appendToSystemClassLoaderSearch(file); inst.appendToSystemClassLoaderSearch(file);
} }
public boolean isAgentStarted() { public static boolean isAgentStarted() {
return isAgentStarted; return isAgentStarted;
} }

View file

@ -109,7 +109,7 @@ public static void main(String[] args) throws Throwable {
if(config.customClassPath) if(config.customClassPath)
{ {
String[] cp = config.classpath.split(":"); String[] cp = config.classpath.split(":");
if(ServerAgent.inst == null) if(!ServerAgent.isAgentStarted())
{ {
LogHelper.warning("JavaAgent not found. Using URLClassLoader"); LogHelper.warning("JavaAgent not found. Using URLClassLoader");
URL[] urls = Arrays.stream(cp).map(Paths::get).map(IOHelper::toURL).toArray(URL[]::new); 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(config.autoloadLibraries)
{ {
if(ServerAgent.inst == null) if(!ServerAgent.isAgentStarted())
{ {
throw new UnsupportedOperationException("JavaAgent not found, autoloadLibraries not available"); throw new UnsupportedOperationException("JavaAgent not found, autoloadLibraries not available");
} }
@ -142,6 +142,7 @@ public static void main(String[] args) throws Throwable {
modulesManager.postInitModules(); modulesManager.postInitModules();
LogHelper.info("ServerWrapper: Project %s, LaunchServer address: %s port %d. Title: %s",config.projectname,config.address,config.port,config.title); 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("Minecraft Version (for profile): %s",wrapper.profile.getVersion().name);
LogHelper.info("Start Minecraft Server");
LogHelper.debug("Invoke main method %s", mainClass.getName()); LogHelper.debug("Invoke main method %s", mainClass.getName());
mainMethod.invoke(real_args); mainMethod.invoke(real_args);
} }