[FEATURE] Отключение использования javaagent на стороне клиента

This commit is contained in:
Gravit 2019-12-11 07:53:47 +07:00
parent a350b3bd77
commit 73e0ed53bb
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 3 additions and 11 deletions

View file

@ -75,9 +75,6 @@ public static void main(String... args) throws Throwable {
HWIDProvider.registerHWIDs(); HWIDProvider.registerHWIDs();
LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase()); LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase());
LauncherConfig config = Launcher.getConfig(); LauncherConfig config = Launcher.getConfig();
if (config.environment.equals(LauncherConfig.LauncherEnvironment.PROD)) {
if (!LauncherAgent.isStarted()) throw new SecurityException("LauncherAgent must started");
}
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
try { try {
new LauncherEngine().start(args); new LauncherEngine().start(args);

View file

@ -356,13 +356,12 @@ public static Process launch(
} }
} }
// Add classpath and main class // Add classpath and main class
String pathLauncher = IOHelper.getCodeSource(ClientLauncher.class).toString(); context.pathLauncher = IOHelper.getCodeSource(ClientLauncher.class).toString();
context.pathLauncher = pathLauncher;
context.args.add(ClientLauncherWrapper.MAGIC_ARG); context.args.add(ClientLauncherWrapper.MAGIC_ARG);
Collections.addAll(context.args, profile.getJvmArgs()); Collections.addAll(context.args, profile.getJvmArgs());
profile.pushOptionalJvmArgs(context.args); profile.pushOptionalJvmArgs(context.args);
context.args.add("-Djava.library.path=".concat(params.clientDir.resolve(NATIVES_DIR).toString())); // Add Native Path context.args.add("-Djava.library.path=".concat(params.clientDir.resolve(NATIVES_DIR).toString())); // Add Native Path
context.args.add("-javaagent:".concat(pathLauncher)); //context.args.add("-javaagent:".concat(pathLauncher));
ClientHookManager.clientLaunchHook.hook(context); ClientHookManager.clientLaunchHook.hook(context);
LauncherGuardManager.guard.addCustomParams(context); LauncherGuardManager.guard.addCustomParams(context);
context.args.add(ClientLauncher.class.getName()); context.args.add(ClientLauncher.class.getName());
@ -443,10 +442,7 @@ public static void main(String... args) throws Throwable {
LauncherConfig.getAutogenConfig().initModules(); //INIT LauncherConfig.getAutogenConfig().initModules(); //INIT
LauncherEngine.modulesManager.initModules(null); LauncherEngine.modulesManager.initModules(null);
initGson(LauncherEngine.modulesManager); initGson(LauncherEngine.modulesManager);
if (!LauncherAgent.isStarted()) { LauncherEngine.verifyNoAgent();
NativeJVMHalt.haltA(100);
return;
}
LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase()); LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase());
JVMHelper.verifySystemProperties(ClientLauncher.class, true); JVMHelper.verifySystemProperties(ClientLauncher.class, true);
EnvHelper.checkDangerousParams(); EnvHelper.checkDangerousParams();
@ -507,7 +503,6 @@ public static void main(String... args) throws Throwable {
}; };
AuthService.username = params.pp.username; AuthService.username = params.pp.username;
AuthService.uuid = params.pp.uuid; AuthService.uuid = params.pp.uuid;
ClientService.instrumentation = LauncherAgent.inst;
ClientService.classLoader = classLoader; ClientService.classLoader = classLoader;
classLoader.addURL(IOHelper.getCodeSource(ClientLauncher.class).toUri().toURL()); classLoader.addURL(IOHelper.getCodeSource(ClientLauncher.class).toUri().toURL());
//classForName(classLoader, "com.google.common.collect.ForwardingMultimap"); //classForName(classLoader, "com.google.common.collect.ForwardingMultimap");