This commit is contained in:
huanghongxun
2020-02-22 23:13:09 +08:00
parent 4aac45f3b4
commit fb4a499fe9
2 changed files with 18 additions and 17 deletions

View File

@@ -46,10 +46,8 @@ public final class VersionLibraryBuilder {
// Since $ will be escaped in linux, and our maintain of minecraftArgument will not cause escaping, // Since $ will be escaped in linux, and our maintain of minecraftArgument will not cause escaping,
// so we regenerate the minecraftArgument without escaping. // so we regenerate the minecraftArgument without escaping.
ret = ret.setMinecraftArguments(new CommandBuilder().addAllWithoutParsing(mcArgs).toString()); ret = ret.setMinecraftArguments(new CommandBuilder().addAllWithoutParsing(mcArgs).toString());
} else {
ret = ret.setArguments(ret.getArguments().map(args -> args.withGame(game)).orElse(new Arguments(game, null)));
} }
return ret; return ret.setArguments(ret.getArguments().map(args -> args.withGame(game)).orElse(new Arguments(game, null)));
} }
public void removeTweakClass(String target) { public void removeTweakClass(String target) {
@@ -63,19 +61,19 @@ public final class VersionLibraryBuilder {
--i; --i;
} }
} }
} else { }
for (int i = 0; i + 1 < game.size(); ++i) {
Argument arg0 = game.get(i); for (int i = 0; i + 1 < game.size(); ++i) {
Argument arg1 = game.get(i + 1); Argument arg0 = game.get(i);
if (arg0 instanceof StringArgument && arg1 instanceof StringArgument) { Argument arg1 = game.get(i + 1);
// We need to preserve the tokens if (arg0 instanceof StringArgument && arg1 instanceof StringArgument) {
String arg0Str = arg0.toString(); // We need to preserve the tokens
String arg1Str = arg1.toString(); String arg0Str = arg0.toString();
if (arg0Str.equals("--tweakClass") && arg1Str.toLowerCase().contains(target)) { String arg1Str = arg1.toString();
game.remove(i); if (arg0Str.equals("--tweakClass") && arg1Str.toLowerCase().contains(target)) {
game.remove(i); game.remove(i);
--i; game.remove(i);
} --i;
} }
} }
} }

View File

@@ -163,7 +163,10 @@ 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));
Map<String, Boolean> features = getFeatures(); Map<String, Boolean> features = getFeatures();
res.addAll(Arguments.parseArguments(version.getArguments().map(Arguments::getGame).orElseGet(this::getDefaultGameArguments), configuration, features)); version.getArguments().map(Arguments::getGame).ifPresent(arguments -> res.addAll(Arguments.parseArguments(arguments, configuration, features)));
if (version.getMinecraftArguments().isPresent()) {
res.addAll(Arguments.parseArguments(this.getDefaultGameArguments(), configuration, features));
}
if (authInfo.getArguments() != null && authInfo.getArguments().getGame() != null && !authInfo.getArguments().getGame().isEmpty()) if (authInfo.getArguments() != null && authInfo.getArguments().getGame() != null && !authInfo.getArguments().getGame().isEmpty())
res.addAll(Arguments.parseArguments(authInfo.getArguments().getGame(), configuration, features)); res.addAll(Arguments.parseArguments(authInfo.getArguments().getGame(), configuration, features));