Merge remote-tracking branch 'upstream/develop' into skinfix
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
@ -54,10 +54,6 @@
|
||||
|
||||
package org.prismlauncher;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.prismlauncher.exception.ParseException;
|
||||
import org.prismlauncher.launcher.Launcher;
|
||||
import org.prismlauncher.launcher.impl.StandardLauncher;
|
||||
@ -65,8 +61,11 @@ import org.prismlauncher.legacy.LegacyProxy;
|
||||
import org.prismlauncher.utils.Parameters;
|
||||
import org.prismlauncher.utils.logging.Log;
|
||||
|
||||
public final class EntryPoint {
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public final class EntryPoint {
|
||||
public static void main(String[] args) {
|
||||
ExitCode code = listen();
|
||||
|
||||
@ -162,19 +161,18 @@ public final class EntryPoint {
|
||||
return PreLaunchAction.PROCEED;
|
||||
}
|
||||
|
||||
private enum PreLaunchAction {
|
||||
PROCEED, LAUNCH, ABORT
|
||||
}
|
||||
private enum PreLaunchAction { PROCEED, LAUNCH, ABORT }
|
||||
|
||||
private enum ExitCode {
|
||||
NORMAL(0), ABORT(1), ERROR(2), ILLEGAL_ARGUMENT(65);
|
||||
NORMAL(0),
|
||||
ABORT(1),
|
||||
ERROR(2),
|
||||
ILLEGAL_ARGUMENT(65);
|
||||
|
||||
private final int numeric;
|
||||
|
||||
ExitCode(int numeric) {
|
||||
this.numeric = numeric;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,11 +38,9 @@
|
||||
package org.prismlauncher.exception;
|
||||
|
||||
public final class ParameterNotFoundException extends IllegalArgumentException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ParameterNotFoundException(String key) {
|
||||
super(String.format("Required parameter '%s' was not found", key));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,11 +38,9 @@
|
||||
package org.prismlauncher.exception;
|
||||
|
||||
public final class ParseException extends IllegalArgumentException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ParseException(String input, String format) {
|
||||
super(String.format("For input '%s' - should match '%s'", input, format));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,5 @@
|
||||
package org.prismlauncher.launcher;
|
||||
|
||||
public interface Launcher {
|
||||
|
||||
void launch() throws Throwable;
|
||||
|
||||
}
|
||||
|
@ -54,15 +54,14 @@
|
||||
|
||||
package org.prismlauncher.launcher.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.prismlauncher.exception.ParseException;
|
||||
import org.prismlauncher.launcher.Launcher;
|
||||
import org.prismlauncher.utils.Parameters;
|
||||
|
||||
public abstract class AbstractLauncher implements Launcher {
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractLauncher implements Launcher {
|
||||
private static final int DEFAULT_WINDOW_WIDTH = 854, DEFAULT_WINDOW_HEIGHT = 480;
|
||||
|
||||
// parameters, separated from ParamBucket
|
||||
@ -106,5 +105,4 @@ public abstract class AbstractLauncher implements Launcher {
|
||||
throw new ParseException(windowParams, "[width]x[height]");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,13 +54,12 @@
|
||||
|
||||
package org.prismlauncher.launcher.impl;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
|
||||
import org.prismlauncher.utils.Parameters;
|
||||
import org.prismlauncher.utils.ReflectionUtils;
|
||||
|
||||
public final class StandardLauncher extends AbstractLauncher {
|
||||
import java.lang.invoke.MethodHandle;
|
||||
|
||||
public final class StandardLauncher extends AbstractLauncher {
|
||||
public StandardLauncher(Parameters params) {
|
||||
super(params);
|
||||
}
|
||||
@ -87,5 +86,4 @@ public final class StandardLauncher extends AbstractLauncher {
|
||||
MethodHandle method = ReflectionUtils.findMainMethod(mainClassName);
|
||||
method.invokeExact(gameArgs.toArray(new String[0]));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,12 +58,9 @@ import org.prismlauncher.utils.Parameters;
|
||||
// used as a fallback if NewLaunchLegacy is not on the classpath
|
||||
// if it is, this class will be replaced
|
||||
public final class LegacyProxy {
|
||||
|
||||
public static Launcher createLauncher(Parameters params) {
|
||||
throw new AssertionError("NewLaunchLegacy is not loaded");
|
||||
}
|
||||
|
||||
public static void applyOnlineFixes(Parameters params) {
|
||||
}
|
||||
|
||||
public static void applyOnlineFixes(Parameters params) {}
|
||||
}
|
||||
|
@ -54,15 +54,14 @@
|
||||
|
||||
package org.prismlauncher.utils;
|
||||
|
||||
import org.prismlauncher.exception.ParameterNotFoundException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.prismlauncher.exception.ParameterNotFoundException;
|
||||
|
||||
public final class Parameters {
|
||||
|
||||
private final Map<String, List<String>> map = new HashMap<>();
|
||||
|
||||
public void add(String key, String value) {
|
||||
@ -112,5 +111,4 @@ public final class Parameters {
|
||||
|
||||
return params.get(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,12 +54,17 @@
|
||||
|
||||
package org.prismlauncher.utils;
|
||||
|
||||
import org.prismlauncher.utils.logging.Log;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.io.File;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
public final class ReflectionUtils {
|
||||
|
||||
private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
|
||||
private static final ClassLoader LOADER = ClassLoader.getSystemClassLoader();
|
||||
|
||||
@ -85,9 +90,7 @@ public final class ReflectionUtils {
|
||||
* @throws NoSuchMethodException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public static MethodHandle findMainMethod(String clazz)
|
||||
throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException {
|
||||
public static MethodHandle findMainMethod(String clazz) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException {
|
||||
return findMainMethod(LOADER.loadClass(clazz));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,5 +55,4 @@ public enum Level {
|
||||
this.name = name;
|
||||
this.stderr = stderr;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ import java.io.PrintStream;
|
||||
* messages.
|
||||
*/
|
||||
public final class Log {
|
||||
|
||||
// original before possibly overridden by MC
|
||||
private static final PrintStream OUT = new PrintStream(System.out), ERR = new PrintStream(System.err);
|
||||
private static final boolean DEBUG = Boolean.getBoolean("org.prismlauncher.debug");
|
||||
@ -100,5 +99,4 @@ public final class Log {
|
||||
else
|
||||
OUT.println(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user