From 8e6f1334e298c42a833f34adf3b76fa70c7c3b71 Mon Sep 17 00:00:00 2001 From: Zaxar163 Date: Fri, 14 Jun 2019 13:27:31 +0300 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=97=D0=B0=D0=BF=D1=83=D1=81=D0=BA=20?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B9=20=D1=81=20vaargs=20=D0=B2?= =?UTF-8?q?=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=D0=B0=D1=85?= =?UTF-8?q?=20main=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pro/gravit/launcher/client/ClientLauncher.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java index c6a6dd38..5674255a 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java @@ -148,7 +148,6 @@ public void write(HOutput output) throws IOException { } } - private static final String[] EMPTY_ARRAY = new String[0]; private static final String SOCKET_HOST = "127.0.0.1"; private static final int SOCKET_PORT = Launcher.getConfig().clientPort; private static final String MAGICAL_INTEL_OPTION = "-XX:HeapDumpPath=ThisTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump"; @@ -277,21 +276,22 @@ private static void launch(ClientProfile profile, Params params) throws Throwabl Collection args = new LinkedList<>(); if (profile.getVersion().compareTo(ClientProfile.Version.MC164) >= 0) addClientArgs(args, profile, params); - else + else { addClientLegacyArgs(args, profile, params); + System.setProperty("minecraft.applet.TargetDirectory", params.clientDir.toString()); + } Collections.addAll(args, profile.getClientArgs()); LogHelper.debug("Args: " + args); // Resolve main class and method Class mainClass = classLoader.loadClass(profile.getMainClass()); - MethodHandle mainMethod = MethodHandles.publicLookup().findStatic(mainClass, "main", MethodType.methodType(void.class, String[].class)); - // Invoke main method with exception wrapping + MethodHandle mainMethod = MethodHandles.publicLookup().findStatic(mainClass, "main", MethodType.methodType(void.class, String[].class)).asFixedArity(); Launcher.LAUNCHED.set(true); JVMHelper.fullGC(); - System.setProperty("minecraft.applet.TargetDirectory", params.clientDir.toString()); // For 1.5.2 - mainMethod.invoke((Object) args.toArray(EMPTY_ARRAY)); + // Invoke main method + mainMethod.invoke((Object) args.toArray(new String[0])); } - private static Process process = null; + private static Process process = null; private static boolean clientStarted = false; private static Thread writeParamsThread;