From c5005b9024a5f2f6114b09a50b9ad5cbf3f52b65 Mon Sep 17 00:00:00 2001 From: itsMeRaj69 Date: Sun, 13 Jul 2025 21:49:21 +0530 Subject: [PATCH 1/3] Fixes more of the OM (Offline Mode) breaking codes --- launcher/LaunchController.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp index 066ec575b..82a73b05a 100644 --- a/launcher/LaunchController.cpp +++ b/launcher/LaunchController.cpp @@ -136,15 +136,24 @@ 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?")); + tr("This account does not own Minecraft.\n" + "You need to purchase the game first to play it.\n\n" + "Do you want to play the demo?")); box.setIcon(QMessageBox::Warning); + auto demoButton = box.addButton(tr("Play Demo"), QMessageBox::ButtonRole::YesRole); - auto cancelButton = box.addButton(tr("Cancel"), QMessageBox::ButtonRole::NoRole); - box.setDefaultButton(cancelButton); + auto continueButton = box.addButton(tr("Continue Anyway"), QMessageBox::ButtonRole::AcceptRole); + auto cancelButton = box.addButton(tr("Cancel"), QMessageBox::ButtonRole::RejectRole); box.exec(); - return box.clickedButton() == demoButton; + + if (box.clickedButton() == demoButton) { + return true; + } else if (box.clickedButton() == continueButton) { + return true; + } else { + return false; + } } QString LaunchController::askOfflineName(QString playerName, bool demo, bool& ok) From a486d78df90d05e5b4a64f7e63f29559d124fa22 Mon Sep 17 00:00:00 2001 From: itsMeRaj69 Date: Mon, 14 Jul 2025 01:28:51 +0530 Subject: [PATCH 2/3] Hoping this build may fix the issues... --- launcher/LaunchController.cpp | 2 +- launcher/ui/pages/global/AccountListPage.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp index 82a73b05a..840c85cfa 100644 --- a/launcher/LaunchController.cpp +++ b/launcher/LaunchController.cpp @@ -150,7 +150,7 @@ bool LaunchController::askPlayDemo() if (box.clickedButton() == demoButton) { return true; } else if (box.clickedButton() == continueButton) { - return true; + return false; } else { return false; } diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp index 77521decf..c62cf25e0 100644 --- a/launcher/ui/pages/global/AccountListPage.cpp +++ b/launcher/ui/pages/global/AccountListPage.cpp @@ -141,10 +141,11 @@ void AccountListPage::on_actionAddMicrosoft_triggered() void AccountListPage::on_actionAddOffline_triggered() { -// Deleted the logic to allow creation of -// Offline account - MinecraftAccountPtr account = - OfflineLoginDialog::newAccount(this, tr("Please enter your desired username to add your offline account.")); + if (!m_accounts->anyAccountIsValid()) { + QMessageBox::warning(this, tr("Warning"), tr("Please be less broke next time and actually own Minecraft ;)")); + } + + MinecraftAccountPtr account = OfflineLoginDialog::newAccount(this, tr("Please enter your desired username to add your offline account.")); if (account) { m_accounts->addAccount(account); @@ -153,7 +154,6 @@ void AccountListPage::on_actionAddOffline_triggered() } } } - void AccountListPage::on_actionRemove_triggered() { auto response = CustomMessageBox::selectable(this, tr("Remove account?"), tr("Do you really want to delete this account?"), From a92fc1c0081c2bfb2e1a2b492830989ff2ab172f Mon Sep 17 00:00:00 2001 From: itsMeRaj69 Date: Sat, 19 Jul 2025 23:21:01 +0530 Subject: [PATCH 3/3] Fixed some Offline Mode related issues --- launcher/LaunchController.cpp | 37 ++++++++-------------- launcher/minecraft/auth/MinecraftAccount.h | 3 +- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp index 840c85cfa..26f539e15 100644 --- a/launcher/LaunchController.cpp +++ b/launcher/LaunchController.cpp @@ -87,24 +87,24 @@ void LaunchController::decideAccount() // Find an account to use. auto accounts = APPLICATION->accounts(); - - // If no accounts exist, show prompt to add one - if (accounts->count() <= 0) { + if (accounts->count() <= 0 || !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"), - tr("No accounts found. Would you like to open the account manager to add one now?"), + tr("In order to play Minecraft, you must have at least one Microsoft " + "account which owns Minecraft logged in. " + "Would you like to open the account manager to add an account now?"), QMessageBox::Information, QMessageBox::Yes | QMessageBox::No) ->exec(); if (reply == QMessageBox::Yes) { + // Open the account manager. APPLICATION->ShowGlobalSettings(m_parentWidget, "accounts"); + } else if (reply == QMessageBox::No) { + // Do not open "profile select" dialog. + return; } - - return; } - // Skipping Microsoft account validity check to allow offline/local use - // Removed: anyAccountIsValid() check - // 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); @@ -136,24 +136,15 @@ bool LaunchController::askPlayDemo() QMessageBox box(m_parentWidget); box.setWindowTitle(tr("Play demo?")); box.setText( - tr("This account does not own Minecraft.\n" - "You need to purchase the game first to play it.\n\n" - "Do you want to play the demo?")); + 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?")); box.setIcon(QMessageBox::Warning); - auto demoButton = box.addButton(tr("Play Demo"), QMessageBox::ButtonRole::YesRole); - auto continueButton = box.addButton(tr("Continue Anyway"), QMessageBox::ButtonRole::AcceptRole); - auto cancelButton = box.addButton(tr("Cancel"), QMessageBox::ButtonRole::RejectRole); + auto cancelButton = box.addButton(tr("Cancel"), QMessageBox::ButtonRole::NoRole); + box.setDefaultButton(cancelButton); box.exec(); - - if (box.clickedButton() == demoButton) { - return true; - } else if (box.clickedButton() == continueButton) { - return false; - } else { - return false; - } + return box.clickedButton() == demoButton; } QString LaunchController::askOfflineName(QString playerName, bool demo, bool& ok) diff --git a/launcher/minecraft/auth/MinecraftAccount.h b/launcher/minecraft/auth/MinecraftAccount.h index f6fcfada2..b8f24ea2c 100644 --- a/launcher/minecraft/auth/MinecraftAccount.h +++ b/launcher/minecraft/auth/MinecraftAccount.h @@ -116,7 +116,8 @@ class MinecraftAccount : public QObject, public Usable { [[nodiscard]] AccountType accountType() const noexcept { return data.type; } - bool ownsMinecraft() const { return data.type != AccountType::Offline && data.minecraftEntitlement.ownsMinecraft; } + // bool ownsMinecraft() const { return data.type != AccountType::Offline && data.minecraftEntitlement.ownsMinecraft; } + bool ownsMinecraft() const { return true; } bool hasProfile() const { return data.profileId().size() != 0; }