From 779bc2c63df131fce0d230401a5a891eb2eb8794 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Thu, 3 Nov 2022 17:11:14 +0000 Subject: [PATCH] Fix WrongMethodTypeException. Invoke exact don't work like that Signed-off-by: TheKodeToad --- .../org/prismlauncher/launcher/impl/StandardLauncher.java | 3 +-- .../prismlauncher/launcher/impl/legacy/LegacyLauncher.java | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libraries/launcher/org/prismlauncher/launcher/impl/StandardLauncher.java b/libraries/launcher/org/prismlauncher/launcher/impl/StandardLauncher.java index 485f65ee4..d5b7961af 100644 --- a/libraries/launcher/org/prismlauncher/launcher/impl/StandardLauncher.java +++ b/libraries/launcher/org/prismlauncher/launcher/impl/StandardLauncher.java @@ -63,7 +63,6 @@ import org.prismlauncher.utils.ReflectionUtils; import java.lang.invoke.MethodHandle; import java.util.ArrayList; import java.util.List; -import java.util.logging.Logger; public final class StandardLauncher extends AbstractLauncher { @@ -100,7 +99,7 @@ public final class StandardLauncher extends AbstractLauncher { } MethodHandle method = ReflectionUtils.findMainMethod(this.mainClassName); - method.invokeExact((Object[]) launchParameters.toArray(new String[0])); + method.invokeExact(launchParameters.toArray(new String[0])); } private static class StandardLauncherProvider implements LauncherProvider { diff --git a/libraries/launcher/org/prismlauncher/launcher/impl/legacy/LegacyLauncher.java b/libraries/launcher/org/prismlauncher/launcher/impl/legacy/LegacyLauncher.java index 00f55095d..b71099624 100644 --- a/libraries/launcher/org/prismlauncher/launcher/impl/legacy/LegacyLauncher.java +++ b/libraries/launcher/org/prismlauncher/launcher/impl/legacy/LegacyLauncher.java @@ -125,14 +125,14 @@ public final class LegacyLauncher extends AbstractLauncher { this.width, this.height, this.maximize, this.serverAddress, this.serverPort, this.mcParams.contains("--demo") - ); + ); } catch (Throwable e) { LOGGER.log(Level.SEVERE, "Running applet wrapper failed with exception; falling back to main class", e); } } MethodHandle method = ReflectionUtils.findMainEntrypoint(main); - method.invokeExact((Object[]) mcParams.toArray(new String[0])); + method.invokeExact(mcParams.toArray(new String[0])); } private static class LegacyLauncherProvider implements LauncherProvider {