From 7cce90bed8535aeb04fe475f67aacfa1fab7bc43 Mon Sep 17 00:00:00 2001 From: Glavo Date: Tue, 5 Mar 2024 15:07:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20Mojang=20=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=94=AF=E6=8C=81=20(#2889)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 删除 Mojang 登录支持 * update * update --- .../org/jackhuang/hmcl/setting/Accounts.java | 9 +-- .../hmcl/ui/account/AccountListItem.java | 22 +++-- .../hmcl/ui/account/AccountListPage.java | 8 -- .../ui/account/ClassicAccountLoginDialog.java | 19 ----- .../hmcl/ui/account/CreateAccountPane.java | 46 +---------- .../ui/account/OAuthAccountLoginDialog.java | 2 +- .../resources/assets/lang/I18N.properties | 9 +-- .../resources/assets/lang/I18N_es.properties | 9 +-- .../resources/assets/lang/I18N_ja.properties | 6 +- .../resources/assets/lang/I18N_ru.properties | 12 +-- .../resources/assets/lang/I18N_zh.properties | 11 +-- .../assets/lang/I18N_zh_CN.properties | 7 +- .../yggdrasil/MojangYggdrasilProvider.java | 62 -------------- .../hmcl/auth/yggdrasil/YggdrasilAccount.java | 2 +- .../yggdrasil/YggdrasilAccountFactory.java | 80 ------------------- .../hmcl/auth/yggdrasil/YggdrasilService.java | 4 - 16 files changed, 24 insertions(+), 284 deletions(-) delete mode 100644 HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/MojangYggdrasilProvider.java delete mode 100644 HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccountFactory.java diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java index 0febd3369..fa240c8e2 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java @@ -33,8 +33,6 @@ import org.jackhuang.hmcl.auth.microsoft.MicrosoftService; import org.jackhuang.hmcl.auth.offline.OfflineAccount; import org.jackhuang.hmcl.auth.offline.OfflineAccountFactory; import org.jackhuang.hmcl.auth.yggdrasil.RemoteAuthenticationException; -import org.jackhuang.hmcl.auth.yggdrasil.YggdrasilAccount; -import org.jackhuang.hmcl.auth.yggdrasil.YggdrasilAccountFactory; import org.jackhuang.hmcl.game.OAuthServer; import org.jackhuang.hmcl.task.Schedulers; import org.jackhuang.hmcl.util.InvocationDispatcher; @@ -83,17 +81,15 @@ public final class Accounts { public static final OAuthServer.Factory OAUTH_CALLBACK = new OAuthServer.Factory(); public static final OfflineAccountFactory FACTORY_OFFLINE = new OfflineAccountFactory(AUTHLIB_INJECTOR_DOWNLOADER); - public static final YggdrasilAccountFactory FACTORY_MOJANG = YggdrasilAccountFactory.MOJANG; public static final AuthlibInjectorAccountFactory FACTORY_AUTHLIB_INJECTOR = new AuthlibInjectorAccountFactory(AUTHLIB_INJECTOR_DOWNLOADER, Accounts::getOrCreateAuthlibInjectorServer); public static final MicrosoftAccountFactory FACTORY_MICROSOFT = new MicrosoftAccountFactory(new MicrosoftService(OAUTH_CALLBACK)); - public static final List> FACTORIES = immutableListOf(FACTORY_OFFLINE, FACTORY_MOJANG, FACTORY_MICROSOFT, FACTORY_AUTHLIB_INJECTOR); + public static final List> FACTORIES = immutableListOf(FACTORY_OFFLINE, FACTORY_MICROSOFT, FACTORY_AUTHLIB_INJECTOR); // ==== login type / account factory mapping ==== private static final Map> type2factory = new HashMap<>(); private static final Map, String> factory2type = new HashMap<>(); static { type2factory.put("offline", FACTORY_OFFLINE); - type2factory.put("yggdrasil", FACTORY_MOJANG); type2factory.put("authlibInjector", FACTORY_AUTHLIB_INJECTOR); type2factory.put("microsoft", FACTORY_MICROSOFT); @@ -126,8 +122,6 @@ public final class Accounts { return FACTORY_OFFLINE; else if (account instanceof AuthlibInjectorAccount) return FACTORY_AUTHLIB_INJECTOR; - else if (account instanceof YggdrasilAccount) - return FACTORY_MOJANG; else if (account instanceof MicrosoftAccount) return FACTORY_MICROSOFT; else @@ -414,7 +408,6 @@ public final class Accounts { // ==== Login type name i18n === private static final Map, String> unlocalizedLoginTypeNames = mapOf( pair(Accounts.FACTORY_OFFLINE, "account.methods.offline"), - pair(Accounts.FACTORY_MOJANG, "account.methods.yggdrasil"), pair(Accounts.FACTORY_AUTHLIB_INJECTOR, "account.methods.authlib_injector"), pair(Accounts.FACTORY_MICROSOFT, "account.methods.microsoft")); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountListItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountListItem.java index f8b2c5293..765bd323e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountListItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountListItem.java @@ -120,19 +120,15 @@ public class AccountListItem extends RadioButton { } public ObservableBooleanValue canUploadSkin() { - if (account instanceof YggdrasilAccount) { - if (account instanceof AuthlibInjectorAccount) { - AuthlibInjectorAccount aiAccount = (AuthlibInjectorAccount) account; - ObjectBinding> profile = aiAccount.getYggdrasilService().getProfileRepository().binding(aiAccount.getUUID()); - return createBooleanBinding(() -> { - Set uploadableTextures = profile.get() - .map(AuthlibInjectorAccount::getUploadableTextures) - .orElse(emptySet()); - return uploadableTextures.contains(TextureType.SKIN); - }, profile); - } else { - return createBooleanBinding(() -> true); - } + if (account instanceof AuthlibInjectorAccount) { + AuthlibInjectorAccount aiAccount = (AuthlibInjectorAccount) account; + ObjectBinding> profile = aiAccount.getYggdrasilService().getProfileRepository().binding(aiAccount.getUUID()); + return createBooleanBinding(() -> { + Set uploadableTextures = profile.get() + .map(AuthlibInjectorAccount::getUploadableTextures) + .orElse(emptySet()); + return uploadableTextures.contains(TextureType.SKIN); + }, profile); } else if (account instanceof OfflineAccount || account instanceof MicrosoftAccount) { return createBooleanBinding(() -> true); } else { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountListPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountListPage.java index 876fbac00..67b93e31e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountListPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountListPage.java @@ -107,14 +107,6 @@ public class AccountListPage extends DecoratorAnimatedPage implements DecoratorP offlineItem.setOnAction(e -> Controllers.dialog(new CreateAccountPane(Accounts.FACTORY_OFFLINE))); boxMethods.getChildren().add(offlineItem); - AdvancedListItem mojangItem = new AdvancedListItem(); - mojangItem.getStyleClass().add("navigation-drawer-item"); - mojangItem.setActionButtonVisible(false); - mojangItem.setTitle(i18n("account.methods.yggdrasil")); - mojangItem.setLeftGraphic(wrap(SVG.MOJANG)); - mojangItem.setOnAction(e -> Controllers.dialog(new CreateAccountPane(Accounts.FACTORY_MOJANG))); - boxMethods.getChildren().add(mojangItem); - AdvancedListItem microsoftItem = new AdvancedListItem(); microsoftItem.getStyleClass().add("navigation-drawer-item"); microsoftItem.setActionButtonVisible(false); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/ClassicAccountLoginDialog.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/ClassicAccountLoginDialog.java index 16dfe7935..8d44a8390 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/ClassicAccountLoginDialog.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/ClassicAccountLoginDialog.java @@ -24,20 +24,15 @@ import com.jfoenix.controls.JFXProgressBar; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.control.Label; -import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import org.jackhuang.hmcl.auth.AuthInfo; import org.jackhuang.hmcl.auth.ClassicAccount; import org.jackhuang.hmcl.auth.NoSelectedCharacterException; -import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorAccount; -import org.jackhuang.hmcl.auth.yggdrasil.YggdrasilAccount; -import org.jackhuang.hmcl.auth.yggdrasil.YggdrasilService; import org.jackhuang.hmcl.setting.Accounts; import org.jackhuang.hmcl.task.Schedulers; import org.jackhuang.hmcl.task.Task; import org.jackhuang.hmcl.ui.construct.DialogCloseEvent; -import org.jackhuang.hmcl.ui.construct.JFXHyperlink; import org.jackhuang.hmcl.ui.construct.RequiredValidator; import java.util.function.Consumer; @@ -84,20 +79,6 @@ public class ClassicAccountLoginDialog extends StackPane { txtPassword.setPromptText(i18n("account.password")); body.getChildren().setAll(usernameLabel, txtPassword); - - if (oldAccount instanceof YggdrasilAccount && !(oldAccount instanceof AuthlibInjectorAccount)) { - HBox linkPane = new HBox(8); - body.getChildren().add(linkPane); - - JFXHyperlink migrationLink = new JFXHyperlink(i18n("account.methods.yggdrasil.migration")); - migrationLink.setExternalLink(YggdrasilService.PROFILE_URL); - - JFXHyperlink migrationHowLink = new JFXHyperlink(i18n("account.methods.yggdrasil.migration.how")); - migrationHowLink.setExternalLink(YggdrasilService.MIGRATION_FAQ_URL); - - linkPane.getChildren().setAll(migrationLink, migrationHowLink); - } - dialogLayout.setBody(body); } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java index 06c6763a0..9a17ba55c 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java @@ -44,7 +44,6 @@ import org.jackhuang.hmcl.auth.authlibinjector.BoundAuthlibInjectorAccountFactor import org.jackhuang.hmcl.auth.microsoft.MicrosoftAccountFactory; import org.jackhuang.hmcl.auth.offline.OfflineAccountFactory; import org.jackhuang.hmcl.auth.yggdrasil.GameProfile; -import org.jackhuang.hmcl.auth.yggdrasil.YggdrasilAccountFactory; import org.jackhuang.hmcl.auth.yggdrasil.YggdrasilService; import org.jackhuang.hmcl.game.OAuthServer; import org.jackhuang.hmcl.game.TexturesLoader; @@ -312,7 +311,7 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware { birthLink.setExternalLink("https://support.microsoft.com/account-billing/837badbc-999e-54d2-2617-d19206b9540a"); JFXHyperlink profileLink = new JFXHyperlink(i18n("account.methods.microsoft.profile")); profileLink.setExternalLink("https://account.live.com/editprof.aspx"); - JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.yggdrasil.purchase")); + JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.microsoft.purchase")); purchaseLink.setExternalLink(YggdrasilService.PURCHASE_URL); JFXHyperlink deauthorizeLink = new JFXHyperlink(i18n("account.methods.microsoft.deauthorize")); deauthorizeLink.setExternalLink("https://account.live.com/consent/Edit?client_id=000000004C794E0A"); @@ -344,24 +343,6 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware { } detailsPane = vbox; - } else if (factory == Accounts.FACTORY_MOJANG) { - VBox vbox = new VBox(8); - HintPane hintPane = new HintPane(MessageDialogPane.MessageType.WARNING); - hintPane.setText(i18n("account.methods.yggdrasil.migration.hint")); - - HBox linkPane = new HBox(8); - - JFXHyperlink migrationLink = new JFXHyperlink(i18n("account.methods.yggdrasil.migration")); - migrationLink.setOnAction(e -> FXUtils.openLink(YggdrasilService.PROFILE_URL)); - - JFXHyperlink migrationHowLink = new JFXHyperlink(i18n("account.methods.yggdrasil.migration.how")); - migrationHowLink.setOnAction(e -> FXUtils.openLink(YggdrasilService.MIGRATION_FAQ_URL)); - - linkPane.getChildren().setAll(migrationLink, migrationHowLink); - - vbox.getChildren().setAll(hintPane, linkPane); - detailsPane = vbox; - btnAccept.setDisable(true); } else { detailsPane = new AccountDetailsInputPane(factory, btnAccept::fire); btnAccept.disableProperty().bind(((AccountDetailsInputPane) detailsPane).validProperty().not()); @@ -526,30 +507,11 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware { rowIndex++; } - if (factory instanceof YggdrasilAccountFactory) { - HBox box = new HBox(); - GridPane.setColumnSpan(box, 2); - - JFXHyperlink migrationLink = new JFXHyperlink(i18n("account.methods.yggdrasil.migration")); - migrationLink.setExternalLink("https://aka.ms/MinecraftMigration"); - - JFXHyperlink migrationHowLink = new JFXHyperlink(i18n("account.methods.yggdrasil.migration.how")); - migrationHowLink.setExternalLink("https://help.minecraft.net/hc/articles/4411173197709"); - - JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.yggdrasil.purchase")); - purchaseLink.setExternalLink(YggdrasilService.PURCHASE_URL); - - box.getChildren().setAll(migrationLink, migrationHowLink, purchaseLink); - add(box, 0, rowIndex); - - rowIndex++; - } - if (factory instanceof OfflineAccountFactory) { txtUsername.setPromptText(i18n("account.methods.offline.name.special_characters")); runInFX(() -> FXUtils.installFastTooltip(txtUsername, i18n("account.methods.offline.name.special_characters"))); - JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.yggdrasil.purchase")); + JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.microsoft.purchase")); purchaseLink.setExternalLink(YggdrasilService.PURCHASE_URL); HBox linkPane = new HBox(purchaseLink); GridPane.setColumnSpan(linkPane, 2); @@ -620,9 +582,7 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware { } private boolean requiresEmailAsUsername() { - if (factory instanceof YggdrasilAccountFactory) { - return true; - } else if ((factory instanceof AuthlibInjectorAccountFactory) && this.server != null) { + if ((factory instanceof AuthlibInjectorAccountFactory) && this.server != null) { return !server.isNonEmailLogin(); } return false; diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/OAuthAccountLoginDialog.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/OAuthAccountLoginDialog.java index 9cafddc86..1272a3654 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/OAuthAccountLoginDialog.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/OAuthAccountLoginDialog.java @@ -70,7 +70,7 @@ public class OAuthAccountLoginDialog extends DialogPane { birthLink.setOnAction(e -> FXUtils.openLink("https://support.microsoft.com/account-billing/how-to-change-a-birth-date-on-a-microsoft-account-837badbc-999e-54d2-2617-d19206b9540a")); JFXHyperlink profileLink = new JFXHyperlink(i18n("account.methods.microsoft.profile")); profileLink.setOnAction(e -> FXUtils.openLink("https://account.live.com/editprof.aspx")); - JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.yggdrasil.purchase")); + JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.microsoft.purchase")); purchaseLink.setOnAction(e -> FXUtils.openLink(YggdrasilService.PURCHASE_URL)); box.getChildren().setAll(profileLink, birthLink, purchaseLink); GridPane.setColumnSpan(box, 2); diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index 32b0673dd..b305c2181 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -53,7 +53,6 @@ account.character=character account.choose=Choose a Character account.create=Add an account account.create.microsoft=Add a Microsoft account -account.create.yggdrasil=Add a Mojang account account.create.offline=Add an offline account account.create.authlibInjector=Create an authlib-injector account account.email=Email @@ -117,6 +116,7 @@ If the token used to log in to the Microsoft account is leaked, you can click on If you encounter any problems, you can click the help button in the upper right corner for help. account.methods.microsoft.makegameidsettings=Create Profile / Edit Profile Name account.methods.microsoft.profile=Account Profile +account.methods.microsoft.purchase=Buy Minecraft account.methods.microsoft.snapshot=You are using an unofficial build of HMCL. Please download the official build for login. account.methods.microsoft.snapshot.website=Official Website account.methods.offline=Offline @@ -130,14 +130,7 @@ account.methods.offline.uuid.hint=UUID is the unique identifier for the game cha \n\ This option is for advanced users only. We do not recommend modifying this option unless you know what you are doing. account.methods.offline.uuid.malformed=Invalid Format -account.methods.yggdrasil=Mojang account.methods.forgot_password=Forgot Password -account.methods.yggdrasil.migration=Migrate to Microsoft Account -account.methods.yggdrasil.migration.how=How to migrate to Microsoft Account? -account.methods.yggdrasil.migration.hint=Since March 10, 2022, Mojang accounts are no longer supported, and you are required to migrate to a Microsoft account in order to play Minecraft.\n\ -\n\ -The link down below will guide you to migrate your Mojang account to a Microsoft account. -account.methods.yggdrasil.purchase=Buy Minecraft account.missing=No Accounts account.missing.add=Click here to add one. account.move_to_global=Convert to global account diff --git a/HMCL/src/main/resources/assets/lang/I18N_es.properties b/HMCL/src/main/resources/assets/lang/I18N_es.properties index 56729f86d..1739c4dd4 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_es.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_es.properties @@ -53,7 +53,6 @@ account.character=personaje account.choose=Elige un personaje account.create=Añadir una cuenta account.create.microsoft=Añadir una cuenta Microsoft -account.create.yggdrasil=Añadir una cuenta de Mojang account.create.offline=Añadir una cuenta offline account.create.authlibInjector=Crear una cuenta authlib-injector account.email=Correo electrónico @@ -109,6 +108,7 @@ account.methods.microsoft.manual=El código de su dispositivo es %1$s, po Si el token utilizado para acceder a la cuenta de Microsoft se ha filtrado, puedes hacer clic en "Desautorizar la cuenta" para desautorizarla.\n\ Si encuentra algún problema, puede hacer clic en el botón de ayuda en la esquina superior derecha para obtener ayuda. account.methods.microsoft.profile=Perfil de la cuenta +account.methods.microsoft.purchase=Comprar Minecraft account.methods.microsoft.snapshot=Estás usando una construcción no oficial de hmcls, por favor descargue la construcción oficial para iniciar sesión en microsoft. account.methods.offline=Sin conexión account.methods.offline.uuid=UUID @@ -117,14 +117,7 @@ account.methods.offline.uuid.hint=UUID es el identificador único del personaje Esta opción es sólo para usuarios avanzados. No recomendamos modificar esta opción a menos que sepas lo que estás haciendo.\n\ Esta opción no es necesaria para unirse a servidores. account.methods.offline.uuid.malformed=Formato no válido -account.methods.yggdrasil=Mojang account.methods.forgot_password=OLVIDÉ MI CONTRASEÑA -account.methods.yggdrasil.migration=Migrar a cuenta Microsoft -account.methods.yggdrasil.migration.how=¿Cómo migrar a la Cuenta Microsoft? -account.methods.yggdrasil.migration.hint=Desde el 10 de marzo de 2022, las cuentas de Mojang ya no son compatibles, y es necesario migrar a una cuenta de Microsoft para poder jugar a Minecraft.\n -\n\ -El enlace de abajo te guiará para migrar tu cuenta de Mojang a una cuenta de Microsoft. -account.methods.yggdrasil.purchase=Comprar Minecraft account.missing=No hay cuentas account.missing.add=Haz clic aquí para añadir una. account.not_logged_in=No ha iniciado sesión diff --git a/HMCL/src/main/resources/assets/lang/I18N_ja.properties b/HMCL/src/main/resources/assets/lang/I18N_ja.properties index 1ecc098a8..9455889fc 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ja.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ja.properties @@ -51,7 +51,6 @@ account.character=キャラクター account.choose=キャラクターを選択する account.create=アカウントを追加 account.create.microsoft=Microsoft Login -account.create.yggdrasil=Mojang Login account.create.offline=Offline account.create.authlibInjector=サードパーティーアカウントを追加 account.email=メールアドレス @@ -100,15 +99,12 @@ account.methods.microsoft.makegameidsettings=プロファイルを作成/プロ account.methods.microsoft.hint=「ログイン」ボタンをクリックして、新しく開いたブラウザウィンドウでログインプロセスを続行する必要があります。\nMicrosoftアカウントへのログインに使用されたトークンが誤って漏洩した場合は、下の[アカウントのバインドを解除]をクリックして、ログイン認証をキャンセルできます。\n問題が発生した場合は、右上隅にあるヘルプ ボタンをクリックするとヘルプが表示されます。 account.methods.microsoft.manual=「ログイン」ボタンをクリックした後、新しく開いたブラウザウィンドウで認証を完了する必要があります。ブラウザウィンドウが表示されない場合は、ここをクリックしてURLをコピーし、ブラウザで手動で開くことができます。\nMicrosoftアカウントへのログインに使用されたトークンが誤って漏洩した場合は、下の[アカウントのバインドを解除]をクリックして、ログイン認証をキャンセルできます。\n問題が発生した場合は、右上隅にあるヘルプ ボタンをクリックするとヘルプが表示されます。 account.methods.microsoft.profile=アカウントプロファイル.. +account.methods.microsoft.purchase=Minecraftを購入する account.methods.microsoft.snapshot=非公式構築 HMCL を使用しているので、公式構築をダウンロードしてマイクロソフトにログインしてください。 account.methods.offline=オフライン account.methods.offline.uuid=UUID account.methods.offline.uuid.hint=UUIDは、Minecraftのゲームキャラクターの一意の識別子です。UUIDの生成方法は、ゲームランチャーによって異なります。UUIDを他のランチャーによって生成されたものに変更すると、オフラインアカウントのバックパック内のゲームブロック/アイテムが残ることが約束されます。このオプションは専門家向けです。何をしているのかわからない限り、このオプションを変更することはお勧めしません。\nこのオプションはサーバーに参加する場合には必要ありません。 account.methods.offline.uuid.malformed=Malformed -account.methods.yggdrasil=Mojang -account.methods.yggdrasil.migration=Microsoftアカウントに移行する -account.methods.yggdrasil.migration.how=Microsoftアカウントに移行する方法は? -account.methods.yggdrasil.purchase=Minecraftを購入する account.missing=アカウントなし account.missing.add=追加するにはここをクリック account.not_logged_in=ログインしていません diff --git a/HMCL/src/main/resources/assets/lang/I18N_ru.properties b/HMCL/src/main/resources/assets/lang/I18N_ru.properties index d8dbd1f3f..de86e9410 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ru.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ru.properties @@ -53,7 +53,6 @@ account.character=Персонаж account.choose=Выберите персонажа account.create=Добавить аккаунт account.create.microsoft=Добавить аккаунт Microsoft -account.create.yggdrasil=Добавить аккаунт Mojang account.create.offline=Добавить автономный аккаунт account.create.authlibInjector=Создайте аккаунт authlib-injector account.email=Почта @@ -106,21 +105,14 @@ account.methods.microsoft.logging_in=Авторизация... account.methods.microsoft.makegameidsettings=Создать архив / изменение имени профиля account.methods.microsoft.hint=Вам необходимо нажать кнопку «Войти» и продолжить процесс авторизации во вновь открывшемся окне браузера.\nЕсли токен, используемый для входа в аккаунт Microsoft случайно утёк, вы можете нажать «Отменить авторизацию аккаунта» ниже, чтобы отменить авторизацию.\nЕсли у вас возникнут какие-либо проблемы, вы можете нажать кнопку справки в правом верхнем углу для получения помощи. account.methods.microsoft.manual=После нажатия кнопки «Войти», вы должны завершить авторизацию во вновь открывшемся окне браузера. Если окно браузера не открылось, вы можете щёлкнуть здесь, чтобы скопировать ссылку и вручную открыть её в браузере.\nЕсли токен, используемый для входа в аккаунт Microsoft случайно утёк, вы можете нажать «Отменить авторизацию аккаунта» ниже, чтобы отменить авторизацию.\n問題が発生した場合は、右上隅にあるヘルプ ボタンをクリックするとヘルプが表示されます。 -account.methods.microsoft.profile=Профиль аккаунта... +account.methods.microsoft.profile=Профиль аккаунта... +account.methods.microsoft.purchase=Купить Minecraft account.methods.forgot_password=ЗАБЫЛ ПАРОЛЬ account.methods.microsoft.snapshot=Вы используете неофициальное построение HMCL, загрузите официальное построение для входа в Microsoft. account.methods.offline=Офлайн account.methods.offline.uuid=UUID account.methods.offline.uuid.hint=UUID - это уникальный идентификатор игрового персонажа в Minecraft. Способ генерации UUID различается в разных лаунчерах игр. Изменение UUID на тот, который генерируется другим лаунчером гарантирует, что игровые блоки/предметы в рюкзаке вашего офлайн аккаунта останутся. Этот параметр предназначен для экспертов. Если вы не знаете что делаете, мы не советуем вам изменять этот параметр.\nЭта опция не требуется для присоединения к серверам. account.methods.offline.uuid.malformed=Malformed -account.methods.yggdrasil=Mojang -account.methods.forgot_password=Забыли пароль -account.methods.yggdrasil.migration=Перейти на аккаунт Microsoft -account.methods.yggdrasil.migration.how=Как перейти на аккаунт Microsoft? -account.methods.yggdrasil.migration.hint=С 10 марта 2022 года аккаунты Mojang больше не поддерживаются, и для игры в Minecraft необходимо перейти на аккаунт Microsoft.\n\ -\n\ -Ссылка ниже поможет перенести ваш аккаунт Mojang на Microsoft. -account.methods.yggdrasil.purchase=Купить Minecraft account.missing=Нет аккаунтов account.missing.add=Нажмите здесь, чтобы добавить. account.not_logged_in=Вход не произведён diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index 0c8285165..e529c3e53 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -51,7 +51,6 @@ account.character=角色 account.choose=請選擇角色 account.create=建立帳戶 account.create.microsoft=添加微軟帳戶 -account.create.yggdrasil=添加 Mojang 帳戶 account.create.offline=添加離線模式帳戶 account.create.authlibInjector=添加外置登入帳戶 (authlib-injector) account.email=電子信箱 @@ -115,7 +114,7 @@ account.methods.microsoft.hint=你需要按照以下步驟添加賬戶:\n\ 5.在網站提示“大功告成”後,只需等待帳戶完成添加即可\n\ 若網站提示“出现错误”的標識,請嘗試重新按照以上步驟登入\n\ -若賬戶添加失敗,請嘗試重新按照以上步驟登入\n\ - -若登入微軟賬號的 Token 洩露,可點擊下方“解除帳戶授權”解除登入授權,然後等待 Token 過期 + -若登入微軟賬號的 Token 洩露,可點擊下方“解除帳戶授權”解除登入授權,然後等待 Token 過期\n\ 如遇到問題,你可以點擊右上角幫助按鈕進行求助。 account.methods.microsoft.manual=你需要按照以下步驟添加账户:\n\ 1.點擊“登入”按鈕\n\ @@ -125,9 +124,10 @@ account.methods.microsoft.manual=你需要按照以下步驟添加账户:\n\ 5.在網站提示“大功告成”後,只需等待帳戶完成添加即可\n\ -若網站提示“出现错误”的標識或賬戶添加失敗時,請嘗試重新按照以上步驟登入\n\ -若網站未能打開,請手動在網頁瀏覽器中打開:%2$s\n\ - -若登入微軟賬號的 Token 洩露,可點擊下方“解除帳戶授權”解除登入授權,然後等待 Token 過期 + -若登入微軟賬號的 Token 洩露,可點擊下方“解除帳戶授權”解除登入授權,然後等待 Token 過期\n\ 如遇到問題,你可以點擊右上角幫助按鈕進行求助。 account.methods.microsoft.profile=帳戶設置頁 +account.methods.microsoft.purchase=購買 Minecraft account.methods.forgot_password=忘記密碼 account.methods.microsoft.snapshot=你正在使用非官方構建的 HMCL,請下載官方構建進行微軟登入。 account.methods.microsoft.snapshot.website=官方網站 @@ -140,11 +140,6 @@ account.methods.offline.name.invalid=正常情況下,遊戲用戶名只能包 account.methods.offline.uuid=UUID account.methods.offline.uuid.hint=UUID 是 Minecraft 對玩家角色的唯一標識符,每個啟動器生成 UUID 的方式可能不同。通過修改 UUID 選項至原啟動器所生成的 UUID,你可以保證在切換啟動器後,遊戲還能將你的遊戲角色識別為給定 UUID 所對應的角色,從而保留原來角色的背包物品。UUID 選項為高級選項,除非你知道你在做什麼,否則你不需要調整該選項。 account.methods.offline.uuid.malformed=格式錯誤 -account.methods.yggdrasil=Mojang 登入 -account.methods.yggdrasil.migration=遷移至微軟帳戶 -account.methods.yggdrasil.migration.how=如何遷移至微軟帳戶? -account.methods.yggdrasil.migration.hint=自 2022 年 3 月 10 日起,Mojang 帳戶不再受支持,您必須遷移至微軟帳戶才能登入 Minecraft。\n下方連結將指引您將 Mojang 帳戶遷移至微軟帳戶。 -account.methods.yggdrasil.purchase=購買 Minecraft account.missing=沒有遊戲帳戶 account.missing.add=按一下此處加入帳戶 account.move_to_global=轉換為全域帳戶 diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index 8b9001e27..9f69bb879 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -51,7 +51,6 @@ account.character=角色 account.choose=选择一个角色 account.create=添加账户 account.create.microsoft=添加微软账户 -account.create.yggdrasil=添加 Mojang 账户 account.create.offline=添加离线模式账户 account.create.authlibInjector=添加外置登录账户 (authlib-injector) account.email=邮箱 @@ -128,6 +127,7 @@ account.methods.microsoft.manual=你需要按照以下步骤添加:\n\ -若设备网络环境不佳,可能登录网站加载很慢甚至无法加载,此时请使用网络代理并重试\n\ 如遇到问题,你可以点击右上角帮助按钮进行求助。 account.methods.microsoft.profile=账户设置页 +account.methods.microsoft.purchase=购买 Minecraft account.methods.forgot_password=忘记密码 account.methods.microsoft.snapshot=你正在使用非官方构建的 HMCL,请下载官方构建进行微软登录。 account.methods.microsoft.snapshot.website=官方网站 @@ -141,11 +141,6 @@ account.methods.offline.name.invalid=正常情况下,游戏用户名只能包 account.methods.offline.uuid=UUID account.methods.offline.uuid.hint=UUID 是 Minecraft 对玩家角色的唯一标识符,每个启动器生成 UUID 的方式可能不同。通过修改 UUID 选项至原启动器所生成的 UUID,你可以保证在切换启动器后,游戏还能将你的游戏角色识别为给定 UUID 所对应的角色,从而保留原来角色的背包物品。UUID 选项为高级选项,除非你知道你在做什么,否则你不需要调整该选项。 account.methods.offline.uuid.malformed=格式错误 -account.methods.yggdrasil=Mojang 账户 -account.methods.yggdrasil.migration=迁移至微软账户 -account.methods.yggdrasil.migration.how=如何迁移至微软账户? -account.methods.yggdrasil.migration.hint=自 2022 年 3 月 10 日起,Mojang 账户不再受支持,您必须迁移至微软账户才能登录 Minecraft。\n下方链接将指引您将Mojang账户迁移至微软账户。 -account.methods.yggdrasil.purchase=购买 Minecraft account.missing=没有游戏账户 account.missing.add=点击此处添加账户 account.move_to_global=转换为全局账户\n该账户的信息会保存至用户目录的配置文件中 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/MojangYggdrasilProvider.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/MojangYggdrasilProvider.java deleted file mode 100644 index ea6237ad3..000000000 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/MojangYggdrasilProvider.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Hello Minecraft! Launcher - * Copyright (C) 2020 huangyuhui and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.jackhuang.hmcl.auth.yggdrasil; - -import org.jackhuang.hmcl.util.gson.UUIDTypeAdapter; -import org.jackhuang.hmcl.util.io.NetworkUtils; - -import java.net.URL; -import java.util.*; - -public class MojangYggdrasilProvider implements YggdrasilProvider { - - @Override - public URL getAuthenticationURL() { - return NetworkUtils.toURL("https://authserver.mojang.com/authenticate"); - } - - @Override - public URL getRefreshmentURL() { - return NetworkUtils.toURL("https://authserver.mojang.com/refresh"); - } - - @Override - public URL getValidationURL() { - return NetworkUtils.toURL("https://authserver.mojang.com/validate"); - } - - @Override - public URL getInvalidationURL() { - return NetworkUtils.toURL("https://authserver.mojang.com/invalidate"); - } - - @Override - public URL getSkinUploadURL(UUID uuid) throws UnsupportedOperationException { - return NetworkUtils.toURL("https://api.mojang.com/user/profile/" + UUIDTypeAdapter.fromUUID(uuid) + "/skin"); - } - - @Override - public URL getProfilePropertiesURL(UUID uuid) { - return NetworkUtils.toURL("https://sessionserver.mojang.com/session/minecraft/profile/" + UUIDTypeAdapter.fromUUID(uuid)); - } - - @Override - public String toString() { - return "mojang"; - } -} diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java index 1482f96b9..1e0953c67 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java @@ -29,7 +29,7 @@ import java.util.logging.Level; import static java.util.Objects.requireNonNull; import static org.jackhuang.hmcl.util.Logging.LOG; -public class YggdrasilAccount extends ClassicAccount { +public abstract class YggdrasilAccount extends ClassicAccount { protected final YggdrasilService service; protected final UUID characterUUID; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccountFactory.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccountFactory.java deleted file mode 100644 index 0d5955be2..000000000 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccountFactory.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Hello Minecraft! Launcher - * Copyright (C) 2020 huangyuhui and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.jackhuang.hmcl.auth.yggdrasil; - -import org.jackhuang.hmcl.auth.AccountFactory; -import org.jackhuang.hmcl.auth.AuthenticationException; -import org.jackhuang.hmcl.auth.CharacterSelector; -import org.jackhuang.hmcl.util.javafx.ObservableOptionalCache; - -import java.util.Map; -import java.util.Objects; -import java.util.UUID; - -import static org.jackhuang.hmcl.util.Lang.tryCast; - -/** - * - * @author huangyuhui - */ -public class YggdrasilAccountFactory extends AccountFactory { - - public static final YggdrasilAccountFactory MOJANG = new YggdrasilAccountFactory(YggdrasilService.MOJANG); - - private final YggdrasilService service; - - public YggdrasilAccountFactory(YggdrasilService service) { - this.service = service; - } - - @Override - public AccountLoginType getLoginType() { - return AccountLoginType.USERNAME_PASSWORD; - } - - @Override - public YggdrasilAccount create(CharacterSelector selector, String username, String password, ProgressCallback progressCallback, Object additionalData) throws AuthenticationException { - Objects.requireNonNull(selector); - Objects.requireNonNull(username); - Objects.requireNonNull(password); - - return new YggdrasilAccount(service, username, password, selector); - } - - @Override - public YggdrasilAccount fromStorage(Map storage) { - Objects.requireNonNull(storage); - - YggdrasilSession session = YggdrasilSession.fromStorage(storage); - - String username = tryCast(storage.get("username"), String.class) - .orElseThrow(() -> new IllegalArgumentException("storage does not have username")); - - tryCast(storage.get("profileProperties"), Map.class).ifPresent( - it -> { - @SuppressWarnings("unchecked") - Map properties = it; - GameProfile selected = session.getSelectedProfile(); - ObservableOptionalCache profileRepository = service.getProfileRepository(); - profileRepository.put(selected.getId(), new CompleteGameProfile(selected, properties)); - profileRepository.invalidate(selected.getId()); - }); - - return new YggdrasilAccount(service, username, session); - } -} diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilService.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilService.java index 87a20547e..c6fa3098d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilService.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilService.java @@ -53,8 +53,6 @@ public class YggdrasilService { private static final ThreadPoolExecutor POOL = threadPool("YggdrasilProfileProperties", true, 2, 10, TimeUnit.SECONDS); - public static final YggdrasilService MOJANG = new YggdrasilService(new MojangYggdrasilProvider()); - private final YggdrasilProvider provider; private final ObservableOptionalCache profileRepository; @@ -272,7 +270,5 @@ public class YggdrasilService { .registerTypeAdapterFactory(ValidationTypeAdapterFactory.INSTANCE) .create(); - public static final String PROFILE_URL = "https://aka.ms/MinecraftMigration"; - public static final String MIGRATION_FAQ_URL = "https://help.minecraft.net/articles/360050865492"; public static final String PURCHASE_URL = "https://www.microsoft.com/store/productId/9NXP44L49SHJ"; }