Merge remote-tracking branch 'upstream/develop' into skinfix
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
@ -71,7 +71,6 @@ import java.util.Map;
|
||||
* recommended.
|
||||
*/
|
||||
public final class Launcher extends Applet implements AppletStub {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Map<String, String> params = new HashMap<>();
|
||||
@ -206,12 +205,10 @@ public final class Launcher extends Applet implements AppletStub {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics graphics) {
|
||||
}
|
||||
public void paint(Graphics graphics) {}
|
||||
|
||||
@Override
|
||||
public void update(Graphics graphics) {
|
||||
}
|
||||
public void update(Graphics graphics) {}
|
||||
|
||||
public void setParameter(String key, String value) {
|
||||
params.put(key, value);
|
||||
@ -220,5 +217,4 @@ public final class Launcher extends Applet implements AppletStub {
|
||||
public void setParameter(String key, boolean value) {
|
||||
setParameter(key, value ? "true" : "false");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,6 +54,8 @@
|
||||
|
||||
package org.prismlauncher.legacy;
|
||||
|
||||
import org.prismlauncher.utils.logging.Log;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.WindowAdapter;
|
||||
@ -70,12 +72,9 @@ import java.util.List;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import org.prismlauncher.utils.logging.Log;
|
||||
|
||||
import net.minecraft.Launcher;
|
||||
|
||||
final class LegacyFrame extends JFrame {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Launcher launcher;
|
||||
@ -96,8 +95,8 @@ final class LegacyFrame extends JFrame {
|
||||
addWindowListener(new ForceExitHandler());
|
||||
}
|
||||
|
||||
public void start(String user, String session, int width, int height, boolean maximize, String serverAddress,
|
||||
String serverPort, boolean demo) {
|
||||
public void start(
|
||||
String user, String session, int width, int height, boolean maximize, String serverAddress, String serverPort, boolean demo) {
|
||||
// Implements support for launching in to multiplayer on classic servers using a
|
||||
// mpticket file generated by an external program and stored in the instance's
|
||||
// root folder.
|
||||
@ -157,7 +156,6 @@ final class LegacyFrame extends JFrame {
|
||||
}
|
||||
|
||||
private final class ForceExitHandler extends WindowAdapter {
|
||||
|
||||
@Override
|
||||
public void windowClosing(WindowEvent event) {
|
||||
// FIXME better solution
|
||||
@ -184,7 +182,5 @@ final class LegacyFrame extends JFrame {
|
||||
// old minecraft versions can hang without this >_<
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,6 +55,11 @@
|
||||
|
||||
package org.prismlauncher.legacy;
|
||||
|
||||
import org.prismlauncher.launcher.impl.AbstractLauncher;
|
||||
import org.prismlauncher.utils.Parameters;
|
||||
import org.prismlauncher.utils.ReflectionUtils;
|
||||
import org.prismlauncher.utils.logging.Log;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.io.File;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
@ -65,16 +70,10 @@ import java.lang.reflect.Modifier;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.prismlauncher.launcher.impl.AbstractLauncher;
|
||||
import org.prismlauncher.utils.Parameters;
|
||||
import org.prismlauncher.utils.ReflectionUtils;
|
||||
import org.prismlauncher.utils.logging.Log;
|
||||
|
||||
/**
|
||||
* Used to launch old versions which support applets.
|
||||
*/
|
||||
final class LegacyLauncher extends AbstractLauncher {
|
||||
|
||||
private final String user, session;
|
||||
private final String title;
|
||||
private final String appletClass;
|
||||
@ -111,8 +110,7 @@ final class LegacyLauncher extends AbstractLauncher {
|
||||
try {
|
||||
LegacyFrame window = new LegacyFrame(title, createAppletClass(appletClass));
|
||||
|
||||
window.start(user, session, width, height, maximize, serverAddress, serverPort,
|
||||
gameArgs.contains("--demo"));
|
||||
window.start(user, session, width, height, maximize, serverAddress, serverPort, gameArgs.contains("--demo"));
|
||||
return;
|
||||
} catch (Throwable e) {
|
||||
Log.error("Running applet wrapper failed with exception; falling back to main class", e);
|
||||
@ -124,12 +122,12 @@ final class LegacyLauncher extends AbstractLauncher {
|
||||
MethodHandle method = ReflectionUtils.findMainMethod(main);
|
||||
method.invokeExact(gameArgs.toArray(new String[0]));
|
||||
}
|
||||
<<<<<<< HEAD:libraries/launcher/legacy/org/prismlauncher/legacy/LegacyLauncher.java
|
||||
|
||||
private static Applet createAppletClass(String clazz) throws Throwable {
|
||||
Class<?> appletClass = ClassLoader.getSystemClassLoader().loadClass(clazz);
|
||||
|
||||
MethodHandle appletConstructor = MethodHandles.lookup().findConstructor(appletClass,
|
||||
MethodType.methodType(void.class));
|
||||
MethodHandle appletConstructor = MethodHandles.lookup().findConstructor(appletClass, MethodType.methodType(void.class));
|
||||
return (Applet) appletConstructor.invoke();
|
||||
}
|
||||
|
||||
@ -156,4 +154,6 @@ final class LegacyLauncher extends AbstractLauncher {
|
||||
return null;
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> upstream/develop:libraries/launcher/org/prismlauncher/launcher/impl/legacy/LegacyLauncher.java
|
||||
}
|
||||
|
@ -58,7 +58,6 @@ import org.prismlauncher.utils.Parameters;
|
||||
|
||||
// implementation of LegacyProxy
|
||||
public final class LegacyProxy {
|
||||
|
||||
public static Launcher createLauncher(Parameters params) {
|
||||
return new LegacyLauncher(params);
|
||||
}
|
||||
@ -66,5 +65,4 @@ public final class LegacyProxy {
|
||||
public static void applyOnlineFixes(Parameters parameters) {
|
||||
OnlineFixes.apply(parameters);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,16 +35,15 @@
|
||||
|
||||
package org.prismlauncher.legacy.fix.online;
|
||||
|
||||
import org.prismlauncher.legacy.utils.url.UrlUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLStreamHandler;
|
||||
|
||||
import org.prismlauncher.legacy.utils.url.UrlUtils;
|
||||
|
||||
final class Handler extends URLStreamHandler {
|
||||
|
||||
@Override
|
||||
protected URLConnection openConnection(URL address) throws IOException {
|
||||
return openConnection(address, null);
|
||||
@ -61,5 +60,4 @@ final class Handler extends URLStreamHandler {
|
||||
|
||||
return UrlUtils.openConnection(address, proxy);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,15 +35,15 @@
|
||||
|
||||
package org.prismlauncher.legacy.fix.online;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLStreamHandler;
|
||||
import java.net.URLStreamHandlerFactory;
|
||||
|
||||
import org.prismlauncher.legacy.utils.Base64;
|
||||
import org.prismlauncher.legacy.utils.url.UrlUtils;
|
||||
import org.prismlauncher.utils.Parameters;
|
||||
import org.prismlauncher.utils.logging.Log;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLStreamHandler;
|
||||
import java.net.URLStreamHandlerFactory;
|
||||
|
||||
/**
|
||||
* Fixes skins by redirecting to other URLs.
|
||||
*
|
||||
@ -51,7 +51,6 @@ import org.prismlauncher.utils.logging.Log;
|
||||
* @see {@link UrlUtils}
|
||||
*/
|
||||
public final class OnlineFixes implements URLStreamHandlerFactory {
|
||||
|
||||
public static void apply(Parameters params) {
|
||||
if (!"true".equals(params.getString("onlineFixes", null)))
|
||||
return;
|
||||
@ -77,5 +76,4 @@ public final class OnlineFixes implements URLStreamHandlerFactory {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -52,6 +52,11 @@
|
||||
|
||||
package org.prismlauncher.legacy.fix.online;
|
||||
|
||||
import org.prismlauncher.legacy.utils.api.MojangApi;
|
||||
import org.prismlauncher.legacy.utils.api.Texture;
|
||||
import org.prismlauncher.legacy.utils.url.CustomUrlConnection;
|
||||
import org.prismlauncher.legacy.utils.url.UrlUtils;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
@ -64,13 +69,7 @@ import java.net.URLConnection;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.prismlauncher.legacy.utils.api.MojangApi;
|
||||
import org.prismlauncher.legacy.utils.api.Texture;
|
||||
import org.prismlauncher.legacy.utils.url.CustomUrlConnection;
|
||||
import org.prismlauncher.legacy.utils.url.UrlUtils;
|
||||
|
||||
final class SkinFix {
|
||||
|
||||
static URLConnection openConnection(URL address, Proxy proxy) throws IOException {
|
||||
String skinOwner = findSkinOwner(address);
|
||||
if (skinOwner != null)
|
||||
@ -154,7 +153,7 @@ final class SkinFix {
|
||||
case "www.minecraft.net":
|
||||
if (!address.getPath().equals("/cloak/get.jsp"))
|
||||
return null;
|
||||
|
||||
|
||||
return stripIfPrefixed(address.getQuery(), "user=");
|
||||
|
||||
case "s3.amazonaws.com":
|
||||
@ -177,5 +176,4 @@ final class SkinFix {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,19 +35,18 @@
|
||||
|
||||
package org.prismlauncher.legacy.utils;
|
||||
|
||||
import org.prismlauncher.utils.logging.Log;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.prismlauncher.utils.logging.Log;
|
||||
|
||||
/**
|
||||
* Uses Base64 with Java 8 or later, otherwise DatatypeConverter. In the latter
|
||||
* case, reflection is used to allow using newer compilers.
|
||||
*/
|
||||
public final class Base64 {
|
||||
|
||||
private static boolean supported = true;
|
||||
private static MethodHandle legacy;
|
||||
|
||||
@ -57,8 +56,8 @@ public final class Base64 {
|
||||
} catch (ClassNotFoundException e) {
|
||||
try {
|
||||
Class<?> datatypeConverter = Class.forName("javax.xml.bind.DatatypeConverter");
|
||||
legacy = MethodHandles.lookup().findStatic(datatypeConverter, "parseBase64Binary",
|
||||
MethodType.methodType(byte[].class, String.class));
|
||||
legacy = MethodHandles.lookup().findStatic(
|
||||
datatypeConverter, "parseBase64Binary", MethodType.methodType(byte[].class, String.class));
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException e1) {
|
||||
Log.error("Base64 not supported", e1);
|
||||
supported = false;
|
||||
@ -90,5 +89,4 @@ public final class Base64 {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,20 +35,19 @@
|
||||
|
||||
package org.prismlauncher.legacy.utils.api;
|
||||
|
||||
import org.prismlauncher.legacy.utils.Base64;
|
||||
import org.prismlauncher.legacy.utils.json.JsonParser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
|
||||
import org.prismlauncher.legacy.utils.Base64;
|
||||
import org.prismlauncher.legacy.utils.json.JsonParser;
|
||||
|
||||
/**
|
||||
* Basic wrapper for Mojang's Minecraft API.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final class MojangApi {
|
||||
|
||||
public static String getUuid(String username) throws IOException {
|
||||
try (InputStream in = new URL("https://api.mojang.com/users/profiles/minecraft/" + username).openStream()) {
|
||||
Map<String, Object> map = (Map<String, Object>) JsonParser.parse(in);
|
||||
@ -80,14 +79,13 @@ public final class MojangApi {
|
||||
}
|
||||
|
||||
public static Map<String, Object> getTextures(String player) throws IOException {
|
||||
try (InputStream profileIn = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + player)
|
||||
.openStream()) {
|
||||
try (InputStream profileIn = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + player).openStream()) {
|
||||
Map<String, Object> profile = (Map<String, Object>) JsonParser.parse(profileIn);
|
||||
|
||||
for (Map<String, Object> property : (Iterable<Map<String, Object>>) profile.get("properties")) {
|
||||
if (property.get("name").equals("textures")) {
|
||||
Map<String, Object> result = (Map<String, Object>) JsonParser
|
||||
.parse(new String(Base64.decode((String) property.get("value"))));
|
||||
Map<String, Object> result =
|
||||
(Map<String, Object>) JsonParser.parse(new String(Base64.decode((String) property.get("value"))));
|
||||
result = (Map<String, Object>) result.get("textures");
|
||||
|
||||
return result;
|
||||
@ -97,5 +95,4 @@ public final class MojangApi {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ import java.net.URL;
|
||||
* Represents a texture from the Mojang API.
|
||||
*/
|
||||
public final class Texture {
|
||||
|
||||
private final URL url;
|
||||
private final boolean slim;
|
||||
|
||||
@ -57,5 +56,4 @@ public final class Texture {
|
||||
public boolean isSlim() {
|
||||
return slim;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,11 +38,9 @@ package org.prismlauncher.legacy.utils.json;
|
||||
import java.io.IOException;
|
||||
|
||||
public final class JsonParseException extends IOException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JsonParseException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ import java.util.Map;
|
||||
* available in a lot of versions.
|
||||
*/
|
||||
public final class JsonParser {
|
||||
|
||||
private final Reader in;
|
||||
private char[] buffer;
|
||||
private int pos, length;
|
||||
@ -96,8 +95,8 @@ public final class JsonParser {
|
||||
|
||||
private void assertCharacter(char character) throws JsonParseException {
|
||||
if (character() != character)
|
||||
throw new JsonParseException("Expected '" + character + "' but got "
|
||||
+ (character() != -1 ? ("'" + (char) character() + "'") : "EOF"));
|
||||
throw new JsonParseException(
|
||||
"Expected '" + character + "' but got " + (character() != -1 ? ("'" + (char) character() + "'") : "EOF"));
|
||||
}
|
||||
|
||||
private void assertNoEOF(String expected) throws JsonParseException {
|
||||
@ -106,8 +105,7 @@ public final class JsonParser {
|
||||
}
|
||||
|
||||
private void skipWhitespace() throws IOException {
|
||||
while (isWhitespace())
|
||||
read();
|
||||
while (isWhitespace()) read();
|
||||
}
|
||||
|
||||
private boolean isWhitespace() {
|
||||
@ -407,5 +405,4 @@ public final class JsonParser {
|
||||
private boolean readNull() throws IOException {
|
||||
return character() == 'n' && read() == 'u' && read() == 'l' && read() == 'l';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
|
||||
public final class CustomUrlConnection extends HttpURLConnection {
|
||||
|
||||
private final InputStream in;
|
||||
|
||||
public CustomUrlConnection(byte[] data) {
|
||||
@ -75,5 +74,4 @@ public final class CustomUrlConnection extends HttpURLConnection {
|
||||
public boolean usingProxy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,8 @@
|
||||
|
||||
package org.prismlauncher.legacy.utils.url;
|
||||
|
||||
import org.prismlauncher.utils.logging.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
@ -44,14 +46,11 @@ import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLStreamHandler;
|
||||
|
||||
import org.prismlauncher.utils.logging.Log;
|
||||
|
||||
/**
|
||||
* A utility class for URLs which uses reflection to access constructors for
|
||||
* internal classes.
|
||||
*/
|
||||
public final class UrlUtils {
|
||||
|
||||
private static URLStreamHandler http;
|
||||
private static MethodHandle openConnection;
|
||||
|
||||
@ -63,8 +62,7 @@ public final class UrlUtils {
|
||||
http = (URLStreamHandler) getURLStreamHandler.invoke(null, "http");
|
||||
|
||||
// we next find the openConnection method
|
||||
Method openConnectionReflect = URLStreamHandler.class.getDeclaredMethod("openConnection", URL.class,
|
||||
Proxy.class);
|
||||
Method openConnectionReflect = URLStreamHandler.class.getDeclaredMethod("openConnection", URL.class, Proxy.class);
|
||||
openConnectionReflect.setAccessible(true);
|
||||
openConnection = MethodHandles.lookup().unreflect(openConnectionReflect);
|
||||
} catch (Throwable e) {
|
||||
@ -106,5 +104,4 @@ public final class UrlUtils {
|
||||
throw new AssertionError(e); // oh dear! this isn't meant to happen
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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