diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/SetProfileResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/SetProfileResponse.java index 5488d739..51f4e131 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/SetProfileResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/SetProfileResponse.java @@ -29,7 +29,7 @@ public void execute(ChannelHandlerContext ctx, Client client) { for (ClientProfile p : profiles) { if (p.getTitle().equals(this.client)) { if (server.config.protectHandler instanceof ProfilesProtectHandler && - ((ProfilesProtectHandler) server.config.protectHandler).canChangeProfile(p, client)) { + !((ProfilesProtectHandler) server.config.protectHandler).canChangeProfile(p, client)) { sendError("Access denied"); return; } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/update/UpdateResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/update/UpdateResponse.java index 68a21a6d..10e7a43d 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/update/UpdateResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/update/UpdateResponse.java @@ -21,7 +21,7 @@ public String getType() { @Override public void execute(ChannelHandlerContext ctx, Client client) { - if (server.config.protectHandler instanceof ProfilesProtectHandler && ((ProfilesProtectHandler) server.config.protectHandler).canGetUpdates(dirName, client)) { + if (server.config.protectHandler instanceof ProfilesProtectHandler && !((ProfilesProtectHandler) server.config.protectHandler).canGetUpdates(dirName, client)) { sendError("Access denied"); return; } diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java index 12302ff0..d9d6e0ee 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java @@ -40,7 +40,7 @@ import java.util.stream.Stream; public class ClientLauncherEntryPoint { - private ClientLauncherProcess.ClientParams readParams(SocketAddress address) throws IOException { + private static ClientLauncherProcess.ClientParams readParams(SocketAddress address) throws IOException { try (Socket socket = IOHelper.newSocket()) { socket.connect(address); @@ -56,7 +56,7 @@ private ClientLauncherProcess.ClientParams readParams(SocketAddress address) thr } } private static ClientClassLoader classLoader; - public void main(String[] args) throws Throwable { + public static void main(String[] args) throws Throwable { LauncherEngine.IS_CLIENT.set(true); LauncherEngine engine = LauncherEngine.clientInstance(); LauncherEngine.checkClass(LauncherEngine.class); @@ -68,9 +68,9 @@ public void main(String[] args) throws Throwable { initGson(LauncherEngine.modulesManager); LauncherEngine.verifyNoAgent(); LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase()); - JVMHelper.verifySystemProperties(ClientLauncher.class, true); + JVMHelper.verifySystemProperties(ClientLauncherEntryPoint.class, true); EnvHelper.checkDangerousParams(); - JVMHelper.checkStackTrace(ClientLauncher.class); + JVMHelper.checkStackTrace(ClientLauncherEntryPoint.class); LogHelper.printVersion("Client Launcher"); engine.readKeys(); LauncherGuardManager.initGuard(true); diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherProcess.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherProcess.java index ce35f58a..5c3bc532 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherProcess.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherProcess.java @@ -8,10 +8,7 @@ import pro.gravit.launcher.request.Request; import pro.gravit.launcher.serialize.HOutput; import pro.gravit.utils.Version; -import pro.gravit.utils.helper.EnvHelper; -import pro.gravit.utils.helper.IOHelper; -import pro.gravit.utils.helper.JVMHelper; -import pro.gravit.utils.helper.SecurityHelper; +import pro.gravit.utils.helper.*; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -26,7 +23,7 @@ public class ClientLauncherProcess { private transient Process process; - private final transient Boolean[] waitWriteParams = new Boolean[1]; + private final transient Boolean[] waitWriteParams = new Boolean[] {false}; public final Path executeFile; public final Path workDir; public final Path javaDir; @@ -136,8 +133,8 @@ public void addClientLegacyArgs(Collection args) { // Add args for tweaker Collections.addAll(args, "--version", profile.getVersion().name); - Collections.addAll(args, "--gameDir", clientDir.toString()); - Collections.addAll(args, "--assetsDir", assetDir.toString()); + Collections.addAll(args, "--gameDir", clientDir); + Collections.addAll(args, "--assetsDir", assetDir); } private void addModernClientArgs(Collection args) { @@ -201,6 +198,7 @@ public void start(boolean pipeOutput) throws IOException, InterruptedException { processArgs.add("-cp"); //ADD CLASSPATH processArgs.add(String.join(getPathSeparator(), systemClassPath)); + processArgs.add(mainClass); processArgs.addAll(systemClientArgs); synchronized (waitWriteParams) { @@ -209,6 +207,8 @@ public void start(boolean pipeOutput) throws IOException, InterruptedException { waitWriteParams.wait(1000); } } + if(LogHelper.isDebugEnabled()) + LogHelper.debug("Commandline: %s", Arrays.toString(processArgs.toArray())); ProcessBuilder processBuilder = new ProcessBuilder(processArgs); EnvHelper.addEnv(processBuilder); processBuilder.environment().putAll(systemEnv); diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java index 8f1ce9a3..94a1d0d1 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java @@ -157,7 +157,7 @@ public String[] getClassPath() { } public String[] getAlternativeClassPath() { - return classPath.toArray(new String[0]); + return altClassPath.toArray(new String[0]); }