change default maven repo so typesafe doesnt break. solves #26 and #27

This commit is contained in:
Pierce 2019-10-26 17:53:04 -04:00
parent d60dcf0209
commit 5619acb711

View file

@ -45,6 +45,11 @@ class Handler {
let total_bytes = 0; let total_bytes = 0;
_request.on('response', (data) => { _request.on('response', (data) => {
if (data.statusCode === 404) {
this.client.emit('debug', `[MCLC]: Failed to download ${url} due to: File not found...`);
resolve(false);
}
total_bytes = parseInt(data.headers['content-length']); total_bytes = parseInt(data.headers['content-length']);
}); });
@ -327,7 +332,7 @@ class Handler {
} }
} }
const downloadLink = `${url}${lib[0].replace(/\./g, '/')}/${lib[1]}/${lib[2]}/${lib[1]}-${lib[2]}.jar`; const downloadLink = `${url}${lib[0].replace(/\./g, '/')}/${lib[1]}/${lib[2]}/${name}`;
if(fs.existsSync(path.join(jarPath, name))) { if(fs.existsSync(path.join(jarPath, name))) {
paths.push(`${jarPath}${path.sep}${name}`); paths.push(`${jarPath}${path.sep}${name}`);
@ -337,7 +342,8 @@ class Handler {
} }
if(!fs.existsSync(jarPath)) shelljs.mkdir('-p', jarPath); if(!fs.existsSync(jarPath)) shelljs.mkdir('-p', jarPath);
await this.downloadAsync(downloadLink, jarPath, name, true, 'forge'); const download = await this.downloadAsync(downloadLink, jarPath, name, true, 'forge');
if(!download) await this.downloadAsync(`https://search.maven.org/remotecontent?filepath=${lib[0].replace(/\./g, '/')}/${lib[1]}/${lib[2]}/${name}`, jarPath, name, true, 'forge');
paths.push(`${jarPath}${path.sep}${name}`); paths.push(`${jarPath}${path.sep}${name}`);
counter = counter + 1; counter = counter + 1;