From 9f94b00925f0c46ab3acd67e7271c19d2ef4a256 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Thu, 5 Feb 2026 10:27:26 +0500 Subject: [PATCH] change: use different message when launching with no account selected Signed-off-by: Octol1ttle --- launcher/LaunchController.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp index c4123038a..2221158fb 100644 --- a/launcher/LaunchController.cpp +++ b/launcher/LaunchController.cpp @@ -81,8 +81,16 @@ void LaunchController::decideAccount() return; } - // Find an account to use. + // Select the account to use. If the instance has a specific account set, that will be used. Otherwise, the default account will be used auto accounts = APPLICATION->accounts(); + auto instanceAccountId = m_instance->settings()->get("InstanceAccountId").toString(); + auto instanceAccountIndex = accounts->findAccountByProfileId(instanceAccountId); + if (instanceAccountIndex == -1 || instanceAccountId.isEmpty()) { + m_accountToUse = accounts->defaultAccount(); + } else { + m_accountToUse = accounts->at(instanceAccountIndex); + } + if (!accounts->anyAccountIsValid()) { // Tell the user they need to log in at least one account in order to play. auto reply = CustomMessageBox::selectable(m_parentWidget, tr("No Accounts"), @@ -101,15 +109,6 @@ void LaunchController::decideAccount() } } - // Select the account to use. If the instance has a specific account set, that will be used. Otherwise, the default account will be used - auto instanceAccountId = m_instance->settings()->get("InstanceAccountId").toString(); - auto instanceAccountIndex = accounts->findAccountByProfileId(instanceAccountId); - if (instanceAccountIndex == -1 || instanceAccountId.isEmpty()) { - m_accountToUse = accounts->defaultAccount(); - } else { - m_accountToUse = accounts->at(instanceAccountIndex); - } - if (!m_accountToUse) { // If no default account is set, ask the user which one to use. ProfileSelectDialog selectDialog(tr("Which account would you like to use?"), ProfileSelectDialog::GlobalDefaultCheckbox, @@ -213,9 +212,11 @@ bool LaunchController::askPlayDemo() { QMessageBox box(m_parentWidget); box.setWindowTitle(tr("Play demo?")); - box.setText( - tr("This account does not own Minecraft.\nYou need to purchase the game first to play it.\n\nDo you want to play " - "the demo?")); + QString text = m_accountToUse + ? tr("This account does not own Minecraft.\nYou need to purchase the game first to play the full version.") + : tr("No account was selected for launch."); + text += tr("\n\nDo you want to play the demo?"); + box.setText(text); box.setIcon(QMessageBox::Warning); auto demoButton = box.addButton(tr("Play Demo"), QMessageBox::ButtonRole::YesRole); auto cancelButton = box.addButton(tr("Cancel"), QMessageBox::ButtonRole::NoRole);