From f90c2b89afe4a1d8263b020817c6109f4a84eabf Mon Sep 17 00:00:00 2001 From: Pierce Date: Thu, 25 Apr 2019 08:57:46 -0400 Subject: [PATCH] Deprecated start, fixed download hanging --- README.md | 1 - components/handler.js | 2 +- components/launcher.js | 6 +----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f45df06..8c56750 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,6 @@ If you are loading up a client outside of vanilla Minecraft and Forge (Optifine | `close` | Integer | Code number that is returned by the Minecraft Process | | `error` | String | Emitted when the Minecraft Process errors | | `package-extract` | null | Emitted when `clientPackage` finishes being extracted | -| `start` | null | Emitted after `launchArguments` are set. THIS WILL BE DEPRECATED AS ITS NOT ACCURATE | | `download` | String | Emitted when a file successfully downloads | | `download-status` | Object | Emitted when data is received while downloading | #### Client Package Function diff --git a/components/handler.js b/components/handler.js index 56e96dd..2b56027 100644 --- a/components/handler.js +++ b/components/handler.js @@ -10,7 +10,7 @@ function downloadAsync (url, directory, name) { return new Promise(resolve => { shelljs.mkdir('-p', directory); - const _request = request(url); + const _request = request(url, {timeout: 10000}); _request.on('error', function(error) { resolve({ diff --git a/components/launcher.js b/components/launcher.js index 8ee1776..a152fd9 100644 --- a/components/launcher.js +++ b/components/launcher.js @@ -48,12 +48,9 @@ module.exports = async function (options) { if(forge) { classPaths.push(`${options.forge.path};${forge.paths.join(';')};${classes.join(';')};${mcPath}`); classPaths.push(forge.forge.mainClass) - } else if(custom) { - classPaths.push(`${classes.join(";")};${mcPath}`); - classPaths.push(custom.mainClass); } else { classPaths.push(`${mcPath};${classes.join(";")}`); - classPaths.push(versionFile.mainClass); + classPaths.push(versionFile.mainClass || custom.mainClass); } // Download version's assets @@ -66,7 +63,6 @@ module.exports = async function (options) { const launchArguments = args.concat(jvm, classPaths, launchOptions); const minecraft = child.spawn(options.javaPath ? options.javaPath : 'java', launchArguments); - event.emit('start', null); minecraft.stdout.on('data', (data) => event.emit('data', data)); minecraft.stderr.on('data', (data) => event.emit('error', data)); minecraft.on('close', (code) => event.emit('close', code));