Fix not replacing tokens metioned in #426
This commit is contained in:
@@ -82,7 +82,7 @@ public final class Arguments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> parseStringArguments(List<String> arguments, Map<String, String> keys) {
|
public static List<String> parseStringArguments(List<String> arguments, Map<String, String> keys) {
|
||||||
return arguments.stream().map(str -> keys.getOrDefault(str, str)).collect(Collectors.toList());
|
return arguments.stream().flatMap(str -> new StringArgument(str).toString(keys, Collections.emptyMap()).stream()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> parseArguments(List<Argument> arguments, Map<String, String> keys) {
|
public static List<String> parseArguments(List<Argument> arguments, Map<String, String> keys) {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class RuledArgument implements Argument {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> toString(Map<String, String> keys, Map<String, Boolean> features) {
|
public List<String> toString(Map<String, String> keys, Map<String, Boolean> features) {
|
||||||
if (CompatibilityRule.appliesToCurrentEnvironment(rules) && value != null)
|
if (CompatibilityRule.appliesToCurrentEnvironment(rules, features) && value != null)
|
||||||
return value.stream()
|
return value.stream()
|
||||||
.map(StringArgument::new)
|
.map(StringArgument::new)
|
||||||
.map(str -> str.toString(keys, features).get(0))
|
.map(str -> str.toString(keys, features).get(0))
|
||||||
|
|||||||
@@ -153,14 +153,6 @@ public class DefaultLauncher extends Launcher {
|
|||||||
|
|
||||||
res.addAll(Arguments.parseStringArguments(version.getMinecraftArguments().map(StringUtils::tokenize).orElseGet(LinkedList::new), configuration));
|
res.addAll(Arguments.parseStringArguments(version.getMinecraftArguments().map(StringUtils::tokenize).orElseGet(LinkedList::new), configuration));
|
||||||
|
|
||||||
// Optional Minecraft arguments
|
|
||||||
if (options.getHeight() != null && options.getHeight() != 0 && options.getWidth() != null && options.getWidth() != 0) {
|
|
||||||
res.add("--height");
|
|
||||||
res.add(options.getHeight().toString());
|
|
||||||
res.add("--width");
|
|
||||||
res.add(options.getWidth().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(options.getServerIp())) {
|
if (StringUtils.isNotBlank(options.getServerIp())) {
|
||||||
String[] args = options.getServerIp().split(":");
|
String[] args = options.getServerIp().split(":");
|
||||||
res.add("--server");
|
res.add("--server");
|
||||||
@@ -249,7 +241,9 @@ public class DefaultLauncher extends Launcher {
|
|||||||
pair("${game_directory}", repository.getRunDirectory(version.getId()).getAbsolutePath()),
|
pair("${game_directory}", repository.getRunDirectory(version.getId()).getAbsolutePath()),
|
||||||
pair("${user_type}", "mojang"),
|
pair("${user_type}", "mojang"),
|
||||||
pair("${assets_index_name}", version.getAssetIndex().getId()),
|
pair("${assets_index_name}", version.getAssetIndex().getId()),
|
||||||
pair("${user_properties}", authInfo.getUserProperties())
|
pair("${user_properties}", authInfo.getUserProperties()),
|
||||||
|
pair("${resolution_width}", options.getWidth().toString()),
|
||||||
|
pair("${resolution_height}", options.getHeight().toString())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user