aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--launcher/Application.cpp3
-rw-r--r--launcher/JavaCommon.cpp11
-rw-r--r--launcher/LaunchController.cpp11
-rw-r--r--launcher/minecraft/auth/steps/XboxAuthorizationStep.cpp2
-rw-r--r--launcher/ui/pages/instance/InstanceSettingsPage.cpp1
5 files changed, 23 insertions, 5 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 690a7ee4..9cca534c 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -696,6 +696,9 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
// Minecraft launch method
m_settings->registerSetting("MCLaunchMethod", "LauncherPart");
+ // Minecraft offline player name
+ m_settings->registerSetting("LastOfflinePlayerName", "");
+
// Wrapper command for launch
m_settings->registerSetting("WrapperCommand", "");
diff --git a/launcher/JavaCommon.cpp b/launcher/JavaCommon.cpp
index a6542fa7..17278d86 100644
--- a/launcher/JavaCommon.cpp
+++ b/launcher/JavaCommon.cpp
@@ -17,6 +17,17 @@ bool JavaCommon::checkJVMArgs(QString jvmargs, QWidget *parent)
QMessageBox::Warning)->exec();
return false;
}
+ // block lunacy with passing required version to the JVM
+ if (jvmargs.contains(QRegExp("-version:.*"))) {
+ auto warnStr = QObject::tr(
+ "You tried to pass required Java version argument to the JVM (using \"-version:xxx\"). This is not safe and will not be allowed.\n"
+ "This message will be displayed until you remove this from the JVM arguments.");
+ CustomMessageBox::selectable(
+ parent, QObject::tr("JVM arguments warning"),
+ warnStr,
+ QMessageBox::Warning)->exec();
+ return false;
+ }
return true;
}
diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp
index 792d8381..4cb62e69 100644
--- a/launcher/LaunchController.cpp
+++ b/launcher/LaunchController.cpp
@@ -71,7 +71,10 @@ void LaunchController::executeTask()
return;
}
- JavaCommon::checkJVMArgs(m_instance->settings()->get("JvmArgs").toString(), m_parentWidget);
+ if(!JavaCommon::checkJVMArgs(m_instance->settings()->get("JvmArgs").toString(), m_parentWidget)) {
+ emitFailed(tr("Invalid Java arguments specified. Please fix this first."));
+ return;
+ }
login();
}
@@ -166,13 +169,14 @@ void LaunchController::login() {
if(!m_session->wants_online) {
// we ask the user for a player name
bool ok = false;
- QString usedname = m_session->player_name;
+ QString lastOfflinePlayerName = APPLICATION->settings()->get("LastOfflinePlayerName").toString();
+ QString usedname = lastOfflinePlayerName.isEmpty() ? m_session->player_name : lastOfflinePlayerName;
QString name = QInputDialog::getText(
m_parentWidget,
tr("Player name"),
tr("Choose your offline mode player name."),
QLineEdit::Normal,
- m_session->player_name,
+ usedname,
&ok
);
if (!ok)
@@ -183,6 +187,7 @@ void LaunchController::login() {
if (name.length())
{
usedname = name;
+ APPLICATION->settings()->set("LastOfflinePlayerName", usedname);
}
m_session->MakeOffline(usedname);
// offline flavored game from here :3
diff --git a/launcher/minecraft/auth/steps/XboxAuthorizationStep.cpp b/launcher/minecraft/auth/steps/XboxAuthorizationStep.cpp
index 07eeb7dc..589768e3 100644
--- a/launcher/minecraft/auth/steps/XboxAuthorizationStep.cpp
+++ b/launcher/minecraft/auth/steps/XboxAuthorizationStep.cpp
@@ -65,7 +65,7 @@ void XboxAuthorizationStep::onRequestDone(
if(!processSTSError(error, data, headers)) {
emit finished(
AccountTaskState::STATE_FAILED_SOFT,
- tr("Failed to get authorization for %1 services. Error %1.").arg(m_authorizationKind, error)
+ tr("Failed to get authorization for %1 services. Error %2.").arg(m_authorizationKind, error)
);
}
return;
diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.cpp b/launcher/ui/pages/instance/InstanceSettingsPage.cpp
index a5985741..a48c4d69 100644
--- a/launcher/ui/pages/instance/InstanceSettingsPage.cpp
+++ b/launcher/ui/pages/instance/InstanceSettingsPage.cpp
@@ -179,7 +179,6 @@ void InstanceSettingsPage::applySettings()
if(javaArgs)
{
m_settings->set("JvmArgs", ui->jvmArgsTextBox->toPlainText().replace("\n", " "));
- JavaCommon::checkJVMArgs(m_settings->get("JvmArgs").toString(), this->parentWidget());
}
else
{