4
0
mirror of https://github.com/AltarikMC/Launcher synced 2024-11-22 06:19:50 +01:00

Fix launcher still consider downloading assets when download failed (caused by corrupted files)

This commit is contained in:
Quentin Legot 2022-06-22 22:44:33 +02:00
parent 38fd3ad906
commit 73e4666659

View File

@ -92,6 +92,10 @@ class Minecraft {
max: args.maxMem, max: args.maxMem,
min: args.minMem min: args.minMem
} }
}).then(v => {
if(v === null) {
this.close(event, -1)
}
}) })
this.launcher.on('debug', (e) => logger.info(`debug: ${e}`)); this.launcher.on('debug', (e) => logger.info(`debug: ${e}`));
this.launcher.on('data', (e) => logger.info(`data: ${e}`)); this.launcher.on('data', (e) => logger.info(`data: ${e}`));
@ -105,12 +109,7 @@ class Minecraft {
logger.info(e) logger.info(e)
}) })
this.launcher.on('close', (e) => { this.launcher.on('close', (e) => {
event.sender.send("close", e) this.close(event, e)
if(e !== 0) {
logger.warn("Minecraft didn't close properly")
logger.warn(e)
this.showNotification("Une erreur est survenue", "Minecraft ne s'est pas fermé correctement", "error")
}
}) })
}).catch((err) => { }).catch((err) => {
this.showNotification("Impossible de lancer le jeu", "Erreur inconnue", "error") this.showNotification("Impossible de lancer le jeu", "Erreur inconnue", "error")
@ -127,6 +126,15 @@ class Minecraft {
} }
close(event, code) {
event.sender.send("close", code)
if(code !== 0) {
logger.warn("Minecraft didn't close properly")
logger.warn(code)
this.showNotification("Une erreur est survenue", "Minecraft ne s'est pas fermé correctement", "error")
}
}
getModsInformations(event) { getModsInformations(event) {
fetch("https://altarik.fr/launcher.json").then(response => { fetch("https://altarik.fr/launcher.json").then(response => {
if(response.ok) { if(response.ok) {