diff --git a/app/assets/js/configmanager.js b/app/assets/js/configmanager.js index d4e93189ad..a3a63eef06 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: false }, launcher: { allowPrerelease: false, @@ -688,6 +689,25 @@ 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..13c023999d 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..d606ac1712 100644 --- a/app/settings.ejs +++ b/app/settings.ejs @@ -89,6 +89,17 @@ +
+
+ Ouvrir la console au démarrage du jeu + Ceci ouvre la console dès que Minecraft démarre. +
+ +
+