diff --git a/launcher/ui/dialogs/CreateShortcutDialog.cpp b/launcher/ui/dialogs/CreateShortcutDialog.cpp index fba8cdd7..3dc91988 100644 --- a/launcher/ui/dialogs/CreateShortcutDialog.cpp +++ b/launcher/ui/dialogs/CreateShortcutDialog.cpp @@ -47,8 +47,10 @@ CreateShortcutDialog::CreateShortcutDialog(QWidget *parent, InstancePtr instance { MinecraftInstancePtr minecraftInstance = qobject_pointer_cast(m_instance); minecraftInstance->getPackProfile()->reload(Net::Mode::Online); - QString version = minecraftInstance->getPackProfile()->getComponentVersion("net.minecraft"); - bool enableJoinServer = !QRegExp(JOIN_SERVER_DISALLOWED_VERSIONS).exactMatch(version); + QDateTime versionDate = minecraftInstance->getPackProfile()->getComponent("net.minecraft")->getReleaseDateTime(); + bool enableJoinServer = (versionDate < MC_145102_START) + || (versionDate >= MC_145102_END && versionDate < MC_228828_START) + || (versionDate >= MC_228828_END); ui->joinServerCheckBox->setEnabled(enableJoinServer); ui->joinServer->setEnabled(enableJoinServer); } diff --git a/launcher/ui/dialogs/CreateShortcutDialog.h b/launcher/ui/dialogs/CreateShortcutDialog.h index 8e6d961f..d27e94cd 100644 --- a/launcher/ui/dialogs/CreateShortcutDialog.h +++ b/launcher/ui/dialogs/CreateShortcutDialog.h @@ -10,26 +10,17 @@ #include #include "minecraft/auth/MinecraftAccount.h" #include "BaseInstance.h" +#include "minecraft/ParseUtils.h" #ifdef Q_OS_WIN #include #endif -const QString JOIN_SERVER_DISALLOWED_VERSIONS( - "(19w0[89][a-z])" - "|(19w1[0-9][a-z])" - "|(1.14.?[1-4]?-pre[0-9])" - "|(1.14.?[1-4]?)" - "|(19w[34][0-9][a-z])" - "|(1.15.?[0-9]?-pre[0-9])" - "|(1.15.?[0-9]?)" - "|(20w[01][0-9][a-z])" - "|(20w20a)" - "|(21w[12][0-9][a-z])" - "|(1.17-pre[0-9])" - "|(1.17-rc[0-9])" - "|(1.17)" - ); +// Dates when the game was affected by bugs that crashed the game when using the option to join a server on startup +const QDateTime MC_145102_START = timeFromS3Time("2019-02-20T14:56:58+00:00"); +const QDateTime MC_145102_END = timeFromS3Time("2020-05-14T08:16:26+00:00"); +const QDateTime MC_228828_START = timeFromS3Time("2021-03-10T15:24:38+00:00"); +const QDateTime MC_228828_END = timeFromS3Time("2021-06-18T12:24:40+00:00"); namespace Ui {