From c44ba31c5f27b59f0fb3765639996d7c6cecb1da Mon Sep 17 00:00:00 2001 From: GeekCornerGH <45696571+GeekCornerGH@users.noreply.github.com> Date: Fri, 18 Dec 2020 12:28:50 +0100 Subject: [PATCH 1/5] Correction du bug du launcher --- app/assets/js/configmanager.js | 25 ++++++++++++++++++++++++- app/assets/js/scripts/landing.js | 6 +++++- app/settings.ejs | 24 +++++++++++++++--------- 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/app/assets/js/configmanager.js b/app/assets/js/configmanager.js index d4e93189ad..4441ff9a5a 100644 --- a/app/assets/js/configmanager.js +++ b/app/assets/js/configmanager.js @@ -107,7 +107,8 @@ const DEFAULT_CONFIG = { resHeight: 720, fullscreen: false, autoConnect: true, - launchDetached: true + launchDetached: true, + consoleOnLaunch: true }, launcher: { allowPrerelease: false, @@ -688,6 +689,28 @@ exports.setLaunchDetached = function(launchDetached){ config.settings.game.launchDetached = launchDetached } + +/** + * Check if the game should open the devtools console on launch + * + * @param {boolean} def Optional. If true, the default value will be returned. + * @returns {boolean} Whether or not to open the devtools console on launch + */ +exports.getConsoleOnLaunch = function(def = false){ + return !def ? config.settings.game.consoleOnLaunch : DEFAULT_CONFIG.settings.game.consoleOnLaunch +} + +/** + * Change the status of whether or not the devtools console should open on launch + * + * @param {boolean} consoleOnLaunch whether or not to open the devtools console on launch + */ +exports.setConsoleOnLaunch = function(consoleOnLaunch){ + config.settings.game.consoleOnLaunch = consoleOnLaunch +} + + + // Launcher Settings /** diff --git a/app/assets/js/scripts/landing.js b/app/assets/js/scripts/landing.js index fc6459885f..d8dd8cda38 100644 --- a/app/assets/js/scripts/landing.js +++ b/app/assets/js/scripts/landing.js @@ -86,6 +86,10 @@ function setLaunchEnabled(val) { // Bind launch button document.getElementById('launch_button').addEventListener('click', function (e) { if (checkCurrentServer(true)) { + if(ConfigManager.getConsoleOnLaunch()){ + let window = remote.getCurrentWindow() + window.toggleDevTools() + } loggerLanding.log('Launching game..') const mcVersion = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer()).getMinecraftVersion() const jExe = ConfigManager.getJavaExecutable() @@ -755,7 +759,7 @@ function dlAsync(login = true) { proc.stdout.on('data', tempListener) proc.stderr.on('data', gameErrorListener) - setLaunchDetails('C\'est bon! Profitez de votre expérience de jeu sur le serveur!') + setLaunchDetails('C\'est bon! Bon jeu!') proc.on('close', (code, signal) => { if(hasRPC){ diff --git a/app/settings.ejs b/app/settings.ejs index a518c94dd8..c1a664ad84 100644 --- a/app/settings.ejs +++ b/app/settings.ejs @@ -89,6 +89,7 @@ +
](https://travis-ci.org/github/GeekCornerGH/RTMC-Launcher) [](https://github.com/GeekCornerGH/RTMC-Launcher/releases)
+[](https://travis-ci.org/github/GeekCornerGH/RTMC-Launcher) [](https://github.com/GeekCornerGH/RTMC-Launcher/releases)
Rejoignez les serveurs RTMC sans avoir à vous soucier d'installer Java, Forge et les mods. Notre launcher s'occuper de tout ça pour vous.