Basic Quick Play support

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2023-06-12 12:08:18 +01:00
parent 3dccc38f42
commit aaab95ba55
2 changed files with 26 additions and 6 deletions

View File

@ -563,10 +563,17 @@ QStringList MinecraftInstance::processMinecraftArgs(
}
if (serverToJoin && !serverToJoin->address.isEmpty())
{
if (profile->hasTrait("quickPlay"))
{
args_pattern += " --quickPlayMultiplayer " + serverToJoin->address + ':' + QString::number(serverToJoin->port);
}
else
{
args_pattern += " --server " + serverToJoin->address;
args_pattern += " --port " + QString::number(serverToJoin->port);
}
}
QMap<QString, QString> token_mapping;
// yggdrasil!

View File

@ -55,14 +55,21 @@
package org.prismlauncher.launcher.impl;
import java.lang.invoke.MethodHandle;
import java.util.Collections;
import java.util.List;
import org.prismlauncher.utils.Parameters;
import org.prismlauncher.utils.ReflectionUtils;
public final class StandardLauncher extends AbstractLauncher {
private final boolean quickPlaySupported;
public StandardLauncher(Parameters params) {
super(params);
List<String> traits = params.getList("traits", Collections.<String>emptyList());
quickPlaySupported = traits.contains("quickPlay");
}
@Override
@ -77,11 +84,17 @@ public final class StandardLauncher extends AbstractLauncher {
}
if (serverAddress != null) {
if (quickPlaySupported) {
// as of 23w14a
gameArgs.add("--quickPlayMultiplayer");
gameArgs.add(serverAddress + ':' + serverPort);
} else {
gameArgs.add("--server");
gameArgs.add(serverAddress);
gameArgs.add("--port");
gameArgs.add(serverPort);
}
}
// find and invoke the main method
MethodHandle method = ReflectionUtils.findMainMethod(mainClassName);