Fix duplicate launch arguments causing a crash in older versions

This commit is contained in:
Pierce 2019-04-26 10:30:09 -04:00
parent 3036b1de6d
commit 2ca80ba612

View file

@ -62,7 +62,13 @@ module.exports = async function (options) {
const launchArguments = args.concat(jvm, classPaths, launchOptions); const launchArguments = args.concat(jvm, classPaths, launchOptions);
const minecraft = child.spawn(options.javaPath ? options.javaPath : 'java', launchArguments); const cleanArguments = [];
for(arg in launchArguments) {
if (cleanArguments.includes(launchArguments[arg])) continue;
cleanArguments.push(launchArguments[arg]);
}
const minecraft = child.spawn(options.javaPath ? options.javaPath : 'java', cleanArguments);
minecraft.stdout.on('data', (data) => event.emit('data', data)); minecraft.stdout.on('data', (data) => event.emit('data', data));
minecraft.stderr.on('data', (data) => event.emit('error', data)); minecraft.stderr.on('data', (data) => event.emit('error', data));
minecraft.on('close', (code) => event.emit('close', code)); minecraft.on('close', (code) => event.emit('close', code));