Compare commits

..
28 Commits
Author SHA1 Message Date
Glavo 9901bf738d fix crash (#1825) 2022-11-05 22:12:44 +08:00
huanghongxun a3d8c6b3b3 feat(skin): introduce new official skins. 2022-11-05 20:22:02 +08:00
huanghongxun 948928f740 feat: update HMCLauncher.exe 2022-11-05 20:11:22 +08:00
Rei Hatada 71e98c035e change (#1824) 2022-11-05 19:51:39 +08:00
Glavo af107b15c0 完善 HiPer 支持 (#1821)
* Display hiper token expiration time

* Automatically download missing files when starting HiPer

* Disable start HiPer when token is empty
2022-11-05 19:36:17 +08:00
Glavo 8687bb9487 修复 MessageDialogPane 总是折叠内容的问题 (#1815)
* fix #1751: Use ScrollPane in message dialog only when needed
close #1777

* Parse segment only if it contains xml tag
2022-11-05 19:28:24 +08:00
huanghongxun a70e53364d fix(multiplayer): force using authlib-injector in multiplayer mode. 2022-10-30 13:45:34 +08:00
zkitefly 11a1c37765 将日志更换至docs.hmcl.net (#1812)
* 将日志更换至docs.hmcl.net,以便更新日志

* 修改链接

* 更换目录
2022-10-30 01:29:51 +08:00
Glavo 68a8944810 改进 HiPer 支持 (#1763)
* Disable start hiper button when token is empty

* Use gsudo start hiper

* Automatically request administrator privileges on Windows and Linux

* Automatically start hiper with sudo on mac

* Update I18N

* Prompt user to chown unwritable files

* Update HiPer file verification failed prompt

* Log other hiper exceptions

* temporarily disable gsudo

* Detect admin rights with 'net session'

* Hide the hint pane when running with administrator privileges

* Prompt user when starting HMCL with sudo

* Fix ClassNotFoundException when no JavaFX

* Update the prompt when the permission cannot be obtained

* Add support for saving multiple HiPer configurations

* update link
close Glavo/HMCL#3

* Detect RISC-V 32

* Save original hiper authorization information

* Add support for importing and exporting license files

* Set initial license file name

* Complement the missing message

* Handling gsudo failure to obtain permission
2022-10-25 21:55:12 +08:00
zkitefly b280b238df 尝试完成 #1780 (#1789) 2022-10-25 21:52:23 +08:00
huanghongxun 0f39aad429 fix(auth): legacy user type for OfflineAccount. 2022-10-25 21:48:55 +08:00
Glavo ff78297ee5 fix IntegrityCheck::performCheck (#1792) 2022-10-23 23:28:22 +08:00
Glavo f75bbdcecc Log HMCL jar path (#1794) 2022-10-23 23:27:42 +08:00
Glavo 694e31a7fe Cache manifest in JarUtils (#1797) 2022-10-23 23:27:21 +08:00
Glavo c113670cda Migrate HMCL_DIRECTORY to the user directory (#1785) 2022-10-09 13:21:02 +08:00
zkitefly 1b3c399335 添加“测试能否联机”按钮 (#1757)
* add

* 修改图标(其实我不知道该弄啥图标好……)

* fix
2022-10-09 11:18:00 +08:00
huanghongxun 45cbe20449 fix: crash when there is an incorrect authlib-injector server url. Closes #1774. 2022-10-08 17:39:04 +08:00
zkiteflyandYuhui Huang 4d606510f6 修改 登录失败 弹窗 (#1782)
* 修改 登录失败 弹窗

* fix

* Update I18N.properties

* Update I18N_zh_CN.properties

* Update I18N_zh.properties

* Update I18N_zh.properties

* Update I18N_zh_CN.properties

* Edit

Co-authored-by: Yuhui Huang <[email protected]>
2022-10-08 17:33:07 +08:00
huanghongxun a6639552cf fix: lblCreationWarning not wrapping text. Closes #1783. 2022-10-08 17:31:28 +08:00
zkitefly 2a088ec555 更新多人联机页面 (#1758)
* 更新 multiplayer.error.file_not_found 翻译

* 修改翻译

* 移除标题

* add

* try fix

* try fix

* try fix

* try fix

* try fix

* try

* try

* try

* fix

* fix

* add

* fix

* fix

* add

* fix

* edit
2022-10-08 17:13:55 +08:00
zkitefly 1c46d63367 try (#1768) 2022-10-08 17:12:13 +08:00
zkitefly f2b7fae694 添加“忘记密码”按钮 (#1765) 2022-10-08 17:11:56 +08:00
Glavo 43986676d8 修复中文路径下启动 <= 1.12.2 的版本没有声音的问题 (#1754)
* Use native encoding by default

* Fix the problem that LWJGL fails to load OpenAL under Java 18
2022-10-08 17:10:27 +08:00
Glavo 2649e79d47 fix build fails with Java 19 (#1784) 2022-10-08 17:09:12 +08:00
zkitefly f83d3cd769 Fix https://github.com/huanghongxun/HMCL/issues/1703 (#1753) 2022-09-28 19:14:15 +08:00
zkitefly f124910f94 修改多人联机帮助与提示 (#1733)
* 修改多人联机提示

* text

* 撤回修改

* 1

* 修改帮助

* fix

* try

* Delete try

* Update I18N.properties

* Update I18N_zh.properties

* Update I18N_zh_CN.properties

* Update I18N_zh_CN.properties

* Update I18N_zh.properties

* Update I18N_zh.properties

* Update I18N_zh_CN.properties

* 修改提示框样式

* 修改提示框样式

* fix

* 修改样式

* 修改样式

* 修改提示框样式

* 修改翻译

* 修改翻译

* add

* return

* add

* add

* 去掉图标

* 试图让左边图标为空

* Update MultiplayerPageSkin.java

* ruturn

* add

* add

* Update MultiplayerPageSkin.java

* Update I18N_zh.properties

* Update I18N_zh_CN.properties
2022-09-25 14:25:05 +08:00
zkitefly c1712c3e1e 修改翻译 (#1742) 2022-09-25 14:23:39 +08:00
huanghongxun d817c80629 fix: checkstyle. 2022-09-25 00:31:51 +08:00
58 changed files with 1002 additions and 305 deletions

No files matched your search

+1 -1
View File
@@ -48,7 +48,7 @@ jobs:
run: |
echo "HMCL v$HMCL_VERSION" >> RELEASE_NOTE
echo "" >> RELEASE_NOTE
echo "The full changelogs can be found on the website: https://hmcl.huangyuhui.net/changelog/dev.html" >> RELEASE_NOTE
echo "The full changelogs can be found on the website: https://docs.hmcl.net/changelog/dev.html" >> RELEASE_NOTE
echo "Notice: changelogs are written in Chinese." >> RELEASE_NOTE
- name: Create release
if: ${{ env.continue == 'true' }}
+3
View File
@@ -47,6 +47,8 @@ val microsoftAuthId = System.getenv("MICROSOFT_AUTH_ID") ?: ""
val microsoftAuthSecret = System.getenv("MICROSOFT_AUTH_SECRET") ?: ""
val curseForgeApiKey = System.getenv("CURSEFORGE_API_KEY") ?: ""
val enableHiPer = System.getenv("ENABLE_HIPER") ?: "false"
version = "$versionRoot.$buildNumber"
dependencies {
@@ -149,6 +151,7 @@ tasks.getByName<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("sha
"Microsoft-Auth-Secret" to microsoftAuthSecret,
"CurseForge-Api-Key" to curseForgeApiKey,
"Build-Channel" to versionType,
"Enable-HiPer" to enableHiPer,
"Class-Path" to "pack200.jar",
"Add-Opens" to listOf(
"java.base/java.lang",
@@ -19,11 +19,15 @@ package org.jackhuang.hmcl;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.input.Clipboard;
import javafx.scene.input.DataFormat;
import javafx.stage.Stage;
import org.jackhuang.hmcl.setting.ConfigHolder;
import org.jackhuang.hmcl.setting.SambaException;
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.task.AsyncTaskExecutor;
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.ui.AwtUtils;
import org.jackhuang.hmcl.ui.Controllers;
import org.jackhuang.hmcl.upgrade.UpdateChecker;
@@ -31,14 +35,21 @@ import org.jackhuang.hmcl.upgrade.UpdateHandler;
import org.jackhuang.hmcl.util.CrashReporter;
import org.jackhuang.hmcl.util.Lang;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.io.JarUtils;
import org.jackhuang.hmcl.util.platform.Architecture;
import org.jackhuang.hmcl.util.platform.CommandBuilder;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
import java.awt.*;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.net.*;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
@@ -62,7 +73,51 @@ public final class Launcher extends Application {
Main.showWarningAndContinue(i18n("fatal.samba"));
} catch (IOException e) {
LOG.log(Level.SEVERE, "Failed to load config", e);
Main.showErrorAndExit(i18n("fatal.config_loading_failure", Paths.get("").toAbsolutePath().normalize()));
try {
if (OperatingSystem.CURRENT_OS != OperatingSystem.WINDOWS) {
String owner = Files.getOwner(ConfigHolder.configLocation()).getName();
String userName = System.getProperty("user.name");
if (!Files.isWritable(ConfigHolder.configLocation())
&& !userName.equals("root")
&& !userName.equals(owner)) {
ArrayList<String> files = new ArrayList<>();
{
files.add(ConfigHolder.configLocation().toString());
if (Files.exists(Metadata.HMCL_DIRECTORY))
files.add(Metadata.HMCL_DIRECTORY.toString());
Path mcDir = Paths.get(".minecraft").toAbsolutePath().normalize();
if (Files.exists(mcDir))
files.add(mcDir.toString());
}
String command = new CommandBuilder().add("sudo", "chown", "-R", userName).addAll(files).toString();
ButtonType copyAndExit = new ButtonType(i18n("button.copy_and_exit"));
ButtonType res = new Alert(Alert.AlertType.ERROR, i18n("fatal.config_loading_failure.unix", owner, command), copyAndExit, ButtonType.CLOSE)
.showAndWait()
.orElse(null);
if (res == copyAndExit) {
Clipboard.getSystemClipboard()
.setContent(Collections.singletonMap(DataFormat.PLAIN_TEXT, command));
}
System.exit(1);
}
}
} catch (IOException ioe) {
LOG.log(Level.WARNING, "Failed to get file owner", ioe);
}
Main.showErrorAndExit(i18n("fatal.config_loading_failure", Paths.get("").toAbsolutePath().normalize().toString()));
}
if (ConfigHolder.isOwnerChanged()) {
ButtonType res = new Alert(Alert.AlertType.WARNING, i18n("fatal.config_change_owner_root"), ButtonType.YES, ButtonType.NO)
.showAndWait()
.orElse(null);
if (res == ButtonType.NO)
return;
}
if (Metadata.HMCL_DIRECTORY.toAbsolutePath().toString().indexOf('=') >= 0) {
@@ -117,6 +172,7 @@ public final class Launcher extends Application {
LOG.info("Java Home: " + System.getProperty("java.home"));
LOG.info("Current Directory: " + Paths.get("").toAbsolutePath());
LOG.info("HMCL Directory: " + Metadata.HMCL_DIRECTORY);
LOG.info("HMCL Jar Path: " + JarUtils.thisJar().map(it -> it.toAbsolutePath().toString()).orElse("Not Found"));
LOG.info("Memory: " + Runtime.getRuntime().maxMemory() / 1024 / 1024 + "MB");
ManagementFactory.getMemoryPoolMXBeans().stream().filter(bean -> bean.getName().equals("Metaspace")).findAny()
.ifPresent(bean -> LOG.info("Metaspace: " + bean.getUsage().getUsed() / 1024 / 1024 + "MB"));
@@ -17,6 +17,8 @@
*/
package org.jackhuang.hmcl;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import org.jackhuang.hmcl.util.Logging;
import org.jackhuang.hmcl.util.SelfDependencyPatcher;
import org.jackhuang.hmcl.util.platform.Architecture;
@@ -68,7 +70,6 @@ public final class Main {
checkJavaFX();
Launcher.main(args);
}
@@ -116,6 +117,15 @@ public final class Main {
static void showErrorAndExit(String message) {
System.err.println(message);
System.err.println("A fatal error has occurred, forcibly exiting.");
try {
if (Platform.isFxApplicationThread()) {
new Alert(Alert.AlertType.ERROR, message).showAndWait();
System.exit(1);
}
} catch (Throwable ignored) {
}
JOptionPane.showMessageDialog(null, message, "Error", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
@@ -126,6 +136,14 @@ public final class Main {
static void showWarningAndContinue(String message) {
System.err.println(message);
System.err.println("Potential issues have been detected.");
try {
if (Platform.isFxApplicationThread()) {
new Alert(Alert.AlertType.WARNING, message).showAndWait();
return;
}
} catch (Throwable ignored) {
}
JOptionPane.showMessageDialog(null, message, "Warning", JOptionPane.WARNING_MESSAGE);
}
@@ -156,7 +174,8 @@ public final class Main {
tls.init(null, instance.getTrustManagers(), null);
HttpsURLConnection.setDefaultSSLSocketFactory(tls.getSocketFactory());
LOG.info("Added Lets Encrypt root certificates as additional trust");
} catch (KeyStoreException | IOException | NoSuchAlgorithmException | CertificateException | KeyManagementException e) {
} catch (KeyStoreException | IOException | NoSuchAlgorithmException | CertificateException |
KeyManagementException e) {
LOG.log(Level.SEVERE, "Failed to load lets encrypt certificate. Expect problems", e);
}
}
@@ -18,11 +18,9 @@
package org.jackhuang.hmcl;
import org.jackhuang.hmcl.util.io.JarUtils;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* Stores metadata about this application.
@@ -32,7 +30,7 @@ public final class Metadata {
public static final String NAME = "HMCL";
public static final String FULL_NAME = "Hello Minecraft! Launcher";
public static final String VERSION = System.getProperty("hmcl.version.override", JarUtils.thisJar().flatMap(JarUtils::getImplementationVersion).orElse("@develop@"));
public static final String VERSION = System.getProperty("hmcl.version.override", JarUtils.getManifestAttribute("Implementation-Version", "@develop@"));
public static final String TITLE = NAME + " " + VERSION;
public static final String FULL_TITLE = FULL_NAME + " v" + VERSION;
@@ -40,27 +38,14 @@ public final class Metadata {
public static final String UPDATE_URL = System.getProperty("hmcl.update_source.override", "https://hmcl.huangyuhui.net/api/update_link");
public static final String CONTACT_URL = "https://github.com/huanghongxun/HMCL/issues";
public static final String HELP_URL = "https://hmcl.huangyuhui.net/help";
public static final String CHANGELOG_URL = "https://hmcl.huangyuhui.net/changelog/";
public static final String PUBLISH_URL = "http://www.mcbbs.net/thread-142335-1-1.html";
public static final String CHANGELOG_URL = "https://docs.hmcl.net/changelog/";
public static final String PUBLISH_URL = "https://www.mcbbs.net/thread-142335-1-1.html";
public static final String EULA_URL = "https://hmcl.huangyuhui.net/eula";
public static final String BUILD_CHANNEL = JarUtils.thisJar().flatMap(JarUtils::getManifest).map(manifest -> manifest.getMainAttributes().getValue("Build-Channel")).orElse("nightly");
public static final String BUILD_CHANNEL = JarUtils.getManifestAttribute("Build-Channel", "nightly");
public static final Path MINECRAFT_DIRECTORY = OperatingSystem.getWorkingDirectory("minecraft");
public static final Path HMCL_DIRECTORY = getHMCLDirectory();
private static Path getHMCLDirectory() {
String home = System.getProperty("user.home", ".");
if (OperatingSystem.CURRENT_OS == OperatingSystem.LINUX) {
// to fulfill XDG standard.
String xdgCache = System.getenv("XDG_CACHE_HOME");
if (StringUtils.isNotBlank(xdgCache)) {
return Paths.get(xdgCache, "hmcl");
}
return Paths.get(home, ".cache", "hmcl");
}
return OperatingSystem.getWorkingDirectory("hmcl");
}
public static final Path HMCL_DIRECTORY = OperatingSystem.getWorkingDirectory("hmcl");
public static boolean isStable() {
return "stable".equals(BUILD_CHANNEL);
@@ -72,7 +72,7 @@ import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
public final class LauncherHelper {
private final Profile profile;
private final Account account;
private Account account;
private final String selectedVersion;
private File scriptFile;
private final VersionSetting setting;
@@ -91,6 +91,14 @@ public final class LauncherHelper {
private final TaskExecutorDialogPane launchingStepsPane = new TaskExecutorDialogPane(TaskCancellationAction.NORMAL);
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
public void setTestMode() {
launcherVisibility = LauncherVisibility.KEEP;
showLogs = true;
@@ -627,11 +635,11 @@ public final class LauncherHelper {
return Task.completed(DialogController.logIn(account));
} catch (AuthenticationException e) {
LOG.log(Level.WARNING, "Authentication failed, try playing offline", e);
LOG.log(Level.WARNING, "Authentication failed, try skipping refresh", e);
CompletableFuture<Task<AuthInfo>> future = new CompletableFuture<>();
runInFX(() -> {
JFXButton loginOfflineButton = new JFXButton(i18n("account.login.offline"));
JFXButton loginOfflineButton = new JFXButton(i18n("account.login.skip"));
loginOfflineButton.setOnAction(event -> {
try {
future.complete(Task.completed(account.playOffline()));
@@ -639,7 +647,7 @@ public final class LauncherHelper {
future.completeExceptionally(e2);
}
});
JFXButton retryButton = new JFXButton(i18n("button.retry"));
JFXButton retryButton = new JFXButton(i18n("account.login.retry"));
retryButton.setOnAction(event -> {
future.complete(logIn(account));
});
@@ -160,13 +160,13 @@ public final class OAuthServer extends NanoHTTPD implements OAuth.Session {
@Override
public String getClientId() {
return System.getProperty("hmcl.microsoft.auth.id",
JarUtils.thisJar().flatMap(JarUtils::getManifest).map(manifest -> manifest.getMainAttributes().getValue("Microsoft-Auth-Id")).orElse(""));
JarUtils.getManifestAttribute("Microsoft-Auth-Id", ""));
}
@Override
public String getClientSecret() {
return System.getProperty("hmcl.microsoft.auth.secret",
JarUtils.thisJar().flatMap(JarUtils::getManifest).map(manifest -> manifest.getMainAttributes().getValue("Microsoft-Auth-Secret")).orElse(""));
JarUtils.getManifestAttribute("Microsoft-Auth-Secret", ""));
}
@Override
@@ -136,8 +136,8 @@ public final class TexturesLoader {
private final static Map<TextureModel, LoadedTexture> DEFAULT_SKINS = new EnumMap<>(TextureModel.class);
static {
loadDefaultSkin("/assets/img/steve.png", TextureModel.STEVE);
loadDefaultSkin("/assets/img/alex.png", TextureModel.ALEX);
loadDefaultSkin("/assets/img/skin/steve.png", TextureModel.STEVE);
loadDefaultSkin("/assets/img/skin/alex.png", TextureModel.ALEX);
}
private static void loadDefaultSkin(String path, TextureModel model) {
@@ -22,6 +22,7 @@ import com.google.gson.JsonParseException;
import org.jackhuang.hmcl.Metadata;
import org.jackhuang.hmcl.util.InvocationDispatcher;
import org.jackhuang.hmcl.util.Lang;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
@@ -45,6 +46,7 @@ public final class ConfigHolder {
private static Config configInstance;
private static GlobalConfig globalConfigInstance;
private static boolean newlyCreated;
private static boolean ownerChanged = false;
public static Config config() {
if (configInstance == null) {
@@ -60,10 +62,18 @@ public final class ConfigHolder {
return globalConfigInstance;
}
public static Path configLocation() {
return configLocation;
}
public static boolean isNewlyCreated() {
return newlyCreated;
}
public static boolean isOwnerChanged() {
return ownerChanged;
}
public synchronized static void init() throws IOException {
if (configInstance != null) {
throw new IllegalStateException("Configuration is already loaded");
@@ -109,7 +119,7 @@ public final class ConfigHolder {
}
private static Path locateConfig() {
Path exePath = Paths.get("");
Path exePath = Paths.get("").toAbsolutePath();
try {
Path jarPath = Paths.get(ConfigHolder.class.getProtectionDomain().getCodeSource().getLocation()
.toURI()).toAbsolutePath();
@@ -143,6 +153,15 @@ public final class ConfigHolder {
private static Config loadConfig() throws IOException {
if (Files.exists(configLocation)) {
try {
if (OperatingSystem.CURRENT_OS != OperatingSystem.WINDOWS
&& "root".equals(System.getProperty("user.name"))
&& !"root".equals(Files.getOwner(configLocation).getName())) {
ownerChanged = true;
}
} catch (IOException e1) {
LOG.log(Level.WARNING, "Failed to get owner");
}
try {
String content = FileUtils.readText(configLocation);
Config deserialized = Config.fromJson(content);
@@ -189,6 +208,28 @@ public final class ConfigHolder {
// Global Config
private static GlobalConfig loadGlobalConfig() throws IOException {
// Migrate from old directory
if (OperatingSystem.CURRENT_OS == OperatingSystem.LINUX && Files.notExists(GLOBAL_CONFIG_PATH)) {
Path oldHome;
String xdgCache = System.getenv("XDG_CACHE_HOME");
if (StringUtils.isNotBlank(xdgCache)) {
oldHome = Paths.get(xdgCache, "hmcl");
} else {
oldHome = Paths.get(System.getProperty("user.home", "."), ".cache", "hmcl");
}
if (Files.exists(oldHome)) {
Path oldConfigPath = oldHome.resolve("config.json");
if (Files.isRegularFile(oldConfigPath)) {
try {
Files.copy(oldConfigPath, GLOBAL_CONFIG_PATH);
} catch (IOException e) {
LOG.log(Level.WARNING, "Failed to migrate global config", e);
}
}
}
}
if (Files.exists(GLOBAL_CONFIG_PATH)) {
try {
String content = FileUtils.readText(GLOBAL_CONFIG_PATH);
@@ -710,6 +710,9 @@ public final class FXUtils {
}
public static List<Node> parseSegment(String segment, Consumer<String> hyperlinkAction) {
if (segment.indexOf('<') < 0)
return Collections.singletonList(new Text(segment));
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
@@ -45,8 +45,10 @@ import org.jackhuang.hmcl.util.javafx.BindingMapping;
import org.jackhuang.hmcl.util.javafx.MappedObservableList;
import java.net.URI;
import java.util.logging.Level;
import static org.jackhuang.hmcl.ui.versions.VersionPage.wrap;
import static org.jackhuang.hmcl.util.Logging.LOG;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
import static org.jackhuang.hmcl.util.javafx.ExtendedProperties.createSelectedItemPropertyFor;
@@ -148,7 +150,13 @@ public class AccountListPage extends DecoratorAnimatedPage implements DecoratorP
ObservableValue<String> title = BindingMapping.of(server, AuthlibInjectorServer::getName);
item.titleProperty().bind(title);
item.subtitleProperty().set(URI.create(server.getUrl()).getHost());
String host = "";
try {
host = URI.create(server.getUrl()).getHost();
} catch (IllegalArgumentException e) {
LOG.log(Level.WARNING, "Unparsable authlib-injector server url " + server.getUrl(), e);
}
item.subtitleProperty().set(host);
Tooltip tooltip = new Tooltip();
tooltip.textProperty().bind(Bindings.format("%s (%s)", title, server.getUrl()));
FXUtils.installFastTooltip(item, tooltip);
@@ -22,6 +22,7 @@ import com.jfoenix.controls.JFXDialogLayout;
import com.jfoenix.controls.JFXTextField;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.StackPane;
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorServer;
import org.jackhuang.hmcl.task.Schedulers;
@@ -67,6 +68,7 @@ public class AddAuthlibInjectorServerPane extends StackPane implements DialogAwa
loadFXML(this, "/assets/fxml/authlib-injector-server-add.fxml");
root.setContent(addServerPane, ContainerAnimations.NONE.getAnimationProducer());
lblCreationWarning.maxWidthProperty().bind(((FlowPane) lblCreationWarning.getParent()).widthProperty());
btnAddNext.disableProperty().bind(txtServerUrl.textProperty().isEmpty());
nextPane.hideSpinner();
@@ -295,6 +295,8 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.yggdrasil.purchase"));
JFXHyperlink deauthorizeLink = new JFXHyperlink(i18n("account.methods.microsoft.deauthorize"));
deauthorizeLink.setOnAction(e -> FXUtils.openLink("https://account.live.com/consent/Edit?client_id=000000004C794E0A"));
JFXHyperlink forgotpasswordLink = new JFXHyperlink(i18n("account.methods.forgot_password"));
forgotpasswordLink.setOnAction(e -> FXUtils.openLink("https://www.minecraft.net/password/forgot"));
JFXHyperlink createProfileLink = new JFXHyperlink(i18n("account.methods.microsoft.makegameidsettings"));
createProfileLink.setOnAction(e -> FXUtils.openLink("https://www.minecraft.net/msaprofile/mygames/editprofile"));
purchaseLink.setOnAction(e -> FXUtils.openLink(YggdrasilService.PURCHASE_URL));
@@ -23,8 +23,12 @@ import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.ButtonBase;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextFlow;
import org.jackhuang.hmcl.setting.Theme;
import org.jackhuang.hmcl.ui.Controllers;
import org.jackhuang.hmcl.ui.FXUtils;
@@ -69,7 +73,17 @@ public final class MessageDialogPane extends StackPane {
public MessageDialogPane(@NotNull String text, @Nullable String title, @NotNull MessageType type) {
FXUtils.loadFXML(this, "/assets/fxml/message-dialog.fxml");
content.getChildren().setAll(FXUtils.segmentToTextFlow(text, Controllers::onHyperlinkAction));
EnhancedTextFlow textFlow = new EnhancedTextFlow();
textFlow.getChildren().setAll(FXUtils.parseSegment(text, Controllers::onHyperlinkAction));
if (textFlow.computePrefHeight(400.0) <= 350.0)
content.getChildren().setAll(textFlow);
else {
ScrollPane scrollPane = new ScrollPane(textFlow);
VBox.setVgrow(scrollPane, Priority.ALWAYS);
scrollPane.setFitToWidth(true);
content.getChildren().setAll(scrollPane);
}
if (title != null)
this.title.setText(title);
@@ -114,6 +128,13 @@ public final class MessageDialogPane extends StackPane {
return cancelButton;
}
private static final class EnhancedTextFlow extends TextFlow {
@Override
public double computePrefHeight(double width) {
return super.computePrefHeight(width);
}
}
public static class Builder {
private final MessageDialogPane dialog;
@@ -34,6 +34,8 @@ import org.jackhuang.hmcl.ui.SVG;
import org.jackhuang.hmcl.ui.account.AccountAdvancedListItem;
import org.jackhuang.hmcl.ui.construct.AdvancedListBox;
import org.jackhuang.hmcl.ui.construct.AdvancedListItem;
import org.jackhuang.hmcl.ui.construct.JFXHyperlink;
import org.jackhuang.hmcl.ui.construct.MessageDialogPane;
import org.jackhuang.hmcl.ui.decorator.DecoratorAnimatedPage;
import org.jackhuang.hmcl.ui.decorator.DecoratorPage;
import org.jackhuang.hmcl.ui.download.ModpackInstallWizardProvider;
@@ -42,6 +44,7 @@ import org.jackhuang.hmcl.ui.versions.Versions;
import org.jackhuang.hmcl.upgrade.UpdateChecker;
import org.jackhuang.hmcl.util.TaskCancellationAction;
import org.jackhuang.hmcl.util.io.CompressingUtils;
import org.jackhuang.hmcl.util.io.JarUtils;
import org.jackhuang.hmcl.util.versioning.VersionNumber;
import java.io.File;
@@ -153,7 +156,18 @@ public class RootPage extends DecoratorAnimatedPage implements DecoratorPage {
multiplayerItem.setLeftGraphic(wrap(SVG::lan));
multiplayerItem.setActionButtonVisible(false);
multiplayerItem.setTitle(i18n("multiplayer"));
multiplayerItem.setOnAction(e -> Controllers.navigate(Controllers.getMultiplayerPage()));
if ("true".equalsIgnoreCase(JarUtils.getManifestAttribute("Enable-HiPer", "")))
multiplayerItem.setOnAction(e -> Controllers.navigate(Controllers.getMultiplayerPage()));
else {
JFXHyperlink link = new JFXHyperlink(i18n("multiplayer.hint.details"));
link.setOnAction(e -> FXUtils.openLink("https://hmcl.huangyuhui.net/api/redirect/multiplayer-migrate"));
multiplayerItem.setOnAction(e ->
Controllers.dialog(
new MessageDialogPane.Builder(i18n("multiplayer.hint"), null, MessageDialogPane.MessageType.INFO)
.addAction(link)
.ok(null)
.build()));
}
// sixth item in left sidebar
AdvancedListItem launcherSettingsItem = new AdvancedListItem();
@@ -25,9 +25,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.*;
import java.nio.ByteBuffer;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.channels.UnresolvedAddressException;
import java.nio.charset.StandardCharsets;
import java.util.logging.Level;
@@ -47,7 +44,12 @@ public class LocalServerBroadcaster implements AutoCloseable {
public LocalServerBroadcaster(String address) {
this.address = address;
this.threadGroup.setDaemon(true);
}
private Thread newThread(Runnable task, String name) {
Thread thread = new Thread(threadGroup, task, name);
thread.setDaemon(true);
return thread;
}
@Override
@@ -67,7 +69,7 @@ public class LocalServerBroadcaster implements AutoCloseable {
public static final Pattern ADDRESS_PATTERN = Pattern.compile("^\\s*(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}):(\\d{1,5})\\s*$");
public void start() {
Thread forwardPortThread = new Thread(threadGroup, this::forwardPort, "ForwardPort");
Thread forwardPortThread = newThread(this::forwardPort, "ForwardPort");
forwardPortThread.start();
}
@@ -84,7 +86,7 @@ public class LocalServerBroadcaster implements AutoCloseable {
serverSocket.bind(null);
Thread broadcastMOTDThread = new Thread(threadGroup, () -> broadcastMOTD(serverSocket.getLocalPort()), "BroadcastMOTD");
Thread broadcastMOTDThread = newThread(() -> broadcastMOTD(serverSocket.getLocalPort()), "BroadcastMOTD");
broadcastMOTDThread.start();
LOG.log(Level.INFO, "Listening " + serverSocket.getLocalSocketAddress());
@@ -92,8 +94,8 @@ public class LocalServerBroadcaster implements AutoCloseable {
while (running) {
Socket forwardedSocket = serverSocket.accept();
LOG.log(Level.INFO, "Accepting client");
new Thread(threadGroup, () -> forwardTraffic(forwardingSocket, forwardedSocket), "Forward S->D").start();
new Thread(threadGroup, () -> forwardTraffic(forwardedSocket, forwardingSocket), "Forward D->S").start();
newThread(() -> forwardTraffic(forwardingSocket, forwardedSocket), "Forward S->D").start();
newThread(() -> forwardTraffic(forwardedSocket, forwardingSocket), "Forward D->S").start();
}
}
} catch (IOException | UnresolvedAddressException e) {
@@ -105,7 +107,7 @@ public class LocalServerBroadcaster implements AutoCloseable {
}
private void forwardTraffic(Socket src, Socket dest) {
try(InputStream is = src.getInputStream(); OutputStream os = dest.getOutputStream()) {
try (InputStream is = src.getInputStream(); OutputStream os = dest.getOutputStream()) {
byte[] buf = new byte[1024];
while (true) {
int len = is.read(buf, 0, buf.length);
@@ -18,16 +18,19 @@
package org.jackhuang.hmcl.ui.multiplayer;
import com.google.gson.JsonParseException;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.BooleanBinding;
import org.jackhuang.hmcl.Metadata;
import org.jackhuang.hmcl.event.Event;
import org.jackhuang.hmcl.event.EventManager;
import org.jackhuang.hmcl.setting.ConfigHolder;
import org.jackhuang.hmcl.task.FileDownloadTask;
import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.ui.Controllers;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.util.Lang;
import org.jackhuang.hmcl.util.gson.DateTypeAdapter;
import org.jackhuang.hmcl.util.*;
import org.jackhuang.hmcl.util.gson.JsonUtils;
import org.jackhuang.hmcl.util.io.ChecksumMismatchException;
import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.io.HttpRequest;
import org.jackhuang.hmcl.util.io.NetworkUtils;
@@ -35,33 +38,39 @@ import org.jackhuang.hmcl.util.platform.Architecture;
import org.jackhuang.hmcl.util.platform.CommandBuilder;
import org.jackhuang.hmcl.util.platform.ManagedProcess;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
import org.jetbrains.annotations.Nullable;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.*;
import java.nio.file.attribute.PosixFilePermission;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.BiFunction;
import java.util.logging.Level;
import static org.jackhuang.hmcl.setting.ConfigHolder.globalConfig;
import static org.jackhuang.hmcl.util.Lang.*;
import static org.jackhuang.hmcl.util.Logging.LOG;
import static org.jackhuang.hmcl.util.Pair.pair;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
import static org.jackhuang.hmcl.util.io.ChecksumMismatchException.verifyChecksum;
/**
* Cato Management.
*/
public final class MultiplayerManager {
static final String HIPER_VERSION = "1.2.2";
// static final String HIPER_VERSION = "1.2.2";
private static final String HIPER_DOWNLOAD_URL = "https://gitcode.net/to/hiper/-/raw/master/";
private static final String HIPER_PACKAGES_URL = HIPER_DOWNLOAD_URL + "packages.sha1";
private static final String HIPER_POINTS_URL = "https://cert.mcer.cn/point.yml";
private static final Path HIPER_CONFIG_PATH = Metadata.HMCL_DIRECTORY.resolve("hiper.yml");
private static final Path HIPER_TEMP_CONFIG_PATH = Metadata.HMCL_DIRECTORY.resolve("hiper.yml");
private static final Path HIPER_CONFIG_DIR = Metadata.HMCL_DIRECTORY.resolve("hiper-config");
public static final Path HIPER_PATH = getHiperLocalDirectory().resolve(getHiperFileName());
public static final int HIPER_AGREEMENT_VERSION = 3;
private static final String REMOTE_ADDRESS = "127.0.0.1";
@@ -77,7 +86,7 @@ public final class MultiplayerManager {
pair(Architecture.MIPS64, "mips64"),
pair(Architecture.MIPS64EL, "mips64le"),
pair(Architecture.PPC64LE, "ppc64le"),
pair(Architecture.RISCV, "riscv64"),
pair(Architecture.RISCV64, "riscv64"),
pair(Architecture.MIPSEL, "mipsle")
);
@@ -89,16 +98,62 @@ public final class MultiplayerManager {
private static final String HIPER_TARGET_NAME = String.format("%s-%s",
osMap.getOrDefault(OperatingSystem.CURRENT_OS, "windows"),
archMap.getOrDefault(Architecture.CURRENT_ARCH, "amd64"));
archMap.getOrDefault(Architecture.SYSTEM_ARCH, "amd64"));
private static final String GSUDO_VERSION = "1.7.1";
private static final String GSUDO_TARGET_ARCH = Architecture.SYSTEM_ARCH == Architecture.X86_64 ? "amd64" : "x86";
private static final String GSUDO_FILE_NAME = "gsudo.exe";
private static final String GSUDO_DOWNLOAD_URL = "https://gitcode.net/glavo/gsudo-release/-/raw/75c952ea3afe8792b0db4fe9bab87d41b21e5895/" + GSUDO_TARGET_ARCH + "/" + GSUDO_FILE_NAME;
private static final Path GSUDO_LOCAL_FILE = Metadata.HMCL_DIRECTORY.resolve("libraries").resolve("gsudo").resolve("gsudo").resolve(GSUDO_VERSION).resolve(GSUDO_TARGET_ARCH).resolve(GSUDO_FILE_NAME);
private static final boolean USE_GSUDO;
static final boolean IS_ADMINISTRATOR;
static final BooleanBinding tokenInvalid = Bindings.createBooleanBinding(
() -> {
String token = globalConfig().multiplayerTokenProperty().getValue();
return token == null || token.isEmpty() || !StringUtils.isAlphabeticOrNumber(token);
},
globalConfig().multiplayerTokenProperty());
private static final DateFormat HIPER_VALID_TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
static {
boolean isAdministrator = false;
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
try {
Process process = Runtime.getRuntime().exec(new String[]{"net.exe", "session"});
if (!process.waitFor(1, TimeUnit.SECONDS)) {
process.destroy();
} else {
isAdministrator = process.exitValue() == 0;
}
} catch (Throwable ignored) {
}
USE_GSUDO = !isAdministrator && OperatingSystem.SYSTEM_BUILD_NUMBER >= 10000;
} else {
isAdministrator = "root".equals(System.getProperty("user.name"));
USE_GSUDO = false;
}
IS_ADMINISTRATOR = isAdministrator;
}
private static CompletableFuture<Map<String, String>> HASH;
private MultiplayerManager() {
}
public static Path getConfigPath(String token) {
return HIPER_CONFIG_DIR.resolve(Hex.encodeHex(DigestUtils.digest("SHA-1", token)) + ".yml");
}
public static void clearConfiguration() {
HIPER_CONFIG_PATH.toFile().delete();
try {
Files.deleteIfExists(HIPER_TEMP_CONFIG_PATH);
Files.deleteIfExists(getConfigPath(ConfigHolder.globalConfig().getMultiplayerToken()));
} catch (IOException e) {
LOG.log(Level.WARNING, "Failed to delete config", e);
}
}
private static CompletableFuture<Map<String, String>> getPackagesHash() {
@@ -115,6 +170,9 @@ public final class MultiplayerManager {
LOG.warning("Failed to parse Hiper packages.sha1 file, line: " + line);
}
}
if (USE_GSUDO) {
hashes.put(GSUDO_FILE_NAME, HttpRequest.GET(GSUDO_DOWNLOAD_URL + ".sha1").getString().trim());
}
return hashes;
}));
}
@@ -137,11 +195,17 @@ public final class MultiplayerManager {
if (!packagesHash.containsKey(String.format("%s/hiper.exe", HIPER_TARGET_NAME))) {
throw new HiperUnsupportedPlatformException();
}
tasks = Arrays.asList(
getFileDownloadTask.apply(String.format("%s/hiper.exe", HIPER_TARGET_NAME), "hiper.exe"),
getFileDownloadTask.apply(String.format("%s/wintun.dll", HIPER_TARGET_NAME), "wintun.dll")
// getFileDownloadTask.apply("tap-windows-9.21.2.exe", "tap-windows-9.21.2.exe")
);
tasks = new ArrayList<>(4);
tasks.add(getFileDownloadTask.apply(String.format("%s/hiper.exe", HIPER_TARGET_NAME), "hiper.exe"));
tasks.add(getFileDownloadTask.apply(String.format("%s/wintun.dll", HIPER_TARGET_NAME), "wintun.dll"));
// tasks.add(getFileDownloadTask.apply("tap-windows-9.21.2.exe", "tap-windows-9.21.2.exe"));
if (USE_GSUDO)
tasks.add(new FileDownloadTask(
NetworkUtils.toURL(GSUDO_DOWNLOAD_URL),
GSUDO_LOCAL_FILE.toFile(),
new FileDownloadTask.IntegrityCheck("SHA-1", packagesHash.get(GSUDO_FILE_NAME))
));
} else {
if (!packagesHash.containsKey(String.format("%s/hiper", HIPER_TARGET_NAME))) {
throw new HiperUnsupportedPlatformException();
@@ -158,44 +222,88 @@ public final class MultiplayerManager {
});
}
private static void verifyChecksumAndDeleteIfNotMatched(Path file, @Nullable String expectedChecksum) throws IOException {
try {
if (expectedChecksum != null) {
ChecksumMismatchException.verifyChecksum(file, "SHA-1", expectedChecksum);
}
} catch (IOException e) {
Files.deleteIfExists(file);
throw e;
public static void downloadHiperConfig(String token, Path configPath) throws IOException {
String certFileContent = HttpRequest.GET(String.format("https://cert.mcer.cn/%s.yml", token)).getString();
if (!certFileContent.equals("")) {
FileUtils.writeText(configPath, certFileContent);
}
}
public static CompletableFuture<HiperSession> startHiper(String token) {
return getPackagesHash().thenApplyAsync(wrap(packagesHash -> {
if (!Files.isRegularFile(HIPER_PATH)) {
throw new HiperNotExistsException(HIPER_PATH);
}
return getPackagesHash().thenComposeAsync(packagesHash -> {
CompletableFuture<Void> future = new CompletableFuture<>();
try {
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
verifyChecksum(getHiperLocalDirectory().resolve("hiper.exe"), "SHA-1", packagesHash.get(String.format("%s/hiper.exe", HIPER_TARGET_NAME)));
verifyChecksum(getHiperLocalDirectory().resolve("wintun.dll"), "SHA-1", packagesHash.get(String.format("%s/wintun.dll", HIPER_TARGET_NAME)));
// verifyChecksumAndDeleteIfNotMatched(getHiperLocalDirectory().resolve("tap-windows-9.21.2.exe"), packagesHash.get("tap-windows-9.21.2.exe"));
if (USE_GSUDO)
verifyChecksum(GSUDO_LOCAL_FILE, "SHA-1", packagesHash.get(GSUDO_FILE_NAME));
} else {
verifyChecksum(getHiperLocalDirectory().resolve("hiper"), "SHA-1", packagesHash.get(String.format("%s/hiper", HIPER_TARGET_NAME)));
}
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
verifyChecksumAndDeleteIfNotMatched(getHiperLocalDirectory().resolve("hiper.exe"), packagesHash.get(String.format("%s/hiper.exe", HIPER_TARGET_NAME)));
verifyChecksumAndDeleteIfNotMatched(getHiperLocalDirectory().resolve("wintun.dll"), packagesHash.get(String.format("%s/wintun.dll", HIPER_TARGET_NAME)));
// verifyChecksumAndDeleteIfNotMatched(getHiperLocalDirectory().resolve("tap-windows-9.21.2.exe"), packagesHash.get("tap-windows-9.21.2.exe"));
} else {
verifyChecksumAndDeleteIfNotMatched(getHiperLocalDirectory().resolve("hiper"), packagesHash.get(String.format("%s/hiper", HIPER_TARGET_NAME)));
future.complete(null);
} catch (IOException e) {
LOG.log(Level.WARNING, "Failed to verify HiPer files", e);
Platform.runLater(() -> Controllers.taskDialog(MultiplayerManager.downloadHiper()
.whenComplete(exception -> {
if (exception == null)
future.complete(null);
else
future.completeExceptionally(exception);
}), i18n("multiplayer.download"), TaskCancellationAction.NORMAL));
}
return future;
}).thenApplyAsync(wrap(ignored -> {
Path configPath = getConfigPath(token);
Files.createDirectories(configPath.getParent());
// 下载 HiPer 配置文件
String certFileContent;
Logging.registerForbiddenToken(token, "<hiper token>");
try {
certFileContent = HttpRequest.GET(String.format("https://cert.mcer.cn/%s.yml", token)).getString();
if (!certFileContent.equals("")) {
certFileContent += "\nlogging:\n format: json\n file_path: ./hiper.log";
FileUtils.writeText(HIPER_CONFIG_PATH, certFileContent);
}
downloadHiperConfig(token, configPath);
} catch (IOException e) {
LOG.log(Level.WARNING, "configuration file cloud cache index code has been not available , try to use the local configuration file", e);
LOG.log(Level.WARNING, "configuration file cloud cache token has been not available, try to use the local configuration file", e);
}
if (Files.exists(configPath)) {
Files.copy(configPath, HIPER_TEMP_CONFIG_PATH, StandardCopyOption.REPLACE_EXISTING);
try (BufferedWriter output = Files.newBufferedWriter(HIPER_TEMP_CONFIG_PATH, StandardOpenOption.WRITE, StandardOpenOption.APPEND)) {
output.write("\n");
output.write("logging:\n");
output.write(" format: json\n");
output.write(" file_path: '" + Metadata.HMCL_DIRECTORY.resolve("logs").resolve("hiper.log").toString().replace("'", "''") + "'\n");
}
}
String[] commands = new String[]{HIPER_PATH.toString(), "-config", HIPER_TEMP_CONFIG_PATH.toString()};
if (!IS_ADMINISTRATOR) {
switch (OperatingSystem.CURRENT_OS) {
case WINDOWS:
if (USE_GSUDO)
commands = new String[]{GSUDO_LOCAL_FILE.toString(), HIPER_PATH.toString(), "-config", HIPER_TEMP_CONFIG_PATH.toString()};
break;
case LINUX:
String askpass = System.getProperty("hmcl.askpass", System.getenv("HMCL_ASKPASS"));
if ("user".equalsIgnoreCase(askpass))
commands = new String[]{"sudo", "-A", HIPER_PATH.toString(), "-config", HIPER_TEMP_CONFIG_PATH.toString()};
else if ("false".equalsIgnoreCase(askpass))
commands = new String[]{"sudo", "--non-interactive", HIPER_PATH.toString(), "-config", HIPER_TEMP_CONFIG_PATH.toString()};
else {
if (Files.exists(Paths.get("/usr/bin/pkexec")))
commands = new String[]{"/usr/bin/pkexec", HIPER_PATH.toString(), "-config", HIPER_TEMP_CONFIG_PATH.toString()};
else
commands = new String[]{"sudo", "--non-interactive", HIPER_PATH.toString(), "-config", HIPER_TEMP_CONFIG_PATH.toString()};
}
break;
case OSX:
commands = new String[]{"sudo", "--non-interactive", HIPER_PATH.toString(), "-config", HIPER_TEMP_CONFIG_PATH.toString()};
break;
}
}
String[] commands = new String[]{HIPER_PATH.toString(), "-config", HIPER_CONFIG_PATH.toString()};
Process process = new ProcessBuilder()
.command(commands)
.start();
@@ -213,7 +321,7 @@ public final class MultiplayerManager {
}
public static Path getHiperLocalDirectory() {
return Metadata.HMCL_DIRECTORY.resolve("libraries").resolve("hiper").resolve("hiper").resolve(HIPER_VERSION);
return Metadata.HMCL_DIRECTORY.resolve("libraries").resolve("hiper").resolve("hiper").resolve("binary");
}
public static class HiperSession extends ManagedProcess {
@@ -238,10 +346,18 @@ public final class MultiplayerManager {
}
private void onLog(String log) {
LOG.info("[Hiper] " + log);
if (!log.startsWith("{")) {
LOG.warning("[HiPer] " + log);
if (log.startsWith("failed to load config"))
error = HiperExitEvent.INVALID_CONFIGURATION;
else if (log.startsWith("sudo: ") || log.startsWith("Error getting authority") || log.startsWith("Error: An error occurred trying to start process"))
error = HiperExitEvent.NO_SUDO_PRIVILEGES;
else if (log.startsWith("Failed to write to log, can't rename log file")) {
error = HiperExitEvent.NO_SUDO_PRIVILEGES;
stop();
}
if (log.contains("failed to load config")) {
error = HiperExitEvent.INVALID_CONFIGURATION;
return;
}
@@ -260,9 +376,11 @@ public final class MultiplayerManager {
Optional<String> validUntil = tryCast(logJson.get("valid"), String.class);
if (validUntil.isPresent()) {
try {
Date date = DateTypeAdapter.deserializeToDate(validUntil.get());
onValidUntil.fireEvent(new HiperShowValidUntilEvent(this, date));
} catch (JsonParseException e) {
synchronized (HIPER_VALID_TIME_FORMAT) {
Date date = HIPER_VALID_TIME_FORMAT.parse(validUntil.get());
onValidUntil.fireEvent(new HiperShowValidUntilEvent(this, date));
}
} catch (JsonParseException | ParseException e) {
LOG.log(Level.WARNING, "Failed to parse certification expire time string: " + validUntil.get());
}
}
@@ -303,6 +421,21 @@ public final class MultiplayerManager {
destroyRelatedThreads();
}
@Override
public void stop() {
try {
writer.write("quit\n");
writer.flush();
} catch (IOException e) {
LOG.log(Level.WARNING, "Failed to quit HiPer", e);
}
try {
getProcess().waitFor(1, TimeUnit.SECONDS);
} catch (InterruptedException ignored) {
}
super.stop();
}
public EventManager<HiperExitEvent> onExit() {
return onExit;
}
@@ -334,6 +467,7 @@ public final class MultiplayerManager {
public static final int CERTIFICATE_EXPIRED = -3;
public static final int FAILED_GET_DEVICE = -4;
public static final int FAILED_LOAD_CONFIG = -5;
public static final int NO_SUDO_PRIVILEGES = -6;
}
public static class HiperIPEvent extends Event {
@@ -410,18 +544,6 @@ public final class MultiplayerManager {
}
}
public static class HiperNotExistsException extends RuntimeException {
private final Path file;
public HiperNotExistsException(Path file) {
this.file = file;
}
public Path getFile() {
return file;
}
}
public static class HiperInvalidTokenException extends RuntimeException {
}
@@ -0,0 +1,36 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2022 huangyuhui <[email protected]> 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 <https://www.gnu.org/licenses/>.
*/
package org.jackhuang.hmcl.ui.multiplayer;
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorArtifactProvider;
import org.jackhuang.hmcl.auth.offline.OfflineAccount;
import org.jackhuang.hmcl.auth.offline.Skin;
import java.util.UUID;
public class MultiplayerOfflineAccount extends OfflineAccount {
public MultiplayerOfflineAccount(AuthlibInjectorArtifactProvider downloader, String username, UUID uuid, Skin skin) {
super(downloader, username, uuid, skin);
}
@Override
protected boolean loadAuthlibInjector(Skin skin) {
return true;
}
}
@@ -22,17 +22,29 @@ import com.jfoenix.controls.JFXDialogLayout;
import javafx.beans.property.*;
import javafx.scene.control.Label;
import javafx.scene.control.Skin;
import org.jackhuang.hmcl.auth.Account;
import org.jackhuang.hmcl.auth.offline.OfflineAccount;
import org.jackhuang.hmcl.event.Event;
import org.jackhuang.hmcl.setting.DownloadProviders;
import org.jackhuang.hmcl.setting.Profile;
import org.jackhuang.hmcl.setting.Profiles;
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.ui.Controllers;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.construct.*;
import org.jackhuang.hmcl.ui.decorator.DecoratorAnimatedPage;
import org.jackhuang.hmcl.ui.decorator.DecoratorPage;
import org.jackhuang.hmcl.ui.versions.Versions;
import org.jackhuang.hmcl.util.HMCLService;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.TaskCancellationAction;
import org.jackhuang.hmcl.util.io.ChecksumMismatchException;
import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.platform.CommandBuilder;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
import org.jackhuang.hmcl.util.platform.SystemUtils;
import java.io.File;
import java.util.Date;
import java.util.concurrent.CancellationException;
import java.util.function.Consumer;
@@ -128,6 +140,23 @@ public class MultiplayerPage extends DecoratorAnimatedPage implements DecoratorP
return session.getReadOnlyProperty();
}
void launchGame() {
Profile profile = Profiles.getSelectedProfile();
Versions.launch(profile, profile.getSelectedVersion(), (launcherHelper) -> {
launcherHelper.setKeep();
Account account = launcherHelper.getAccount();
if (account instanceof OfflineAccount && !(account instanceof MultiplayerOfflineAccount)) {
OfflineAccount offlineAccount = (OfflineAccount) account;
launcherHelper.setAccount(new MultiplayerOfflineAccount(
offlineAccount.getDownloader(),
offlineAccount.getUsername(),
offlineAccount.getUUID(),
offlineAccount.getSkin()
));
}
});
}
private void checkAgreement(Runnable runnable) {
if (globalConfig().getMultiplayerAgreementVersion() < MultiplayerManager.HIPER_AGREEMENT_VERSION) {
JFXDialogLayout agreementPane = new JFXDialogLayout();
@@ -186,22 +215,21 @@ public class MultiplayerPage extends DecoratorAnimatedPage implements DecoratorP
LOG.info("Connection rejected by the server");
return i18n("message.cancelled");
} else if (e instanceof MultiplayerManager.HiperInvalidConfigurationException) {
LOG.info("Hiper invalid configuration");
LOG.warning("HiPer invalid configuration");
return i18n("multiplayer.token.malformed");
} else if (e instanceof MultiplayerManager.HiperNotExistsException) {
LOG.log(Level.WARNING, "Hiper not found " + ((MultiplayerManager.HiperNotExistsException) e).getFile(), e);
} else if (e instanceof ChecksumMismatchException) {
LOG.log(Level.WARNING, "Failed to verify HiPer files", e);
return i18n("multiplayer.error.file_not_found");
} else if (e instanceof MultiplayerManager.HiperExitException) {
LOG.info("HiPer exited accidentally");
int exitCode = ((MultiplayerManager.HiperExitException) e).getExitCode();
LOG.warning("HiPer exited unexpectedly with exit code " + exitCode);
return i18n("multiplayer.exit", exitCode);
} else if (e instanceof MultiplayerManager.HiperInvalidTokenException) {
LOG.info("invalid token");
LOG.warning("invalid token");
return i18n("multiplayer.token.invalid");
} else if (e instanceof ChecksumMismatchException) {
return i18n("exception.artifact_malformed");
} else {
return e.getLocalizedMessage();
LOG.log(Level.WARNING, "Unknown HiPer exception", e);
return e.getLocalizedMessage() + "\n" + StringUtils.getStackTrace(e);
}
}
@@ -253,6 +281,7 @@ public class MultiplayerPage extends DecoratorAnimatedPage implements DecoratorP
private void clearSession() {
this.session.set(null);
this.expireTime.set(null);
this.onExit = null;
this.onIPAllocated = null;
this.onValidUntil = null;
@@ -281,6 +310,38 @@ public class MultiplayerPage extends DecoratorAnimatedPage implements DecoratorP
MultiplayerManager.clearConfiguration();
Controllers.dialog(i18n("multiplayer.token.malformed"));
break;
case MultiplayerManager.HiperExitEvent.NO_SUDO_PRIVILEGES:
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
Controllers.confirm(i18n("multiplayer.error.failed_sudo.windows"), null, MessageDialogPane.MessageType.WARNING, () -> {
FXUtils.openLink("https://docs.hmcl.net/multiplayer/admin.html");
}, null);
} else if (OperatingSystem.CURRENT_OS == OperatingSystem.LINUX) {
Controllers.dialog(i18n("multiplayer.error.failed_sudo.linux", MultiplayerManager.HIPER_PATH.toString()), null, MessageDialogPane.MessageType.WARNING);
} else if (OperatingSystem.CURRENT_OS == OperatingSystem.OSX) {
Controllers.confirm(i18n("multiplayer.error.failed_sudo.mac"), null, MessageDialogPane.MessageType.INFO, () -> {
try {
String text = "%hmcl-hiper ALL=(ALL:ALL) NOPASSWD: " + MultiplayerManager.HIPER_PATH.toString().replaceAll("[ @!(),:=\\\\]", "\\\\$0") + "\n";
File sudoersTmp = File.createTempFile("sudoer", ".tmp");
sudoersTmp.deleteOnExit();
FileUtils.writeText(sudoersTmp, text);
SystemUtils.callExternalProcess(
"osascript", "-e", String.format("do shell script \"%s\" with administrator privileges", String.join(";",
"dscl . create /Groups/hmcl-hiper PrimaryGroupID 758",
"dscl . merge /Groups/hmcl-hiper GroupMembership " + CommandBuilder.toShellStringLiteral(System.getProperty("user.name")) + "",
"mkdir -p /private/etc/sudoers.d",
"mv -f " + CommandBuilder.toShellStringLiteral(sudoersTmp.toString()) + " /private/etc/sudoers.d/hmcl-hiper",
"chown root /private/etc/sudoers.d/hmcl-hiper",
"chmod 0440 /private/etc/sudoers.d/hmcl-hiper"
).replaceAll("[\\\\\"]", "\\\\$0"))
);
} catch (Throwable e) {
LOG.log(Level.WARNING, "Failed to modify sudoers", e);
}
}, null);
}
break;
case MultiplayerManager.HiperExitEvent.INTERRUPTED:
// do nothing
break;
@@ -295,7 +356,7 @@ public class MultiplayerPage extends DecoratorAnimatedPage implements DecoratorP
break;
}
// clearSession();
clearSession();
});
}
@@ -303,5 +364,4 @@ public class MultiplayerPage extends DecoratorAnimatedPage implements DecoratorP
public ReadOnlyObjectProperty<State> stateProperty() {
return state;
}
}
@@ -20,31 +20,42 @@ package org.jackhuang.hmcl.ui.multiplayer;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXPasswordField;
import com.jfoenix.controls.JFXTextField;
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.beans.WeakInvalidationListener;
import javafx.beans.binding.Bindings;
import javafx.collections.ObservableList;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.*;
import javafx.stage.FileChooser;
import javafx.util.StringConverter;
import org.jackhuang.hmcl.game.LauncherHelper;
import org.jackhuang.hmcl.setting.Profile;
import org.jackhuang.hmcl.setting.Profiles;
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.ui.Controllers;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.SVG;
import org.jackhuang.hmcl.ui.construct.*;
import org.jackhuang.hmcl.ui.construct.MessageDialogPane.MessageType;
import org.jackhuang.hmcl.ui.decorator.DecoratorAnimatedPage;
import org.jackhuang.hmcl.ui.versions.Versions;
import org.jackhuang.hmcl.util.HMCLService;
import org.jackhuang.hmcl.util.Lang;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.i18n.Locales;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.concurrent.CompletableFuture;
import java.util.logging.Level;
import static org.jackhuang.hmcl.setting.ConfigHolder.globalConfig;
import static org.jackhuang.hmcl.ui.versions.VersionPage.wrap;
import static org.jackhuang.hmcl.util.Logging.LOG;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimatedPageSkin<MultiplayerPage> {
@@ -65,8 +76,7 @@ public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimated
item.setTitle(i18n("version.launch"));
item.setLeftGraphic(wrap(SVG::rocketLaunchOutline));
item.setOnAction(e -> {
Profile profile = Profiles.getSelectedProfile();
Versions.launch(profile, profile.getSelectedVersion(), LauncherHelper::setKeep);
control.launchGame();
});
})
.startCategory(i18n("help"))
@@ -75,6 +85,31 @@ public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimated
item.setLeftGraphic(wrap(SVG::helpCircleOutline));
item.setOnAction(e -> FXUtils.openLink("https://docs.hmcl.net/multiplayer"));
})
// .addNavigationDrawerItem(item -> {
// item.setTitle(i18n("multiplayer.help.1"));
// item.setLeftGraphic(wrap(SVG::helpCircleOutline));
// item.setOnAction(e -> FXUtils.openLink("https://docs.hmcl.net/multiplayer/admin.html"));
// })
.addNavigationDrawerItem(item -> {
item.setTitle(i18n("multiplayer.help.2"));
item.setLeftGraphic(wrap(SVG::helpCircleOutline));
item.setOnAction(e -> FXUtils.openLink("https://docs.hmcl.net/multiplayer/help.html"));
})
.addNavigationDrawerItem(item -> {
item.setTitle(i18n("multiplayer.help.3"));
item.setLeftGraphic(wrap(SVG::helpCircleOutline));
item.setOnAction(e -> FXUtils.openLink("https://docs.hmcl.net/multiplayer/help.html#%E5%88%9B%E5%BB%BA%E6%96%B9"));
})
.addNavigationDrawerItem(item -> {
item.setTitle(i18n("multiplayer.help.4"));
item.setLeftGraphic(wrap(SVG::helpCircleOutline));
item.setOnAction(e -> FXUtils.openLink("https://docs.hmcl.net/multiplayer/help.html#%E5%8F%82%E4%B8%8E%E8%80%85"));
})
.addNavigationDrawerItem(item -> {
item.setTitle(i18n("multiplayer.help.text"));
item.setLeftGraphic(wrap(SVG::rocketLaunchOutline));
item.setOnAction(e -> FXUtils.openLink("https://docs.hmcl.net/multiplayer/text.html"));
})
.addNavigationDrawerItem(report -> {
report.setTitle(i18n("feedback"));
report.setLeftGraphic(wrap(SVG::messageAlertOutline));
@@ -96,7 +131,7 @@ public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimated
{
ComponentList offPane = new ComponentList();
{
HintPane hintPane = new HintPane(MessageDialogPane.MessageType.INFO);
HintPane hintPane = new HintPane(MessageType.WARNING);
hintPane.setText(i18n("multiplayer.off.hint"));
BorderPane tokenPane = new BorderPane();
@@ -112,6 +147,12 @@ public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimated
tokenField.textProperty().bindBidirectional(globalConfig().multiplayerTokenProperty());
tokenField.setPromptText(i18n("multiplayer.token.prompt"));
Validator validator = new Validator("multiplayer.token.format_invalid", StringUtils::isAlphabeticOrNumber);
InvalidationListener listener = any -> tokenField.validate();
validator.getProperties().put(validator, listener);
tokenField.textProperty().addListener(new WeakInvalidationListener(listener));
tokenField.getValidators().add(validator);
JFXHyperlink applyLink = new JFXHyperlink(i18n("multiplayer.token.apply"));
BorderPane.setAlignment(applyLink, Pos.CENTER_RIGHT);
applyLink.setOnAction(e -> HMCLService.openRedirectLink("multiplayer-static-token"));
@@ -124,12 +165,15 @@ public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimated
startButton.getStyleClass().add("jfx-button-raised");
startButton.setButtonType(JFXButton.ButtonType.RAISED);
startButton.setOnMouseClicked(e -> control.start());
startButton.disableProperty().bind(MultiplayerManager.tokenInvalid);
startPane.getChildren().setAll(startButton);
startPane.setAlignment(Pos.CENTER_RIGHT);
}
offPane.getContent().setAll(hintPane, tokenPane, startPane);
if (!MultiplayerManager.IS_ADMINISTRATOR)
offPane.getContent().add(hintPane);
offPane.getContent().addAll(tokenPane, startPane);
}
ComponentList onPane = new ComponentList();
@@ -140,7 +184,7 @@ public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimated
expirationLabel.textProperty().bind(Bindings.createStringBinding(() ->
control.getExpireTime() == null ? "" : Locales.SIMPLE_DATE_FORMAT.get().format(control.getExpireTime()),
control.expireTimeProperty()));
expirationPane.setCenter(expirationLabel);
expirationPane.setRight(expirationLabel);
GridPane masterPane = new GridPane();
masterPane.setVgap(8);
@@ -162,7 +206,7 @@ public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimated
tutorial.setOnAction(e -> HMCLService.openRedirectLink("multiplayer-tutorial-master"));
masterPane.addRow(0, titlePane);
HintPane hintPane = new HintPane(MessageDialogPane.MessageType.INFO);
HintPane hintPane = new HintPane(MessageType.INFO);
GridPane.setColumnSpan(hintPane, 3);
hintPane.setText(i18n("multiplayer.master.hint"));
masterPane.addRow(1, hintPane);
@@ -212,11 +256,16 @@ public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimated
tutorial.setOnAction(e -> HMCLService.openRedirectLink("multiplayer-tutorial-slave"));
titlePane.setRight(tutorial);
HintPane hintPane = new HintPane(MessageDialogPane.MessageType.INFO);
HintPane hintPane = new HintPane(MessageType.INFO);
GridPane.setColumnSpan(hintPane, 3);
hintPane.setText(i18n("multiplayer.slave.hint"));
slavePane.getChildren().add(hintPane);
HintPane hintPane2 = new HintPane(MessageType.WARNING);
GridPane.setColumnSpan(hintPane2, 3);
hintPane2.setText(i18n("multiplayer.slave.hint2"));
slavePane.getChildren().add(hintPane2);
GridPane notBroadcastingPane = new GridPane();
{
notBroadcastingPane.setVgap(8);
@@ -253,9 +302,9 @@ public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimated
FXUtils.onChangeAndOperate(control.broadcasterProperty(), broadcaster -> {
if (broadcaster == null) {
slavePane.getChildren().setAll(titlePane, hintPane, notBroadcastingPane);
slavePane.getChildren().setAll(titlePane, hintPane, hintPane2, notBroadcastingPane);
} else {
slavePane.getChildren().setAll(titlePane, hintPane, broadcastingPane);
slavePane.getChildren().setAll(titlePane, hintPane, hintPane2, broadcastingPane);
}
});
}
@@ -271,15 +320,114 @@ public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimated
FXUtils.onChangeAndOperate(getSkinnable().sessionProperty(), session -> {
if (session == null) {
mainPane.getChildren().setAll(ComponentList.createComponentListTitle(i18n("multiplayer.off")),
offPane);
mainPane.getChildren().setAll(offPane);
} else {
mainPane.getChildren().setAll(ComponentList.createComponentListTitle(i18n("multiplayer.on")),
onPane);
mainPane.getChildren().setAll(onPane);
}
});
}
ComponentList persistencePane = new ComponentList();
{
HintPane hintPane = new HintPane(MessageType.WARNING);
hintPane.setText(i18n("multiplayer.persistence.hint"));
BorderPane importPane = new BorderPane();
{
Label left = new Label(i18n("multiplayer.persistence.import"));
BorderPane.setAlignment(left, Pos.CENTER_LEFT);
importPane.setLeft(left);
JFXButton importButton = new JFXButton(i18n("multiplayer.persistence.import.button"));
importButton.setOnMouseClicked(e -> {
Path targetPath = MultiplayerManager.getConfigPath(globalConfig().getMultiplayerToken());
if (Files.exists(targetPath)) {
LOG.warning("License file " + targetPath + " already exists");
Controllers.dialog(i18n("multiplayer.persistence.import.file_already_exists"), null, MessageType.ERROR);
return;
}
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(i18n("multiplayer.persistence.import.title"));
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(i18n("multiplayer.persistence.license_file"), "*.yml"));
File file = fileChooser.showOpenDialog(Controllers.getStage());
if (file == null)
return;
CompletableFuture<Boolean> future = new CompletableFuture<>();
if (file.getName().matches("[a-z0-9]{40}.yml") && !targetPath.getFileName().toString().equals(file.getName())) {
Controllers.confirm(i18n("multiplayer.persistence.import.token_not_match"), null, MessageType.QUESTION,
() -> future.complete(true),
() -> future.complete(false)) ;
} else {
future.complete(true);
}
future.thenAcceptAsync(Lang.wrapConsumer(c -> {
if (c) Files.copy(file.toPath(), targetPath);
})).exceptionally(exception -> {
LOG.log(Level.WARNING, "Failed to import license file", exception);
Platform.runLater(() -> Controllers.dialog(i18n("multiplayer.persistence.import.failed"), null, MessageType.ERROR));
return null;
});
});
importButton.disableProperty().bind(MultiplayerManager.tokenInvalid);
importButton.getStyleClass().add("jfx-button-border");
importPane.setRight(importButton);
}
BorderPane exportPane = new BorderPane();
{
Label left = new Label(i18n("multiplayer.persistence.export"));
BorderPane.setAlignment(left, Pos.CENTER_LEFT);
exportPane.setLeft(left);
JFXButton exportButton = new JFXButton(i18n("multiplayer.persistence.export.button"));
exportButton.setOnMouseClicked(e -> {
String token = globalConfig().getMultiplayerToken();
Path configPath = MultiplayerManager.getConfigPath(token);
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(i18n("multiplayer.persistence.export.title"));
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(i18n("multiplayer.persistence.license_file"), "*.yml"));
fileChooser.setInitialFileName(configPath.getFileName().toString());
File file = fileChooser.showSaveDialog(Controllers.getStage());
if (file == null)
return;
CompletableFuture.runAsync(Lang.wrap(() -> MultiplayerManager.downloadHiperConfig(token, configPath)), Schedulers.io())
.handleAsync((ignored, exception) -> {
if (exception != null) {
LOG.log(Level.INFO, "Unable to download hiper config file", e);
}
if (!Files.isRegularFile(configPath)) {
LOG.warning("License file " + configPath + " not exists");
Platform.runLater(() -> Controllers.dialog(i18n("multiplayer.persistence.export.file_not_exists"), null, MessageType.ERROR));
return null;
}
try {
Files.copy(configPath, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException ioException) {
LOG.log(Level.WARNING, "Failed to export license file", ioException);
Platform.runLater(() -> Controllers.dialog(i18n("multiplayer.persistence.export.failed"), null, MessageType.ERROR));
}
return null;
});
});
exportButton.disableProperty().bind(MultiplayerManager.tokenInvalid);
exportButton.getStyleClass().add("jfx-button-border");
exportPane.setRight(exportButton);
}
persistencePane.getContent().setAll(hintPane, importPane, exportPane);
}
ComponentList thanksPane = new ComponentList();
{
HBox pane = new HBox();
@@ -302,6 +450,8 @@ public class MultiplayerPageSkin extends DecoratorAnimatedPage.DecoratorAnimated
content.getChildren().setAll(
mainPane,
ComponentList.createComponentListTitle(i18n("multiplayer.persistence")),
persistencePane,
ComponentList.createComponentListTitle(i18n("about")),
thanksPane
);
Binary file not shown.
@@ -18,7 +18,7 @@
<JFXTextField fx:id="txtServerUrl" promptText="%account.injector.server_url" onAction="#onAddNext" />
</body>
<actions>
<Label fx:id="lblCreationWarning" />
<Label fx:id="lblCreationWarning" wrapText="true" />
<HBox>
<JFXButton onMouseClicked="#onAddCancel" text="%button.cancel" styleClass="dialog-cancel" />
<SpinnerPane fx:id="nextPane" styleClass="small-spinner-pane">
@@ -1,38 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.layout.*?>
<?import java.lang.String?>
<?import javafx.geometry.Insets?>
<fx:root xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
type="StackPane">
<BorderPane styleClass="jfx-dialog-layout">
<left>
<Label fx:id="graphic" translateX="10" translateY="10" minWidth="40" maxWidth="40" minHeight="40" maxHeight="40" />
</left>
<center>
<VBox>
<BorderPane.margin>
<Insets left="8" />
</BorderPane.margin>
<HBox spacing="8">
<StackPane>
<styleClass>
<String fx:value="jfx-layout-heading" />
<String fx:value="title" />
</styleClass>
<Label fx:id="title" text="%message.info" />
</StackPane>
</HBox>
<ScrollPane VBox.vgrow="ALWAYS" fitToWidth="true" fitToHeight="true">
<StackPane fx:id="content" styleClass="jfx-layout-body" />
</ScrollPane>
</VBox>
</center>
<bottom>
<HBox fx:id="actions" styleClass="jfx-layout-actions" />
</bottom>
</BorderPane>
<HBox spacing="8" styleClass="jfx-dialog-layout">
<Label fx:id="graphic" translateX="10" translateY="10" minWidth="40" maxWidth="40" minHeight="40"
maxHeight="40"/>
<VBox HBox.hgrow="ALWAYS">
<StackPane>
<styleClass>
<String fx:value="jfx-layout-heading"/>
<String fx:value="title"/>
</styleClass>
<Label fx:id="title" text="%message.info"/>
</StackPane>
<StackPane fx:id="content" styleClass="jfx-layout-body"/>
<HBox fx:id="actions" styleClass="jfx-layout-actions"/>
</VBox>
</HBox>
</fx:root>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

@@ -62,7 +62,7 @@ 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
account.failed=Failed to login
account.failed=Account refresh failed
account.failed.character_deleted=The character has already been deleted.
account.failed.connect_authentication_server=Unable to contact authentication servers, your Internet connection may be down.
account.failed.connect_injector_server=Unable to connect to the authentication server. Please check your network and make sure you entered the correct URL.
@@ -87,7 +87,8 @@ account.injector.server_url=Server URL
account.injector.server_name=Server Name
account.login=Login
account.login.hint=We will not store your password.
account.login.offline=Login offline
account.login.skip=Login offline
account.login.retry=Retry
account.login.refresh=Re-login
account.login.refresh.microsoft.hint=<b>Because the account authorization is invalid, you need to re-add your Microsoft account</b>\nPlease click on the "OK" button, and copy the code shown here later to finish the login process in the opened browser window.
account.login.refresh.microsoft.manual=<b>Because the account authorization is invalid, you need to re-add your Microsoft account</b>\nYour device code is <b>%1$s</b>, please click here to copy. After clicking on the "OK" button, you should finish the login process in the opened browser window. If it did not show, you can go to %2$s manually.
@@ -127,6 +128,7 @@ account.methods.offline.uuid.hint=UUID is the unique identifier for the game cha
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\
@@ -166,6 +168,7 @@ assets.index.malformed=Index files of downloaded assets were corrupted. You can
button.cancel=Cancel
button.change_source=Change Download Source
button.clear=Clear
button.copy_and_exit=Copy and Exit
button.delete=Delete
button.edit=Edit
button.install=Install
@@ -354,8 +357,12 @@ fatal.missing_dst_root_ca_x3=The DST Root CA X3 certificate is missing from the
You can still use Hello Minecraft\! Launcher, but it will be unable to connect to some websites (such as sites that use certificates issued by Let's Encrypt), which may cause the launcher to work improperly.\n\
\n\
Please update your Java version to at least 8u101 to fix this issue.
fatal.config_change_owner_root=You are using the root account to start Hello Minecraft\! Launcher, this may cause you to fail to start Hello Minecraft\! Launcher with other account in the future.\n\
Do you still want to continue?
fatal.config_loading_failure=Cannot load configuration files.\n\
Please make sure that "Hello Minecraft\! Launcher" has read and write access to "%s" and the files in it.
fatal.config_loading_failure.unix=Hello Minecraft! Launcher could not load the profile because the profile was created by user %1$s. \n\
Please start HMCL with sudo (not recommended), or execute the following command in the terminal to change the ownership of the configuration file to the current user:\n%2$s
fatal.migration_requires_manual_reboot=Hello Minecraft\! Launcher has been upgraded. Please reopen the launcher.
fatal.apply_update_failure=We are sorry, but Hello Minecraft\! Launcher is unable to update.\n\
\n\
@@ -547,6 +554,7 @@ If you still encounter these problems, well, you may need a better computer.
game.crash.reason.resolution_too_high=The game crashed because you are using a resource pack whose texture resolution was too high.\n\
\n\
You should switch to a resource pack with lower resolution, or consider buying a better graphics card with more VRAM.
game.crash.reason.processing_of_javaagent_failed=The current game crashed because processing of -javaagent failed.\n If you add relevant parameters to the Java virtual machine parameters, please check whether they are legal and correct.\n If you do not add relevant parameters or confirm that they are legal and correct, Please try: \n Open the control panel -- Clock and region classification (this option is only available if the option is category display, and it will be skipped if not) -- Region -- the upper management tab -- the lower change system regional setting button -- turn off the "Use Unicode UTF-8 to provide global language support" option in the pop-up window, restart the device, and then try to start the game. \n You can be accessed in<a href=“https://discord.gg/jVvC7HfM6U">Discard</a>or<a href="https://kook.top/Kx7n3t">KOOK</a>ask for help.
game.crash.reason.stacktrace=The crash reason is unknown. You can view its details by clicking the "Logs" button.\n\
\n\
There are some keywords that might contain some Mod IDs. You can search them online to figure out the issue yourself.\n\
@@ -607,7 +615,7 @@ install.installer.liteloader=LiteLoader
install.installer.not_installed=Not Selected
install.installer.optifine=OptiFine
install.installer.quilt=Quilt
install.installer.quilt-api=Quilt API
install.installer.quilt-api=QSL/QFAPI
install.installer.version=%s
install.modpack=Install a Modpack
install.new_game=Add a New Instance
@@ -847,23 +855,45 @@ multiplayer.download.success=Multiplayer online initialization completed
multiplayer.download.unsupported=Multiplayer dependencies are not supported on current system or platform
multiplayer.error.failed_get_device=HiPer could not create a network device, maybe HiPer has already started or lacks administrator privileges.
multiplayer.error.failed_load_config=HiPer initialization failed, maybe there is a problem with the configuration file or the certificate is invalid.
multiplayer.error.file_not_found=The HiPer program could not be found. The program should finish downloading when entering the multiplayer page. Please restart HMCL and try again. \nPlease check if your computer's antivirus software has flagged HiPer as a virus, and if so, restore HiPer.
multiplayer.error.failed_sudo.linux=HiPer requires administrator privileges. You can configure how HiPer applies for privileges by setting the environment variable HMCL_ASKPASS. \nIf HMCL_ASKPASS is set to 'false', please configure sudoers file to allow '%s' to obtain root privileges without password, then restart the computer and start HMCL again;\nIf HMCL_ASKPASS is set to 'user', please set the environment variable SUDO_ASKPASS first, then HMCL will start HiPer with 'sudo --askpass' (see man sudo for details).
multiplayer.error.failed_sudo.mac=HiPer requires administrator privileges. Do you want to grant HiPer administrator rights? \N Click "Yes" to grant HiPer administrator permission, and then restart your computer and open HMCL again.
multiplayer.error.failed_sudo.windows=HiPer requires administrator privileges, please restart HMCL with administrator privileges. Would you like to see the tutorial (Simplified Chinese only)?
multiplayer.error.file_not_found=An update to HiPer has been found. Please re-enter the multiplayer online page to update HiPer.
multiplayer.error.session_expired=Current multiplayer session has been expired. Please fetch a new multiplayer token.
multiplayer.exit=HiPer exited unexpectedly with exit code %d
multiplayer.hint=The multiplayer online function is in the experimental stage, if you have any questions, please go to mcer.cn to give feedback
multiplayer.powered_by=This service is provided under the license of (<a href="https://mcer.cn">Matrix Lab</a>)<a href\="https\://hmcl.huangyuhui.net/api/redirect/multiplayer-agreement" >License Agreement</a>
multiplayer.help.1=管理员权限打开
multiplayer.help.2=多人联机教程
multiplayer.help.3=创建方帮助
multiplayer.help.4=参与者帮助
multiplayer.help.text=测试能否联机
multiplayer.hint=Multiplayer online function is under maintenance.
multiplayer.hint.details=View details
multiplayer.persistence=License Management
multiplayer.persistence.export=Export license to file
multiplayer.persistence.export.button=Export license file
multiplayer.persistence.export.failed=Failed to export the license file, please check the save path you selected.
multiplayer.persistence.export.file_not_exists=Failed to obtain license file, please check whether the token is entered correctly.
multiplayer.persistence.export.title=Select the path to save the license file
multiplayer.persistence.hint=This feature is available for long-term license (valid for more than 24 hours) users, if you are using short-term license (valid for less than 24 hours), you do not need to use this feature.\nWhen you use a long-term license, please use the token to start HiPer within 24 hours after obtaining the license, otherwise HiPer will not be able to obtain the license information. \nAfterwards, you can save the license file through the "Export License File" function below. \nPlease keep the license file in a safe place. After 24 hours of authorization, this file is the only license for your. If you lose this file, you will not be able to play multiplayer games through the token.
multiplayer.persistence.import=Import license from file
multiplayer.persistence.import.button=Import license file
multiplayer.persistence.import.failed=Failed to import license file.
multiplayer.persistence.import.file_already_exists=The license file already exists.
multiplayer.persistence.import.title=Choose license file
multiplayer.persistence.import.token_not_match=The license file you selected may not match the token.\nDo you still want to continue?
multiplayer.persistence.license_file=License file
multiplayer.powered_by=This service is provided under the license of (<a href="https://mcer.cn">Matrix Lab</a>)<a href\="https://docs.hmcl.net/multiplayer/#%E4%BD%BF%E7%94%A8%E6%8E%88%E6%9D%83" >License Agreement</a>
multiplayer.report=Illegal and Violation Report
multiplayer.session.name.motd=HMCL Multiplayer Session
multiplayer.token=Token
multiplayer.token.apply=Apply for a token
multiplayer.token.expired=HiPer certificate expired, please restart HMCL and try again.
multiplayer.token.invalid=Invalid credentials.
multiplayer.token.expired=HiPer token expired, please restart HMCL and try again.
multiplayer.token.format_invalid=Invalid token format
multiplayer.token.invalid=Invalid token.
multiplayer.token.malformed=HiPer configuration file could not be parsed, please restart HMCL and try again.
multiplayer.token.prompt=You need a token to use the multiplayer service. Click on the "Application Credentials" next to it to view the details
multiplayer.off=Start HiPer
multiplayer.off.hint=The multiplayer service is provided by HiPer, you need to start HiPer first to use the multiplayer service.
multiplayer.off.hint=Due to the need to register system network service permissions, administrator rights will be requested when starting HiPer. If prompted for authentication, please allow to start HiPer.
multiplayer.off.start=Start HiPer
multiplayer.on=HiPer
multiplayer.master=Prompt for creator
multiplayer.master.hint=Multiplayer online requires one player to start the game first, select the single player mode to enter a save, and select the "Open to LAN" option in the game options menu. After that you can see the port number (usually 5 digits) indicated by the game in the game chat box. Click the Generate Server Address button below, enter the port number, and you can get your server address. This address needs to be provided to other players who need to join the server to add the server.
multiplayer.master.server_address=Generate server address
@@ -872,12 +902,13 @@ multiplayer.master.video_tutorial=Video Tutorial
multiplayer.master.port=Port number
multiplayer.master.port.validate=The port number (0~65535) displayed in the game chat box,when you open the game in LAN.
multiplayer.slave=Participant Prompt
multiplayer.slave.hint=If you want to join another player's game save to play the game, you need to ask that player to turn on the open mode to the local area network according to the operation prompted by the creator. Then start the game, and select the multiplayer mode, select Add Server. The game will ask you to enter the server address, you only need to create a player to ask for the server address and enter it, and then enter the server.
multiplayer.slave.hint=1.Ask the creator to follow the instructions above\n2.Start the game\n3.Choose multiplayer mode and add a server\n4.The game will require you to enter the server address. You only need to ask the creator for the server address and enter it into the server.
multiplayer.slave.hint2=1. In general, the participant's game account must be a Microsoft account or an external login account (such as Little Skin), otherwise you need to enter the server address into the input box below and click "Join", select the multiplayer mode in the game, enter the LAN world before you can join \n2. In general, the participant's game version and module must be the same as the creator, otherwise join fails.
multiplayer.slave.server_address=Creator server address
multiplayer.slave.server_address.start=Join
multiplayer.slave.server_address.stop=Exit
multiplayer.slave.video_tutorial=Video Tutorial
multiplayer.session.expiration=Expire Time
multiplayer.session.expiration=Token Expiration Time
datapack=Datapacks
datapack.add=Install datapack
@@ -123,6 +123,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.
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
@@ -592,7 +593,7 @@ install.installer.liteloader=LiteLoader
install.installer.not_installed=No seleccionado
install.installer.optifine=OptiFine
install.installer.quilt=Quilt
install.installer.quilt-api=Quilt API
install.installer.quilt-api=QSL/QFAPI
install.installer.version=%s
install.modpack=Instalar un Modpack
install.new_game=Añadir instancia
@@ -841,7 +842,6 @@ O bien, puedes esperar unos minutos. Si la función sigue sin funcionar, consult
multiplayer.exit.timeout.dynamic_token=No se ha podido conectar al servicio multijugador, los servidores de autenticación pueden tener demasiadas peticiones en ese momento. Por favor, espere hasta el próximo medio tiempo para permitir que los servidores despejen algunas sesiones.\n\
\n\
También puedes comprar algunos tokens multijugador para conseguir una experiencia multijugador estable.
multiplayer.hint=La función multijugador está actualmente en fase alfa. Por favor, proporciona tus comentarios en mcer.cn.
multiplayer.nat=Detección de red
multiplayer.nat.failed=No se ha podido detectar el tipo de red.
multiplayer.nat.hint=La detección del tipo de red comprobará si su entorno de red es compatible con la funcionalidad multijugador.\n\
@@ -102,6 +102,7 @@ account.methods.microsoft.error.missing_xbox_account=Microsoftアカウントが
account.methods.microsoft.error.no_character=アカウントにMinecraftJavaプロファイルがありません。\nゲームファイルが作成されていない可能性があります\n上記のリンクをクリックして作成してください
account.methods.microsoft.error.unknown=ログインに失敗しました。Microsoftはエラーコード %d で応答します。
account.methods.microsoft.logging_in=ログイン...
account.methods.forgot_password=パスワードをお忘れの方
account.methods.microsoft.makegameidsettings=プロファイルを作成
account.methods.microsoft.hint=「ログイン」ボタンをクリックして、新しく開いたブラウザウィンドウでログインプロセスを続行する必要があります。\nMicrosoftアカウントへのログインに使用されたトークンが誤って漏洩した場合は、下の[アカウントのバインドを解除]をクリックして、ログイン認証をキャンセルできます。
account.methods.microsoft.manual=「ログイン」ボタンをクリックした後、新しく開いたブラウザウィンドウで認証を完了する必要があります。ブラウザウィンドウが表示されない場合は、ここをクリックしてURLをコピーし、ブラウザで手動で開くことができます。\nMicrosoftアカウントへのログインに使用されたトークンが誤って漏洩した場合は、下の[アカウントのバインドを解除]をクリックして、ログイン認証をキャンセルできます。
@@ -448,7 +449,7 @@ install.installer.liteloader=LiteLoader
install.installer.not_installed=インストールされていません
install.installer.optifine=OptiFine
install.installer.quilt=Quilt
install.installer.quilt-api=Quilt API
install.installer.quilt-api=QSL/QFAPI
install.installer.version=%s
install.modpack=modpackを導入
install.new_game=新規作成
@@ -668,7 +669,6 @@ multiplayer.exit.after_ready=マルチプレイヤーセッションが壊れて
multiplayer.exit.before_ready=マルチプレイヤーセッションの作成に失敗しました。 cato exitcode %d
multiplayer.exit.timeout=マルチプレイヤーサーバーへの接続に失敗しました。
multiplayer.exit.timeout.dynamic_token=マルチプレイヤーサーバーへの接続に失敗しました。
multiplayer.hint=マルチプレイヤー機能は実験的なものです。フィードバックをお願いします。
multiplayer.nat=ネットワークタイプの検出
multiplayer.nat.failed=ネットワークタイプの検出に失敗しました。
multiplayer.nat.hint=ネットワークタイプの検出により、ネットワークがマルチプレイヤーモードの要件を満たしているかどうかが明確になります。
@@ -685,7 +685,7 @@ multiplayer.nat.type.restricted_cone=Medium(制限付きコーン)
multiplayer.nat.type.symmetric=Bad(対称)
multiplayer.nat.type.symmetric_udp_firewall=Bad(UDPファイアウォールと対称)
multiplayer.nat.type.unknown=不明`
multiplayer.powered_by=マルチプレイヤーサービスは<a href="https://mcer.cn">mcer.cn</a>によって提供されます。 <a href\="https\://hmcl.huangyuhui.net/api/redirect/multiplayer-agreement">Licence/a>
multiplayer.powered_by=マルチプレイヤーサービスは<a href="https://mcer.cn">mcer.cn</a>によって提供されます。 <a href\="https://docs.hmcl.net/multiplayer/#%E4%BD%BF%E7%94%A8%E6%8E%88%E6%9D%83">Licence/a>
multiplayer.report=レポート
multiplayer.relay=リレーモード
multiplayer.relay.hint=静的トークンを持ち、テストされたNATタイプが不良対称であるユーザーの場合
@@ -106,6 +106,7 @@ account.methods.microsoft.makegameidsettings=Создать архив
account.methods.microsoft.hint=Вам необходимо нажать кнопку «Войти» и продолжить процесс авторизации во вновь открывшемся окне браузера.\nЕсли токен, используемый для входа в аккаунт Microsoft случайно утёк, вы можете нажать «Отменить авторизацию аккаунта» ниже, чтобы отменить авторизацию.
account.methods.microsoft.manual=После нажатия кнопки «Войти», вы должны завершить авторизацию во вновь открывшемся окне браузера. Если окно браузера не открылось, вы можете щёлкнуть здесь, чтобы скопировать ссылку и вручную открыть её в браузере.\nЕсли токен, используемый для входа в аккаунт Microsoft случайно утёк, вы можете нажать «Отменить авторизацию аккаунта» ниже, чтобы отменить авторизацию.
account.methods.microsoft.profile=Профиль аккаунта...
account.methods.forgot_password=ЗАБЫЛ ПАРОЛЬ
account.methods.microsoft.snapshot=Лаунчер версии снапшот не поддерживает авторизацию через систему Microsoft.
account.methods.microsoft.waiting_browser=Ожидание авторизации в открытом окне браузера...
account.methods.offline=Офлайн
@@ -450,7 +451,7 @@ install.installer.liteloader=LiteLoader
install.installer.not_installed=Не установлен
install.installer.optifine=OptiFine
install.installer.quilt=Quilt
install.installer.quilt-api=Quilt API
install.installer.quilt-api=QSL/QFAPI
install.installer.version=%s
install.modpack=Установить модпак
install.new_game=Установить новую игру
@@ -672,8 +673,7 @@ multiplayer.exit.after_ready=Сессия сетевой игры сломана
multiplayer.exit.before_ready=Не удалось создать сессию сетевой игры. Код выхода като %d
multiplayer.exit.timeout.static_token=Не удалось подключиться к серверу сетевой игры. Переключитесь на динамический токен и попробуйте снова.
multiplayer.exit.timeout.dynamic_token=Не удалось подключиться к серверу сетевой игры.
multiplayer.hint=Функция сетевой игры экспериментальная. Оставьте свой отзыв.
multiplayer.powered_by=Сетевая игра предоставлена <a href="https://mcer.cn">mcer.cn</a>. <a href\="https\://hmcl.huangyuhui.net/api/redirect/multiplayer-agreement">Licence</a>
multiplayer.powered_by=Сетевая игра предоставлена <a href="https://mcer.cn">mcer.cn</a>. <a href\="https://docs.hmcl.net/multiplayer/#%E4%BD%BF%E7%94%A8%E6%8E%88%E6%9D%83">Licence</a>
multiplayer.report=Отчёт
multiplayer.relay=Режим реле
multiplayer.relay.hint=Для пользователей, у которых есть статический токен, и чей проверенный тип NAT - плохо-семитричный
@@ -60,7 +60,7 @@ account.create.yggdrasil=添加 Mojang 帳戶
account.create.offline=添加離線模式帳戶
account.create.authlibInjector=添加外置登入帳戶 (authlib-injector)
account.email=電子信箱
account.failed=登錄失敗
account.failed=帳戶刷新失敗!
account.failed.character_deleted=已刪除此角色
account.failed.connect_authentication_server=無法連線至認證伺服器,可能是網路問題,請檢查設備能否正常上網或使用代理服務
account.failed.connect_injector_server=無法連線至認證伺服器,可能是網路故障,請檢查設備能否正常上網、檢查網址是否輸入錯誤或使用代理服務
@@ -70,7 +70,7 @@ account.failed.invalid_password=密碼無效
account.failed.invalid_token=請嘗試登出並重新輸入密碼登入
account.failed.migration=你的帳號需要被遷移至微軟帳號。如果你已經遷移,你需要使用微軟登錄方式登錄遷移後的微軟帳號。
account.failed.no_character=該帳戶沒有角色
account.failed.server_disconnected=無法訪問登錄伺服器。是否以離線模式繼續登錄(進入遊戲後無法進入有正版驗證的伺服器)?或嘗試重新登入?
account.failed.server_disconnected=無法訪問登入服務器,帳戶信息刷新失敗!\n你可以選擇跳過帳戶刷新(但啓動遊戲後可能會因為帳戶信息過期而導致無法進入開啟正版驗證的服務器)\n或嘗試再次刷新帳戶?
account.failed.server_response_malformed=無法解析認證伺服器回應,可能是伺服器故障
account.failed.wrong_account=登錄了錯誤的帳號
account.hmcl.hint=你需要點擊“登入”按鈕,並在打開的網頁中完成登入
@@ -84,7 +84,8 @@ account.injector.server_url=伺服器位址
account.injector.server_name=伺服器名稱
account.login=登入
account.login.hint=我們不會保存你的密碼
account.login.offline=以離線模式登錄
account.login.skip=重新刷新帳戶
account.login.retry=再次刷新帳戶
account.login.refresh=重新登錄
account.login.refresh.microsoft.hint=<b>因為賬戶授權失效,需要重新添加你的微軟賬戶</b>\n你需要按照以下步驟添加:\n \n1.點擊“確定”按鈕\n2.在網頁瀏覽器顯示的網站中輸入 HMCL 顯示的代碼(自動拷貝,直接粘貼即可),並點擊“下一步”\n3.按照網站的提示登入\n4.當網站顯示“ 是否允許此應用訪問你的信息?”的標識時,請點擊“是”\n5.當網站提示“大功告成”的標示時,及表示登入成功!然後等待賬戶完成添加即可!\n \n-若網站提示“出现错误”的標識,請嘗試重新按照以上步驟登入\n-若賬戶添加失敗,請嘗試重新按照以上步驟登入\n<b>-若設備網絡環境不佳,可能登陸網站加載很慢甚至無法加載,此時請使用 VPN 或代理伺服器並重試</b>
account.login.refresh.microsoft.manual=<b>因為賬戶授權失效,需要重新添加你的微軟賬戶</b>\n你需要按照以下步驟添加:\n \n1.點擊“確定”按鈕\n2.在網頁瀏覽器顯示的網站中輸入該代碼:<b>%1$s</b>(已自動拷貝,請點此再次拷貝),並點擊“下一步”\n3.按照網站的提示登入\n4.當網站顯示“ 是否允許此應用訪問你的信息?”的標識時,請點擊“是”\n5.當網站提示“大功告成”的標示時,及表示登入成功!然後等待賬戶完成添加即可!\n \n-若網站提示“出现错误”的標識,請嘗試重新按照以上步驟登入\n-若賬戶添加失敗,請嘗試重新按照以上步驟登入\n-若網站未能打開,請手動在網頁瀏覽器中打開:%2$s\n<b>-若設備網絡環境不佳,可能登陸網站加載很慢甚至無法加載,此時請使用 VPN 或代理伺服器並重試</b>
@@ -109,6 +110,7 @@ account.methods.microsoft.makegameidsettings=創建檔案
account.methods.microsoft.hint=你需要按照以下步驟添加:\n1.點擊“登入”按鈕\n2.在網頁瀏覽器顯示的網站中輸入 HMCL 顯示的代碼(自動拷貝,直接粘貼即可),並點擊“下一步”\n3.按照網站的提示登入\n4.當網站顯示“ 是否允許此應用訪問你的信息?”的標識時,請點擊“是”\n5.當網站提示“大功告成”的標示時,及表示登入成功!然後等待賬戶完成添加即可!\n-若網站提示“出现错误”的標識,請嘗試重新按照以上步驟登入\n-若賬戶添加失敗,請嘗試重新按照以上步驟登入\n<b>-若設備網絡環境不佳,可能登陸網站加載很慢甚至無法加載,此時請使用 VPN 或代理伺服器並重試</b>\n-若登入微軟賬號的 Token 洩露,可點擊下方“解除帳戶授權”解除登入授權,然後等待 Token 過期
account.methods.microsoft.manual=你需要按照以下步驟添加:\n1.點擊“登入”按鈕\n2.在網頁瀏覽器顯示的網站中輸入該代碼:<b>%1$s</b>(已自動拷貝,請點此再次拷貝),並點擊“下一步”\n3.按照網站的提示登入\n4.當網站顯示“ 是否允許此應用訪問你的信息?”的標識時,請點擊“是”\n5.當網站提示“大功告成”的標示時,及表示登入成功!然後等待賬戶完成添加即可\n-若網站提示“出现错误”的標識,請嘗試重新按照以上步驟登入\n-若賬戶添加失敗,請嘗試重新按照以上步驟登入\n-若網站未能打開,請手動在網頁瀏覽器中打開:%2$s\n<b>-若設備網絡環境不佳,可能登陸網站加載很慢甚至無法加載,此時請使用 VPN 或代理伺服器並重試</b>\n-若登入微軟賬號的 Token 洩露,可點擊下方“解除帳戶授權”解除登入授權,然後等待 Token 過期
account.methods.microsoft.profile=帳戶設置頁
account.methods.forgot_password=忘記密碼
account.methods.microsoft.snapshot=HMCL 快照版暫不提供微軟登入支持,請使用穩定版或測試版進行登入。
account.methods.microsoft.waiting_browser=等待在新打開的瀏覽器窗口中完成登入...
account.methods.offline=離線模式
@@ -153,6 +155,7 @@ assets.index.malformed=資源檔案的索引檔案損壞,您可以在遊戲 [
button.cancel=取消
button.change_source=切換下載源
button.clear=清除
button.copy_and_exit=複製並退出
button.delete=刪除
button.edit=編輯
button.install=安裝
@@ -328,7 +331,9 @@ fatal.javafx.incompatible=缺少 JavaFX 運行環境。\nHMCL 無法在低於 Ja
fatal.javafx.incompatible.loongson=缺少 JavaFX 運行環境。\n請使龍芯 JDK 8 (http://www.loongnix.cn/zh/api/java/downloads-jdk8/index.html) 啟動 HMCL。
fatal.javafx.missing=找不到 JavaFX。\n如果您使用的是 Java 11 或更高版本,請降級到 Oracle JRE 8,或者安裝 BellSoft Liberica Full JRE。\n如果您使用的是其他 OpenJDK 构建,請確保其包含 OpenJFX。
fatal.missing_dst_root_ca_x3=目前的 Java 平台缺少 DST Root CA X3 憑證。\n您依然可以使用 Hello Minecraft! Launcher,但會無法連線到部分網站 (如使用 Lets Encrypt 憑證的站台),這可能會使 Hello Minecraft! Launcher 無法正常運作。\n請將您的 Java 升級到 8u101 以上來解決此問題。
fatal.config_change_owner_root=你正在使用 root 帳戶啟動 Hello Minecraft! Launcher,這可能導致你未來無法使用其他帳戶正常啟動 Hello Minecraft! Launcher。\n是否繼續啟動?
fatal.config_loading_failure=Hello Minecraft! Launcher 無法載入設定檔案。\n請確保 Hello Minecraft! Launcher 對 "%s" 目錄及該目錄下的檔案擁有讀寫權限。
fatal.config_loading_failure.unix=Hello Minecraft! Launcher 無法載入設定檔案,因為設定檔案是由用戶 %1$s 創建的。\n請使用 root 帳戶啟動 HMCL (不推薦),或在終端中執行以下命令將設定檔案的所有權變更為當前用戶: \n%2$s
fatal.migration_requires_manual_reboot=Hello Minecraft! Launcher 即將升級完成,請重新開啟 Hello Minecraft! Launcher。
fatal.apply_update_failure=我們很抱歉 Hello Minecraft! Launcher 無法自動完成升級程式,因為出現了一些問題。\n但你依然可以從 %s 處手動下載 Hello Minecraft! Launcher 來完成升級。\n請考慮向我們回報該問題。
fatal.samba=如果您正在通過 Samba 共亯的資料夾中運行 HMCL,HMCL 可能無法正常工作,請嘗試更新您的 Java 或在本地資料夾內運行 HMCL。
@@ -414,6 +419,7 @@ game.crash.reason.no_such_method_error=當前遊戲因為代碼不完整,無
game.crash.reason.opengl_not_supported=當前遊戲因為你的顯示卡驅動存在問題,無法繼續運行。\n原因是 OpenGL 不受支援,你現在是否在遠程桌面或者串流模式下?如果是,請直接使用原電腦啟動遊戲。\n或者嘗試升級你的顯示卡驅動到最新版本後再嘗試啟動遊戲。如果你的電腦存在獨立顯示卡,你需要檢查遊戲是否使用集成/核心顯示卡啟動,如果是,請嘗試使用獨立顯示卡啟動 HMCL 與遊戲。如果仍有問題,你可能需要考慮換一個新顯示卡或新電腦。
game.crash.reason.openj9=當前遊戲無法運行在 OpenJ9 虛擬機上,請你在遊戲設置中更換 Hotspot Java 虛擬機,並重新啟動遊戲。如果沒有下載安裝,你可以在網路上自行下載。
game.crash.reason.out_of_memory=當前遊戲因為記憶體不足,無法繼續運行。\n這可能是記憶體分配太小,或者 Mod 數量過多導致的。\n你可以在遊戲設置中調大遊戲記憶體分配值以允許遊戲在更大的記憶體下運行。\n如果仍然出現該錯誤,你可能需要換一台更好的電腦。
game.crash.reason.processing_of_javaagent_failed=當前遊戲因為加載 -javaagent 參數失敗,無法繼續運行。\n如果你在 Java 虛擬機參數 中添加了相關參數,請檢查是否正確。\n如果你沒有添加相關參數或參數確認正確, 請嘗試:\n打開 控制面板 -- 時鐘和區域 分類(選項為類別顯示才有此選項,沒有就跳過)-- 區域 -- 上方的 管理 選項卡 -- 下方的 更改系統區域設置 按鈕 -- 在彈出的視窗中將 “使用Unicode UTF-8提供全球語言支持” 選項關閉,重啓設備後再嘗試啟動遊戲。\n可在<a href="https://discord.gg/jVvC7HfM6U">Discord</a>或<a href="https://kook.top/Kx7n3t">KOOK群</a>尋求幫助
game.crash.reason.resolution_too_high=當前遊戲因為材質包解析度過高,無法繼續運行\n你可以更換一個解析度更低的材質,或者更換一個視訊記憶體更大的顯示卡。
game.crash.reason.stacktrace=原因未知,請點擊日誌按鈕查看詳細訊息。\n下面是一些關鍵字,其中可能包含 Mod 名稱,你可以透過搜索的方式查找有關訊息。\n%s
game.crash.reason.too_old_java=當前遊戲因為 Java 虛擬機版本過低,無法繼續運行。\n你需要在遊戲設置中更換 %1$s 或更新版本的 Java 虛擬機,並重新啟動遊戲。如果沒有下載安裝,你可以點擊 <a href="https://docs.microsoft.com/zh-TW/java/openjdk/download">此處</a> 下載微軟 JDK。
@@ -463,7 +469,7 @@ install.installer.liteloader=LiteLoader
install.installer.not_installed=不安裝
install.installer.optifine=OptiFine
install.installer.quilt=Quilt
install.installer.quilt-api=Quilt API
install.installer.quilt-api=QSL/QFAPI
install.installer.version=%s
install.modpack=安裝模組包
install.new_game=安裝新遊戲版本
@@ -693,38 +699,61 @@ multiplayer.download=正在下載相依元件
multiplayer.download.failed=初始化失敗,部分檔案未能完成下載
multiplayer.download.success=多人聯機初始化完成
multiplayer.download.unsupported=多人聯機依賴不支持當前系統或平台
multiplayer.error.failed_get_device=HiPer 無法創建網絡設備,可能是HiPer已經啟動或缺少管理員權限。
multiplayer.error.failed_get_device=HiPer無法創建網路設備,可能是 HiPer 正在運行中。請關閉正在運行中的其他啟動器,或通過工作管理員終止 HiPer。
multiplayer.error.failed_load_config=HiPer 初始化失敗,可能是配置文件存在問題或證書已失效。
multiplayer.error.file_not_found=找不到 HiPer 程式。該程式應該在進入多人聯機頁面時完成下載。請重啟 HMCL 再試。\n請檢查你電腦的防毒軟體是否將 HiPer 標記為病毒,如果是,請恢復 HiPer。
multiplayer.error.session_expired=本次使用時間已結束,若要繼續使用,請更新憑證
multiplayer.error.failed_sudo.linux=HiPer 需要管理員許可權才能運行,您可以通過設置環境變量 HMCL_ASKPASS 配置 HiPer 如何申請權限。\n若將 HMCL_ASKPASS 設置為 'false',請通過配置 sudoers 文件允許 '%s' 免密獲取 root 權限,重啟後再次啟動 HMCL 即可;\n若將 HMCL_ASKPASS 設置為 'user',請先設置環境變量 SUDO_ASKPASS,HMCL 將使用 sudo --askpass 啟動 HiPer (具體請參見 man sudo)。
multiplayer.error.failed_sudo.mac=HiPer 需要管理員許可權才能運行。是否要授予 HiPer 管理員許可權? \n點擊“是”授予 HiPer 管理員許可權,然後重啓電腦後再次打開啟動器即可聯機。
multiplayer.error.failed_sudo.windows=HiPer 需要管理員權限才能運行,請使用管理員權限重新啟動 HMCL。是否查看教程?
multiplayer.error.file_not_found=已發現 HiPer 有可用的更新,請重新進入多人聯機頁面以更新 HiPer。
multiplayer.error.session_expired=本次使用時間已結束,若要繼續使用,請更新索引碼
multiplayer.exit=HiPer 意外退出,退出碼 %d
multiplayer.hint=多人聯機功能處於實驗階段,如果有問題請前往 mcer.cn 回饋
multiplayer.powered_by=本服務由 (<a href="https://mcer.cn">速聚</a>) 提供。<a href\="https\://hmcl.huangyuhui.net/api/redirect/multiplayer-agreement">授權協議</a>
multiplayer.help.1=管理員權限打開
multiplayer.help.2=多人聯機教程
multiplayer.help.3=創建方幫助
multiplayer.help.4=參與者幫助
multiplayer.help.text=測試能否聯機
multiplayer.hint=多人聯機服務正在維護中。
multiplayer.hint.details=查看詳情
multiplayer.persistence=授權信息管理
multiplayer.persistence.export=將授權信息導出至文件
multiplayer.persistence.export.button=導出授權文件
multiplayer.persistence.export.failed=導出授權文件失敗,請檢查您所選擇的保存路徑。
multiplayer.persistence.export.file_not_exists=獲取授權文件失敗,請檢查索引碼是否輸入正確。
multiplayer.persistence.export.title=選擇授權文件保存路徑
multiplayer.persistence.hint=此功能為長期授權 (有效期超過 24 小時) 用戶提供,如果你正在使用短期授權 (有效期不超過 24 小時),則無需使用本功能。\n當你使用長期授權時,請在獲取授權後的 24 小時內使用索引碼啟動 HiPer,否則 HiPer 將無法獲取授權信息。\n隨後,你可以通過下方的“導出授權信息”功能保存授權文件。\n請注意妥善保管授權文件,在獲取授權 24 小時後,該文件是你的長期授權的唯一憑證,丟失該文件將無法通過索引碼進行聯機。
multiplayer.persistence.import=從文件導入授權信息
multiplayer.persistence.import.button=導入授權文件
multiplayer.persistence.import.failed=導入授權文件失敗。
multiplayer.persistence.import.file_already_exists=授權文件已經存在。
multiplayer.persistence.import.title=選擇授權文件
multiplayer.persistence.import.token_not_match=你選擇的授權文件可能與索引碼不匹配,是否繼續導入?
multiplayer.persistence.license_file=授權文件
multiplayer.powered_by=本服務由 (<a href="https://mcer.cn">速聚</a>) 提供。<a href\="https://docs.hmcl.net/multiplayer/#%E4%BD%BF%E7%94%A8%E6%8E%88%E6%9D%83">授權協議</a>
multiplayer.report=違法違規檢舉
multiplayer.token=憑證
multiplayer.token.apply=申請憑證
multiplayer.token.invalid=憑證不正確。
multiplayer.token=索引碼
multiplayer.token.apply=申請索引碼
multiplayer.token.format_invalid=索引碼格式不正確
multiplayer.token.invalid=索引碼不正確。
multiplayer.token.expired=HiPer 證書過期,請重新啟動 HMCL 再試。
multiplayer.token.malformed=HiPer 配置檔案無法解析,請重新啟動 HMCL 再試。
multiplayer.token.prompt=你需要憑證才能使用多人聯機服務。點擊旁邊的“申請憑證”查看詳情
multiplayer.off=啟動 HiPer
multiplayer.off.hint=多人聯機服務由 HiPer 提供,你需要先使用管理員權限啟動 HMCL(具體操作方法詳見左側的 幫助),然後輸入憑證啟動 HiPer 以使用多人聯機服務。
multiplayer.token.prompt=你需要索引碼才能使用多人聯機服務。點擊旁邊的“申請索引碼”查看詳情
multiplayer.off.hint=由於需要注册系統網路服務許可權,啟動 HiPer 時將會向用戶申請管理員許可權。若出現認證提示,允許以啟動 HiPer。
multiplayer.off.start=啟動 HiPer
multiplayer.on=HiPer
multiplayer.master=创建方提示
multiplayer.master.hint=1.啟動遊戲\n2.選擇單人遊戲模式進入一個存檔\n3.在遊戲選項菜單內選擇 對局域網開放 選項,之後你可以在遊戲聊天框內看到遊戲提示的端口號(通常是 5 位數字)\n4.點擊下方的生成伺服器地址按鈕,輸入端口號,你就可以獲得你的伺服器地址了\n5.該地址需要提供給其他需要加入伺服器的玩家用於添加伺服器。
multiplayer.master.hint=1.啟動遊戲\n2.選擇單人遊戲模式進入一個存檔\n3.在遊戲選項菜單內選擇 對局域網開放 選項,之後你可以在遊戲聊天框內看到遊戲提示的端口號(通常是 4~5 位數字)\n4.點擊下方的生成伺服器地址按鈕,輸入端口號,你就可以獲得你的伺服器地址了\n5.該地址需要提供給其他需要加入伺服器的玩家用於添加伺服器。
multiplayer.master.server_address=生成伺服器地址
multiplayer.master.server_address.copy=拷貝
multiplayer.master.video_tutorial=教學影片
multiplayer.master.port=埠號
multiplayer.master.port.validate=在遊戲聊天框中出現的埠號 (0~65535)
multiplayer.slave=參與者提示
multiplayer.slave.hint=1.要求創建方按照上方的 創建方提示 操作\n2.啟動遊戲\n3.選擇多人遊戲模式,選擇添加伺服器\n4.遊戲會要求你輸入伺服器地址,你只需要向創建方索要伺服器地址並輸入,並進入伺服器即可。 \n- 注意:\n1.一般情況下,參與者的遊戲賬戶必須是 微軟賬戶 或 外置登錄賬戶(如 Little Skin),否則你需要將伺服器地址輸入至下方的輸入框中並點擊廣播,在遊戲中選擇多人遊戲模式,進入局域網世界方可加入,具體操作方法詳見左側的 幫助 \n2.一般情況下,參與者的遊戲版本、模組要必須與創建方的一致,否則加入失敗。
multiplayer.slave.server_address=創建方服務器地址
multiplayer.slave.hint=1.要求創建方按照上方的 創建方提示 操作\n2.啟動遊戲\n3.選擇多人遊戲模式,選擇添加服務器\n4.遊戲會要求你輸入服務器地址,你只需要向創建方索要服務器地址並輸入,並進入服務器即可。
multiplayer.slave.hint2=1.一般情況下,參與者的遊戲賬戶必須是 微軟賬戶 或 外置登錄賬戶(如 Little Skin),否則你需要將服務器地址輸入至下方的輸入框中並點擊“加入”,在遊戲中選擇多人遊戲模式,進入局域網世界方可加入\n2.一般情況下,參與者的遊戲版本、模組要必須與創建方的一致,否則加入失敗。
multiplayer.slave.server_address=創建方伺服器地址
multiplayer.slave.server_address.start=加入
multiplayer.slave.server_address.stop=退出
multiplayer.slave.video_tutorial=教學影片
multiplayer.session.expiration=本次使用截止時間
multiplayer.session.expiration=索引碼到期時間
datapack=資料包
datapack.add=加入資料包
@@ -60,7 +60,7 @@ account.create.yggdrasil=添加 Mojang 帐户
account.create.offline=添加离线模式帐户
account.create.authlibInjector=添加外置登录帐户 (authlib-injector)
account.email=邮箱
account.failed=登录失败
account.failed=账户刷新失败!
account.failed.character_deleted=此角色已被删除
account.failed.connect_authentication_server=无法连接认证服务器,可能是网络问题,请检查设备能否正常上网或使用代理服务
account.failed.connect_injector_server=无法连接认证服务器,可能是网络问题,请检查设备是否能正常上网,检查 URL 是否输入错误,或使用代理服务
@@ -70,7 +70,7 @@ account.failed.invalid_password=无效的密码
account.failed.invalid_token=请尝试登出并重新输入密码登录
account.failed.migration=你的帐号需要被迁移至微软帐号。如果你已经迁移,你需要使用微软登录方式登录迁移后的微软帐号。
account.failed.no_character=该帐号没有角色
account.failed.server_disconnected=无法访问登录服务器。是否以离线模式继续登录(进入游戏后无法进入有正版验证的服务器)?或尝试重新登录?
account.failed.server_disconnected=无法访问登录服务器,账户信息刷新失败!\n你可以选择 跳过账户刷新(但启动游戏后可能会因为账户信息过期而导致无法进入开启正版验证的服务器)\n或尝试再次刷新账户?
account.failed.server_response_malformed=无法解析认证服务器响应,可能是服务器故障
account.failed.wrong_account=登录了错误的帐号
account.hmcl.hint=你需要点击“登录”按钮,并在打开的网页中完成登录
@@ -84,7 +84,8 @@ account.injector.server_url=服务器地址
account.injector.server_name=服务器名称
account.login=登录
account.login.hint=我们不会保存你的密码
account.login.offline=以离线模式登录
account.login.skip=跳过账户刷新
account.login.retry=再次刷新账户
account.login.refresh=重新登录
account.login.refresh.microsoft.hint=<b>因为账户授权失效,需要重新添加你的微软账户</b>\n你需要按照以下步骤添加:\n \n1.点击“确定”按钮\n2.在网页浏览器显示的网站中输入 HMCL 显示的代码(自动拷贝,直接粘贴即可),并点击“下一步”\n3.按照网站的提示登录\n4.当网站提示“是否允许此应用访问你的信息?”的标识时,请点击“是”\n5.当网站提示“大功告成”的标识时,及表示登录成功!然后等待账户完成添加即可!\n \n-若网站提示“出现错误”的标识时,请重新按照以上步骤重新添加\n-若账户添加失败,请重新按照以上步骤重新添加\n<b>-若设备网络环境不佳,可能登录网站加载很慢甚至无法加载,此时请使用 VPN 或代理服务器并重试</b>\n-若登录微软账户的 Token (不是密码)泄露,可点击下方“解除账户绑定”解除登录授权,然后等待 Token 过期
account.login.refresh.microsoft.manual=<b>因为账户授权失效,需要重新添加你的微软账户</b>\n你需要按照以下步骤添加:\n \n1.点击“确定”按钮\n2.在网页浏览器显示的网站中输入:<b>%1$s</b>(已自动拷贝,点此再次拷贝),并点击“下一步”\n3.按照网站的提示登录\n4.当网站提示“是否允许此应用访问你的信息?”的标识时,请点击“是”\n5.当网站提示“大功告成”的标识时,及表示登录成功!然后等待账户完成添加即可!\n \n-若网站提示“出现错误”的标识时,请重新按照以上步骤重新添加\n-若账户添加失败,请重新按照以上步骤重新添加\n-若网站未能显示,请手动在网页浏览器中打开:%2$s\n<b>-若设备网络环境不佳,可能登录网站加载很慢甚至无法加载,此时请使用 VPN 或代理服务器并重试</b>\n-若登录微软账户的 Token (不是密码)泄露,可点击下方“解除账户绑定”解除登录授权,然后等待 Token 过期
@@ -109,7 +110,8 @@ account.methods.microsoft.makegameidsettings=创建档案
account.methods.microsoft.hint=你需要按照以下步骤添加:\n1.点击“登录”按钮\n2.在网页浏览器显示的网站中输入 HMCL 显示的代码(自动拷贝,直接粘贴即可),并点击“下一步”\n3.按照网站的提示登录\n4.当网站提示“是否允许此应用访问你的信息?”的标识时,请点击“是”\n5.当网站提示“大功告成”的标识时,及表示登录成功!然后等待账户完成添加即可!\n-若网站提示“出现错误”的标识时,请重新按照以上步骤重新添加\n-若账户添加失败,请重新按照以上步骤重新添加\n<b>-若设备网络环境不佳,可能登录网站加载很慢甚至无法加载,此时请使用 VPN 或代理服务器并重试</b>\n-若登录微软账户的 Token (不是密码)泄露,可点击下方“解除账户绑定”解除登录授权,然后等待 Token 过期
account.methods.microsoft.manual=你需要按照以下步骤添加:\n1.点击“登录”按钮\n2.在网页浏览器显示的网站中输入:<b>%1$s</b>(已自动拷贝,点此再次拷贝),并点击“下一步”\n3.按照网站的提示登录\n4.当网站提示“是否允许此应用访问你的信息?”的标识时,请点击“是”\n5.当网站提示“大功告成”的标识时,及表示登录成功!然后等待账户完成添加即可\n-若网站提示“出现错误”的标识时,请重新按照以上步骤重新添加\n-若账户添加失败,请重新按照以上步骤重新添加\n-若网站未能显示,请手动在网页浏览器中打开:%2$s\n<b>-若设备网络环境不佳,可能登录网站加载很慢甚至无法加载,此时请使用 VPN 或代理服务器并重试</b>\n-若登录微软账户的 Token (不是密码)泄露,可点击下方“解除账户绑定”解除登录授权,然后等待 Token 过期
account.methods.microsoft.profile=帐户设置页
account.methods.microsoft.snapshot=HMCL 快照版暂不提供微软登录支持,请使用稳定版或测试版进行登录。
account.methods.forgot_password=忘记密码
account.methods.microsoft.snapshot=HMCL 快照版暂不提供微软登录支持,请使用推荐版本(稳定版)或测试版进行登录!
account.methods.microsoft.waiting_browser=等待在新打开的浏览器窗口中完成登录……
account.methods.offline=离线模式
account.methods.offline.uuid=UUID
@@ -153,6 +155,7 @@ assets.index.malformed=资源文件的索引文件损坏,您可以在相应的
button.cancel=取消
button.change_source=切换下载源
button.clear=清除
button.copy_and_exit=复制并退出
button.delete=删除
button.edit=修改
button.install=安装
@@ -328,7 +331,9 @@ fatal.javafx.incompatible=缺少 JavaFX 运行环境。\nHMCL 无法在低于 Ja
fatal.javafx.incompatible.loongson=缺少 JavaFX 运行环境。\n请使用龙芯 JDK 8 (http://www.loongnix.cn/zh/api/java/downloads-jdk8/index.html) 启动 HMCL。
fatal.javafx.missing=缺少 JavaFX 运行环境。\n如果您使用的是 Java 11 或更高版本,请降级到 Oracle JRE 8(java.com),或者安装 BellSoft Liberica Full JRE(bell-sw.com/pages/downloads/?package=jre-full)。\n如果您使用的是其他 OpenJDK 构建,请确保其包含 OpenJFX!
fatal.missing_dst_root_ca_x3=当前 Java 平台缺少 DST Root CA X3 证书。\n您依然可以使用 Hello Minecraft! Launcher,但将无法连接到部分站点(如使用 Lets Encrypt 证书的站点),这可能会使 HMCL 无法正常工作。\n请将您的 Java 升级到 8u101 以上以解决此问题。
fatal.config_loading_failure=Hello Minecraft! Launcher 无法加载配置文件\n请确保 Hello Minecraft! Launcher 对 "%s" 目录及该目录下的文件拥有读写权限!
fatal.config_change_owner_root=你正在使用 root 账户启动 Hello Minecraft! Launcher, 这可能导致你未来无法正常使用其他账户正常启动 Hello Minecraft! Launcher。\n是否继续启动?
fatal.config_loading_failure=Hello Minecraft! Launcher 无法加载配置文件\n请确保 Hello Minecraft! Launcher 对 "%s" 目录及该目录下的文件拥有读写权限。
fatal.config_loading_failure.unix=Hello Minecraft! Launcher 无法加载配置文件,因为配置文件是由用户 %1$s 创建的。\n请使用 root 账户启动 HMCL (不推荐),或在终端中执行以下命令将配置文件的所有权变更为当前用户:\n%2$s
fatal.migration_requires_manual_reboot=Hello Minecraft! Launcher 即将完成升级,请重新打开 Hello Minecraft! Launcher。
fatal.apply_update_failure=我们很抱歉 Hello Minecraft! Launcher 无法自动完成升级,因为出现了一些问题……\n但你依可以从 %s 处手动下载 Hello Minecraft! Launcher 来完成升级\n请考虑向我们反馈该问题!
fatal.samba=如果您正在通过 Samba 共享的文件夹中运行 HMCL,HMCL 可能无法正常工作,请尝试更新您的 Java 或在本地文件夹内运行 HMCL。
@@ -414,9 +419,10 @@ game.crash.reason.no_such_method_error=当前游戏因为代码不完整,无
game.crash.reason.opengl_not_supported=当前游戏因为你的显卡驱动存在问题,无法继续运行。\n原因是 OpenGL 不受支持,你现在是否在远程桌面或者串流模式下?如果是,请直接使用原电脑启动游戏。\n或者尝试升级你的显卡驱动到最新版本后再尝试启动游戏。如果你的电脑存在独立显卡,你需要检查游戏是否使用集成/核心显卡启动,如果是,请尝试使用独立显卡启动 HMCL 与游戏。如果仍有问题,你可能需要考虑换一个新显卡或新电脑。
game.crash.reason.openj9=当前游戏无法运行在 OpenJ9 虚拟机上,请你在游戏设置中更换 Hotspot Java 虚拟机,并重新启动游戏。如果没有下载安装,你可以在网上自行下载。
game.crash.reason.out_of_memory=当前游戏因为内存不足,无法继续运行。\n这可能是内存分配太小,或者 Mod 数量过多导致的。\n你可以在游戏设置中调大游戏内存分配值以允许游戏在更大的内存下运行。\n如果仍然出现该错误,你可能需要换一台更好的电脑。
game.crash.reason.processing_of_javaagent_failed=当前游戏因为加载 -javaagent 参数失败,无法继续运行。\n如果你在 Java 虚拟机参数 中添加了相关参数,请检查是否合法正确\n如果你没有添加相关参数或参数确认合法正确,请尝试:\n打开 控制面板 -- 时钟和区域 分类(选项为类别显示才有此选项,没有就跳过) -- 区域 -- 上方的 管理 选项卡 -- 下方的 更改系统区域设置 按钮 -- 在弹出的窗口中将 “使用 Unicode UTF-8 提供全球语言支持” 选项关闭,重启设备后再尝试启动游戏。<a href="https://gitcode.net/chearlai/f/-/raw/master/%E5%85%B3%E9%97%AD_%E4%BD%BF%E7%94%A8_Unicode_UTF-8_%E6%8F%90%E4%BE%9B%E5%85%A8%E7%90%83%E8%AF%AD%E8%A8%80%E6%94%AF%E6%8C%81_.png">操作详情</a>\n可在 <a href="https://discord.gg/jVvC7HfM6U">Discord</a> 或 <a href="https://kook.top/Kx7n3t">KOOK 群</a>寻求帮助
game.crash.reason.resolution_too_high=当前游戏因为材质包分辨率过高,无法继续运行\n你可以更换一个分辨率更低的材质,或者更换一个显存更大的显卡。
game.crash.reason.stacktrace=原因未知,请点击日志按钮查看详细信息。\n下面是一些关键词,其中可能包含 Mod 名称,你可以通过搜索的方式查找有关信息。\n%s
game.crash.reason.too_old_java=当前游戏因为 Java 虚拟机版本过低,无法继续运行。\n你需要在游戏设置中更换 Java %1$s 或更新版本的 Java 虚拟机,并重新启动游戏。如果没有下载安装,你可以点击 <a href="https://docs.microsoft.com/java/openjdk/download">此处</a> 下载微软 JDK。
game.crash.reason.too_old_java=当前游戏因为 Java 虚拟机版本过低,无法继续运行。\n你需要在游戏设置中更换 Java %1$s 或更新版本的 Java 虚拟机,并重新启动游戏。如果没有下载安装,你可以点击 <a href="https://docs.microsoft.com/java/openjdk/download">此处</a> 下载微软 JDK。\n可在 <a href="https://discord.gg/jVvC7HfM6U">Discord</a> 或 <a href="https://kook.top/Kx7n3t">KOOK 群</a>寻求帮助
game.crash.reason.unknown=原因未知,请点击日志按钮查看详细信息!\n<b>!!!请不要将本界面【截图】给他人!!!</b>如果你要求助他人,请你点击左下角导出游戏崩溃信息后将导出的文件发送给他人以供分析!!!
game.crash.reason.unsatisfied_link_error=当前游戏因为缺少本地库,无法继续运行。\n这些本地库缺失:%1$s。\n如果你在游戏设置中修改了本地库路径选项,请你修改回预设模式。\n如果已经在预设模式下,请检查本地库缺失是否是 Mod 引起的,或由 HMCL 引起的。如果你确定是 HMCL 引起的,建议你向我们反馈。\n如果你确实需要自定义本地库路径,你需要保证其中包含缺失的本地库!
game.crash.title=游戏意外退出
@@ -463,7 +469,7 @@ install.installer.liteloader=LiteLoader
install.installer.not_installed=不安装
install.installer.optifine=OptiFine
install.installer.quilt=Quilt
install.installer.quilt-api=Quilt API
install.installer.quilt-api=QSL/QFAPI
install.installer.version=%s
install.modpack=安装整合包
install.new_game=安装新游戏版本
@@ -518,7 +524,7 @@ launcher=启动器
launcher.agreement=用户协议与免责声明
launcher.agreement.accept=同意
launcher.agreement.decline=拒绝
launcher.agreement.hint=同意本软件的用户协议与免责声明以使用本软件!
launcher.agreement.hint=同意本软件的用户协议与免责声明以使用本软件。
launcher.background=背景地址
launcher.background.choose=选择背景路径
launcher.background.classic=经典
@@ -688,43 +694,66 @@ mods.restore=回退
mods.url=官方页面
multiplayer=多人联机
multiplayer.agreement.prompt=多人联机功能由 速聚 提供。使用前,你需要先同意多人联机服务提供方 速聚 的用户协议与免责声明。\n你需要了解,HMCL 仅为 速聚 提供多人联机服务入口,使用中遇到的任何问题由 速聚 负责处理。您在使用多人联机服务过程中所遇到的任何问题与纠纷(包括其付费业务)均与 HMCL 无关,应与 速聚 协商解决。
multiplayer.download=正在下载依赖
multiplayer.download.failed=初始化失败,部分文件未能完成下载
multiplayer.download.success=多人联机初始化完成
multiplayer.download.unsupported=多人联机依赖不支持当前系统或平台
multiplayer.error.failed_get_device=HiPer 无法创建网络设备,可能是HiPer已经启动或缺少管理员权限。
multiplayer.error.failed_load_config=HiPer 初始化失败,可能是配置文件存在问题或证书已失效。
multiplayer.error.file_not_found=找不到 HiPer 程序。该程序应该在进入多人联机页面时完成下载。请重启 HMCL 再试。\n请检查你电脑的杀毒软件是否将 HiPer 标记为病毒,如果是,请恢复 HiPer。
multiplayer.error.session_expired=本次使用时间已结束,若要继续使用,请更新凭证
multiplayer.agreement.prompt=多人联机功能由 速聚 提供。使用前,你需要先同意多人联机服务提供方 速聚 的用户协议与免责声明。\n你需要了解,HMCL 仅为 速聚 提供多人联机服务入口,使用中遇到的任何问题由 速聚 负责处理。\n您在使用多人联机服务过程中所遇到的任何问题与纠纷(包括其付费业务)均与 HMCL 无关,请与 速聚 协商解决。
multiplayer.download=正在下载依赖……
multiplayer.download.failed=初始化失败,部分文件未能完成下载……
multiplayer.download.success=多人联机初始化完成√
multiplayer.download.unsupported=多人联机依赖不支持当前系统或平台!
multiplayer.error.failed_get_device=HiPer 无法创建网络设备,可能是 HiPer 正在运行中。请关闭正在运行中的其他启动器,或通过任务管理器终止 HiPer。
multiplayer.error.failed_load_config=HiPer 初始化失败,可能是联机索引码存在问题或索引码已过期,请检查索引码是否输入正确!你可向多人联机提供方联系寻求帮助。
multiplayer.error.failed_sudo.linux=HiPer 需要管理员权限才能运行,你可以通过设置环境变量 HMCL_ASKPASS 配置 HiPer 如何申请权限。\n若将 HMCL_ASKPASS 设置为 'false',请通过配置 sudoers 文件允许 '%s' 免密获取 root 权限,重启后再次启动 HMCL 即可;\n若将 HMCL_ASKPASS 设置为 'user',请先配置环境变量 SUDO_ASKPASS,HMCL 将使用 sudo --askpass 启动 HiPer (具体请参见 man sudo)。
multiplayer.error.failed_sudo.mac=HiPer 需要管理员权限才能运行。是否要授予 HiPer 管理员权限?\n点击“是”授予 HiPer 管理员权限,然后重启计算机后再次打开启动器即可联机。
multiplayer.error.failed_sudo.windows=HiPer 需要管理员权限才能运行,请使用管理员权限重新启动 HMCL。是否查看教程?
multiplayer.error.file_not_found=已发现 HiPer 有可用的更新,请重新进入多人联机页面以更新 HiPer。
multiplayer.error.session_expired=本次使用时间已结束,若要继续使用,请更换联机索引码
multiplayer.exit=HiPer 意外退出,退出码 %d
multiplayer.hint=多人联机功能处于实验阶段,如果有问题请前往 mcer.cn 反馈
multiplayer.powered_by=本服务由 (<a href="https://mcer.cn">速聚</a>) 授权提供 <a href\="https\://hmcl.huangyuhui.net/api/redirect/multiplayer-agreement">授权协议</a>
multiplayer.help.1=管理员权限打开
multiplayer.help.2=多人联机教程
multiplayer.help.3=创建方帮助
multiplayer.help.4=参与者帮助
multiplayer.help.text=测试能否联机
multiplayer.hint=多人联机服务正在维护中。
multiplayer.hint.details=查看详情
multiplayer.persistence=授权信息管理
multiplayer.persistence.export=将授权信息导出至文件
multiplayer.persistence.export.button=导出授权文件
multiplayer.persistence.export.failed=导出授权文件失败,请检查您所选择的保存路径。
multiplayer.persistence.export.file_not_exists=获取授权文件失败,请检查索引码是否输入正确。
multiplayer.persistence.export.title=选择授权文件保存路径
multiplayer.persistence.hint=此功能为长期授权 (有效期超过 24 小时) 用户提供,如果你正在使用短期授权 (有效期不超过 24 小时),则无需使用本功能。\n当你使用长期授权时,请在获取授权后的 24 小时内使用索引码启动 HiPer,否则 HiPer 将无法获取授权信息。\n随后,你可以通过下方的“导出授权信息”功能保存授权文件。\n请注意妥善保管授权文件,在获取授权 24 小时后,该文件是你的长期授权的唯一凭证,丢失该文件将无法通过索引码进行联机。
multiplayer.persistence.import=从文件导入授权信息
multiplayer.persistence.import.button=导入授权文件
multiplayer.persistence.import.failed=导入授权文件失败。
multiplayer.persistence.import.file_already_exists=授权文件已经存在。
multiplayer.persistence.import.title=选择授权文件
multiplayer.persistence.import.token_not_match=你选择的授权文件可能与索引码不匹配,是否继续导入?
multiplayer.persistence.license_file=授权文件
multiplayer.powered_by=HMCL 多人联机由 (<a href="https://mcer.cn">速聚</a>) 授权提供 <a href\="https://docs.hmcl.net/multiplayer/#%E4%BD%BF%E7%94%A8%E6%8E%88%E6%9D%83">授权协议</a>
multiplayer.report=违法违规举报
multiplayer.token=凭证
multiplayer.token.apply=申请凭证
multiplayer.token.expired=HiPer 证书过期,请重新启动 HMCL 再试。
multiplayer.token.invalid=凭证不正确。
multiplayer.token.malformed=HiPer 配置文件无法解析,请重新启动 HMCL 再试。
multiplayer.token.prompt=你需要凭证才能使用多人联机服务。点击旁边的“申请凭证”查看详情
multiplayer.off=启动 HiPer
multiplayer.off.hint=多人联机服务由 HiPer 提供,你需要先使用管理员权限启动 HMCL(具体操作方法详见左侧的 帮助),然后输入凭证启动 HiPer 以使用多人联机服务。
multiplayer.token=索引码
multiplayer.token.apply=获取联机索引码
multiplayer.token.expired=HiPer 证书过期,请更换联机索引码!
multiplayer.token.format_invalid=索引码格式不正确
multiplayer.token.invalid=索引码不正确。
multiplayer.token.malformed=HiPer 配置文件无法解析,可能是输入的联机索引码有误,或是获取证书服务器宕机。\n请检查输入的联机索引码!你可向多人联机提供方联系寻求帮助。
multiplayer.token.prompt=你需要联机索引码才能使用多人联机!点击“获取联机索引码”查看详情
multiplayer.off.hint=由于需要注册系统网络服务权限,启动 HiPer 时将会向用户申请管理员权限。若出现认证提示,允许以启动 HiPer。
multiplayer.off.start=启动 HiPer
multiplayer.on=HiPer
multiplayer.master=创建方提示
multiplayer.master.hint=1.启动游戏\n2.选择单人游戏模式进入一个存档\n3.在游戏选项菜单内选择 对局域网开放 选项,之后你可以在游戏聊天框内看到游戏提示的端口号(通常是 5 位数字)\n4.点击下方的生成服务器地址按钮,输入端口号,你就可以获得你的服务器地址了\n5.该地址需要提供给其他需要加入服务器的玩家用于添加服务器。
multiplayer.master.hint=1.启动游戏\n2.选择单人游戏模式进入一个存档\n3.在游戏选项菜单内选择 对局域网开放 选项,之后你可以在游戏聊天框内看到游戏提示的端口号(通常是 4~5 位数字)\n4.点击下方的生成服务器地址按钮,输入端口号,你就可以获得你的服务器地址了\n5.该地址需要提供给其他需要加入服务器的玩家用于添加服务器。
multiplayer.master.server_address=生成服务器地址
multiplayer.master.server_address.copy=拷贝
multiplayer.master.video_tutorial=教学视频
multiplayer.master.port=端口号
multiplayer.master.video_tutorial=创建方视频教程
multiplayer.master.port=游戏局域网开放端口号
multiplayer.master.port.validate=在游戏聊天框中出现的端口号 (0~65535)
multiplayer.slave=参与者提示
multiplayer.slave.hint=1.要求创建方按照上方的 创建方提示 操作\n2.启动游戏\n3.选择多人游戏模式,选择添加服务器\n4.游戏会要求你输入服务器地址,你只需要向创建方索要服务器地址并输入,并进入服务器即可。\n- 注意:\n1.一般情况下,参与者的游戏账户必须是 微软账户 或 外置登录账户(如 Little Skin),否则你需要将服务器地址输入至下方的输入框中并点击广播,在游戏中选择多人游戏模式,进入局域网世界方可加入,具体操作方法详见左侧的 帮助 \n2.一般情况下,参与者的游戏版本、模组要必须与创建方的一致,否则加入失败。
multiplayer.slave.hint=1.要求创建方按照上方的 创建方提示 操作\n2.启动游戏\n3.选择多人游戏模式,选择添加服务器\n4.游戏会要求你输入服务器地址,你只需要向创建方索要服务器地址并输入,并进入服务器即可。
multiplayer.slave.hint2=1.一般情况下,参与者的游戏账户必须是 微软账户 或 外置登录账户(如 Little Skin),否则你需要将服务器地址输入至下方的输入框中并点击“加入”,在游戏中选择多人游戏模式,进入局域网世界方可加入,具体操作方法详见左侧的 帮助 \n2.一般情况下,参与者的游戏版本、模组要必须与创建方的一致,否则加入失败。
multiplayer.slave.server_address=创建方服务器地址
multiplayer.slave.server_address.start=加入
multiplayer.slave.server_address.stop=退出
multiplayer.slave.video_tutorial=视频教程
multiplayer.session.expiration=本次使用截止时间
multiplayer.slave.video_tutorial=参与者视频教程
multiplayer.session.expiration=索引码到期时间
datapack=数据包
datapack.add=添加数据包
@@ -30,16 +30,21 @@ import java.util.UUID;
*/
@Immutable
public class AuthInfo implements AutoCloseable {
public static final String USER_TYPE_MOJANG = "mojang";
public static final String USER_TYPE_LEGACY = "legacy";
private final String username;
private final UUID uuid;
private final String accessToken;
private final String userType;
private final String userProperties;
public AuthInfo(String username, UUID uuid, String accessToken, String userProperties) {
public AuthInfo(String username, UUID uuid, String accessToken, String userType, String userProperties) {
this.username = username;
this.uuid = uuid;
this.accessToken = accessToken;
this.userType = userType;
this.userProperties = userProperties;
}
@@ -55,6 +60,10 @@ public class AuthInfo implements AutoCloseable {
return accessToken;
}
public String getUserType() {
return userType;
}
/**
* Properties of this user.
* Don't know the difference between user properties and user property map.
@@ -120,7 +120,7 @@ public class AuthlibInjectorAccount extends YggdrasilAccount {
private final String prefetchedMeta;
public AuthlibInjectorAuthInfo(AuthInfo authInfo, AuthlibInjectorArtifactInfo artifact, AuthlibInjectorServer server, String prefetchedMeta) {
super(authInfo.getUsername(), authInfo.getUUID(), authInfo.getAccessToken(), authInfo.getUserProperties());
super(authInfo.getUsername(), authInfo.getUUID(), authInfo.getAccessToken(), authInfo.getUserType(), authInfo.getUserProperties());
this.artifact = artifact;
this.server = server;
@@ -110,7 +110,7 @@ public class MicrosoftSession {
public AuthInfo toAuthInfo() {
requireNonNull(profile);
return new AuthInfo(profile.getName(), profile.getId(), accessToken, "{}");
return new AuthInfo(profile.getName(), profile.getId(), accessToken, AuthInfo.USER_TYPE_MOJANG, "{}");
}
public static class User {
@@ -67,6 +67,10 @@ public class OfflineAccount extends Account {
}
}
public AuthlibInjectorArtifactProvider getDownloader() {
return downloader;
}
@Override
public UUID getUUID() {
return uuid;
@@ -91,7 +95,7 @@ public class OfflineAccount extends Account {
invalidate();
}
private boolean loadAuthlibInjector(Skin skin) {
protected boolean loadAuthlibInjector(Skin skin) {
if (skin == null) return false;
if (skin.getType() == Skin.Type.DEFAULT) return false;
TextureModel defaultModel = TextureModel.detectUUID(getUUID());
@@ -104,7 +108,8 @@ public class OfflineAccount extends Account {
@Override
public AuthInfo logIn() throws AuthenticationException {
AuthInfo authInfo = new AuthInfo(username, uuid, UUIDTypeAdapter.fromUUID(UUID.randomUUID()), "{}");
// Using "legacy" user type here because "mojang" user type may cause "invalid session token" or "disconnected" when connecting to a game server.
AuthInfo authInfo = new AuthInfo(username, uuid, UUIDTypeAdapter.fromUUID(UUID.randomUUID()), AuthInfo.USER_TYPE_LEGACY, "{}");
if (loadAuthlibInjector(skin)) {
CompletableFuture<AuthlibInjectorArtifactInfo> artifactTask = CompletableFuture.supplyAsync(() -> {
@@ -144,7 +149,7 @@ public class OfflineAccount extends Account {
private YggdrasilServer server;
public OfflineAuthInfo(AuthInfo authInfo, AuthlibInjectorArtifactInfo artifact) {
super(authInfo.getUsername(), authInfo.getUUID(), authInfo.getAccessToken(), authInfo.getUserProperties());
super(authInfo.getUsername(), authInfo.getUUID(), authInfo.getAccessToken(), USER_TYPE_LEGACY, authInfo.getUserProperties());
this.artifact = artifact;
}
@@ -157,7 +162,8 @@ public class OfflineAccount extends Account {
server.start();
try {
server.addCharacter(new YggdrasilServer.Character(uuid, username, skin.load(username).run()));
server.addCharacter(new YggdrasilServer.Character(uuid, username,
skin != null ? skin.load(username).run() : null));
} catch (IOException e) {
// ignore
} catch (Exception e) {
@@ -48,8 +48,15 @@ public class Skin {
public enum Type {
DEFAULT,
STEVE,
ALEX,
ARI,
EFE,
KAI,
MAKENA,
NOOR,
STEVE,
SUNNY,
ZURI,
LOCAL_FILE,
LITTLE_SKIN,
CUSTOM_SKIN_LOADER_API,
@@ -59,10 +66,24 @@ public class Skin {
switch (type) {
case "default":
return DEFAULT;
case "steve":
return STEVE;
case "alex":
return ALEX;
case "ari":
return ARI;
case "efe":
return EFE;
case "kai":
return KAI;
case "makena":
return MAKENA;
case "noor":
return NOOR;
case "steve":
return STEVE;
case "sunny":
return SUNNY;
case "zuri":
return ZURI;
case "local_file":
return LOCAL_FILE;
case "little_skin":
@@ -115,10 +136,24 @@ public class Skin {
switch (type) {
case DEFAULT:
return Task.supplyAsync(() -> null);
case STEVE:
return Task.supplyAsync(() -> new LoadedSkin(TextureModel.STEVE, Texture.loadTexture(Skin.class.getResourceAsStream("/assets/img/steve.png")), null));
case ALEX:
return Task.supplyAsync(() -> new LoadedSkin(TextureModel.ALEX, Texture.loadTexture(Skin.class.getResourceAsStream("/assets/img/alex.png")), null));
return Task.supplyAsync(() -> new LoadedSkin(TextureModel.ALEX, Texture.loadTexture(Skin.class.getResourceAsStream("/assets/img/skin/alex.png")), null));
case ARI:
return Task.supplyAsync(() -> new LoadedSkin(TextureModel.STEVE, Texture.loadTexture(Skin.class.getResourceAsStream("/assets/img/skin/ari.png")), null));
case EFE:
return Task.supplyAsync(() -> new LoadedSkin(TextureModel.ALEX, Texture.loadTexture(Skin.class.getResourceAsStream("/assets/img/skin/efe.png")), null));
case KAI:
return Task.supplyAsync(() -> new LoadedSkin(TextureModel.STEVE, Texture.loadTexture(Skin.class.getResourceAsStream("/assets/img/skin/kai.png")), null));
case MAKENA:
return Task.supplyAsync(() -> new LoadedSkin(TextureModel.ALEX, Texture.loadTexture(Skin.class.getResourceAsStream("/assets/img/skin/makena.png")), null));
case NOOR:
return Task.supplyAsync(() -> new LoadedSkin(TextureModel.ALEX, Texture.loadTexture(Skin.class.getResourceAsStream("/assets/img/skin/noor.png")), null));
case STEVE:
return Task.supplyAsync(() -> new LoadedSkin(TextureModel.STEVE, Texture.loadTexture(Skin.class.getResourceAsStream("/assets/img/skin/steve.png")), null));
case SUNNY:
return Task.supplyAsync(() -> new LoadedSkin(TextureModel.STEVE, Texture.loadTexture(Skin.class.getResourceAsStream("/assets/img/skin/sunny.png")), null));
case ZURI:
return Task.supplyAsync(() -> new LoadedSkin(TextureModel.STEVE, Texture.loadTexture(Skin.class.getResourceAsStream("/assets/img/skin/zuri.png")), null));
case LOCAL_FILE:
return Task.supplyAsync(() -> {
Texture skin = null, cape = null;
@@ -104,7 +104,7 @@ public class YggdrasilSession {
if (selectedProfile == null)
throw new IllegalStateException("No character is selected");
return new AuthInfo(selectedProfile.getName(), selectedProfile.getId(), accessToken,
return new AuthInfo(selectedProfile.getName(), selectedProfile.getId(), accessToken, AuthInfo.USER_TYPE_MOJANG,
Optional.ofNullable(userProperties)
.map(properties -> properties.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey,
@@ -84,6 +84,8 @@ public final class CrashReportAnalyzer {
MODLAUNCHER_8(Pattern.compile("java\\.lang\\.NoSuchMethodError: ('void sun\\.security\\.util\\.ManifestEntryVerifier\\.<init>\\(java\\.util\\.jar\\.Manifest\\)'|sun\\.security\\.util\\.ManifestEntryVerifier\\.<init>\\(Ljava/util/jar/Manifest;\\)V)")),
// Manually triggerd debug crash
DEBUG_CRASH(Pattern.compile("Manually triggered debug crash")),
//https://github.com/huanghongxun/HMCL/issues/1780
PROCESSING_OF_JAVAAGENT_FAILED(Pattern.compile("processing of -javaagent failed")),
CONFIG(Pattern.compile("Failed loading config file (?<file>.*?) of type SERVER for modid (?<id>.*)"), "id", "file"),
// Fabric gives some warnings
FABRIC_WARNINGS(Pattern.compile("Warnings were found!(.*?)[\\n\\r]+(?<reason>[^\\[]+)\\["), "reason"),
@@ -108,24 +108,26 @@ public class DefaultLauncher extends Launcher {
res.addAllWithoutParsing(options.getJavaArguments());
Charset encoding = StandardCharsets.UTF_8;
Charset encoding = OperatingSystem.NATIVE_CHARSET;
if (options.getJava().getParsedVersion() < JavaVersion.JAVA_8) {
try {
String fileEncoding = res.addDefault("-Dfile.encoding=", encoding.name());
if (fileEncoding != null)
encoding = Charset.forName(fileEncoding.substring("-Dfile.encoding=".length()));
} catch (Throwable ex) {
encoding = OperatingSystem.NATIVE_CHARSET;
LOG.log(Level.WARNING, "Bad file encoding", ex);
}
} else {
res.addDefault("-Dfile.encoding=", "UTF-8");
if (options.getJava().getParsedVersion() > JavaVersion.JAVA_17
&& VersionNumber.VERSION_COMPARATOR.compare(repository.getGameVersion(version).orElse("1.13"), "1.13") < 0) {
res.addDefault("-Dfile.encoding=", "COMPAT");
}
try {
String stdoutEncoding = res.addDefault("-Dsun.stdout.encoding=", encoding.name());
if (stdoutEncoding != null)
encoding = Charset.forName(stdoutEncoding.substring("-Dsun.stdout.encoding=".length()));
} catch (Throwable ex) {
encoding = OperatingSystem.NATIVE_CHARSET;
LOG.log(Level.WARNING, "Bad stdout encoding", ex);
}
@@ -399,7 +401,7 @@ public class DefaultLauncher extends Launcher {
pair("${profile_name}", Optional.ofNullable(options.getProfileName()).orElse("Minecraft")),
pair("${version_type}", Optional.ofNullable(options.getVersionType()).orElse(version.getType().getId())),
pair("${game_directory}", repository.getRunDirectory(version.getId()).getAbsolutePath()),
pair("${user_type}", "mojang"),
pair("${user_type}", authInfo.getUserType()),
pair("${assets_index_name}", version.getAssetIndex().getId()),
pair("${user_properties}", authInfo.getUserProperties()),
pair("${resolution_width}", options.getWidth().toString()),
@@ -41,12 +41,7 @@ public final class CurseForgeRemoteModRepository implements RemoteModRepository
private static final String PREFIX = "https://api.curseforge.com";
private static String apiKey;
static {
apiKey = System.getProperty("hmcl.curseforge.apikey",
JarUtils.thisJar().flatMap(JarUtils::getManifest).map(manifest -> manifest.getMainAttributes().getValue("CurseForge-Api-Key")).orElse(""));
}
private static final String apiKey = System.getProperty("hmcl.curseforge.apikey", JarUtils.getManifestAttribute("CurseForge-Api-Key", ""));
private final Type type;
private final int section;
@@ -17,6 +17,7 @@
*/
package org.jackhuang.hmcl.task;
import org.jackhuang.hmcl.util.Hex;
import org.jackhuang.hmcl.util.Logging;
import org.jackhuang.hmcl.util.io.ChecksumMismatchException;
import org.jackhuang.hmcl.util.io.CompressingUtils;
@@ -25,7 +26,6 @@ import org.jackhuang.hmcl.util.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.math.BigInteger;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.FileSystem;
@@ -72,7 +72,7 @@ public class FileDownloadTask extends FetchTask<Void> {
}
public void performCheck(MessageDigest digest) throws ChecksumMismatchException {
String actualChecksum = String.format("%1$040x", new BigInteger(1, digest.digest()));
String actualChecksum = Hex.encodeHex(digest.digest());
if (!checksum.equalsIgnoreCase(actualChecksum)) {
throw new ChecksumMismatchException(algorithm, checksum, actualChecksum);
}
@@ -67,6 +67,9 @@ public final class Logging {
});
try {
if (Files.isRegularFile(logFolder))
Files.delete(logFolder);
Files.createDirectories(logFolder);
FileHandler fileHandler = new FileHandler(logFolder.resolve("hmcl.log").toAbsolutePath().toString());
fileHandler.setLevel(Level.FINEST);
@@ -74,7 +77,7 @@ public final class Logging {
fileHandler.setEncoding("UTF-8");
LOG.addHandler(fileHandler);
} catch (IOException e) {
System.err.println("Unable to create hmcl.log, " + e.getMessage());
System.err.println("Unable to create hmcl.log\n" + StringUtils.getStackTrace(e));
}
ConsoleHandler consoleHandler = new ConsoleHandler();
@@ -260,6 +260,16 @@ public final class StringUtils {
return US_ASCII_ENCODER.canEncode(cs);
}
public static boolean isAlphabeticOrNumber(String str) {
int length = str.length();
for (int i = 0; i < length; i++) {
char ch = str.charAt(i);
if (!(ch >= '0' && ch <= '9') && !(ch >= 'a' && ch <= 'z') && !(ch >= 'A' && ch <= 'Z'))
return false;
}
return true;
}
/**
* Class for computing the longest common subsequence between strings.
*/
@@ -18,14 +18,13 @@
package org.jackhuang.hmcl.util.io;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.CodeSource;
import java.util.Optional;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
@@ -34,22 +33,45 @@ public final class JarUtils {
}
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
private static final Optional<Path> THIS_JAR =
Optional.ofNullable(JarUtils.class.getProtectionDomain().getCodeSource())
.map(CodeSource::getLocation)
.map(url -> {
try {
return Paths.get(url.toURI());
} catch (FileSystemNotFoundException | IllegalArgumentException | URISyntaxException e) {
return null;
}
})
.filter(Files::isRegularFile);
private static final Optional<Path> THIS_JAR;
private static final Manifest manifest;
static {
THIS_JAR = Optional.ofNullable(JarUtils.class.getProtectionDomain().getCodeSource())
.map(codeSource -> {
try {
return Paths.get(codeSource.getLocation().toURI());
} catch (FileSystemNotFoundException | IllegalArgumentException | URISyntaxException e) {
return null;
}
})
.filter(Files::isRegularFile);
Manifest mf = null;
try (InputStream input = JarUtils.class.getResourceAsStream("/META-INF/MANIFEST.MF")) {
if (input != null)
mf = new Manifest(input);
} catch (IOException e) {
// Logger has not started
e.printStackTrace();
}
if (mf == null)
mf = THIS_JAR.flatMap(JarUtils::getManifest).orElseGet(Manifest::new);
manifest = mf;
}
public static Optional<Path> thisJar() {
return THIS_JAR;
}
public static String getManifestAttribute(String name, String defaultValue) {
String value = manifest.getMainAttributes().getValue(name);
return value != null ? value : defaultValue;
}
public static Optional<Manifest> getManifest(Path jar) {
try (JarFile file = new JarFile(jar.toFile())) {
return Optional.ofNullable(file.getManifest());
@@ -57,9 +79,4 @@ public final class JarUtils {
return Optional.empty();
}
}
public static Optional<String> getImplementationVersion(Path jar) {
return Optional.of(jar).flatMap(JarUtils::getManifest)
.flatMap(manifest -> Optional.ofNullable(manifest.getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION)));
}
}
@@ -47,22 +47,22 @@ public abstract class BindingMapping<T, U> extends ObjectBinding<U> {
return of(Bindings.createObjectBinding(() -> mapper.apply(watched), watched));
}
protected final ObservableValue<T> predecessor;
protected final ObservableValue<? extends T> predecessor;
public BindingMapping(ObservableValue<T> predecessor) {
public BindingMapping(ObservableValue<? extends T> predecessor) {
this.predecessor = requireNonNull(predecessor);
bind(predecessor);
}
public <V> BindingMapping<?, V> map(Function<U, V> mapper) {
public <V> BindingMapping<?, V> map(Function<? super U, ? extends V> mapper) {
return new MappedBinding<>(this, mapper);
}
public <V> BindingMapping<?, V> flatMap(Function<U, ? extends ObservableValue<V>> mapper) {
public <V> BindingMapping<?, V> flatMap(Function<? super U, ? extends ObservableValue<? extends V>> mapper) {
return flatMap(mapper, null);
}
public <V> BindingMapping<?, V> flatMap(Function<U, ? extends ObservableValue<V>> mapper, Supplier<V> nullAlternative) {
public <V> BindingMapping<?, V> flatMap(Function<? super U, ? extends ObservableValue<? extends V>> mapper, Supplier<? extends V> nullAlternative) {
return new FlatMappedBinding<>(map(mapper), nullAlternative);
}
@@ -82,7 +82,7 @@ public abstract class BindingMapping<T, U> extends ObjectBinding<U> {
}
@Override
public <V> BindingMapping<?, V> map(Function<T, V> mapper) {
public <V> BindingMapping<?, V> map(Function<? super T, ? extends V> mapper) {
return new MappedBinding<>(predecessor, mapper);
}
@@ -94,9 +94,9 @@ public abstract class BindingMapping<T, U> extends ObjectBinding<U> {
private static class MappedBinding<T, U> extends BindingMapping<T, U> {
private final Function<T, U> mapper;
private final Function<? super T, ? extends U> mapper;
public MappedBinding(ObservableValue<T> predecessor, Function<T, U> mapper) {
public MappedBinding(ObservableValue<? extends T> predecessor, Function<? super T, ? extends U> mapper) {
super(predecessor);
this.mapper = mapper;
}
@@ -107,12 +107,12 @@ public abstract class BindingMapping<T, U> extends ObjectBinding<U> {
}
}
private static class FlatMappedBinding<T extends ObservableValue<U>, U> extends BindingMapping<T, U> {
private static class FlatMappedBinding<T extends ObservableValue<? extends U>, U> extends BindingMapping<T, U> {
private final Supplier<U> nullAlternative;
private final Supplier<? extends U> nullAlternative;
private T lastObservable = null;
public FlatMappedBinding(ObservableValue<T> predecessor, Supplier<U> nullAlternative) {
public FlatMappedBinding(ObservableValue<? extends T> predecessor, Supplier<? extends U> nullAlternative) {
super(predecessor);
this.nullAlternative = nullAlternative;
}
@@ -148,11 +148,11 @@ public abstract class BindingMapping<T, U> extends ObjectBinding<U> {
private T prev;
private U value;
private final Function<T, CompletableFuture<U>> mapper;
private final Function<? super T, ? extends CompletableFuture<? extends U>> mapper;
private T computingPrev;
private boolean computing = false;
public AsyncMappedBinding(ObservableValue<T> predecessor, Function<T, CompletableFuture<U>> mapper, U initial) {
public AsyncMappedBinding(ObservableValue<? extends T> predecessor, Function<? super T, ? extends CompletableFuture<? extends U>> mapper, U initial) {
super(predecessor);
this.value = initial;
this.mapper = mapper;
@@ -168,7 +168,7 @@ public abstract class BindingMapping<T, U> extends ObjectBinding<U> {
computingPrev = currentPrev;
}
CompletableFuture<U> task;
CompletableFuture<? extends U> task;
try {
task = requireNonNull(mapper.apply(currentPrev));
} catch (Throwable e) {
@@ -46,7 +46,8 @@ public enum Architecture {
PPC64LE(BIT_64, "PowerPC-64 (Little-Endian)"),
S390(BIT_32),
S390X(BIT_64, "S390x"),
RISCV(BIT_64, "RISC-V"),
RISCV32(BIT_32, "RISC-V (32 Bit)"),
RISCV64(BIT_64, "RISC-V"),
LOONGARCH32(BIT_32, "LoongArch32"),
LOONGARCH64_OW(BIT_64, "LoongArch64 (old world)"),
LOONGARCH64(BIT_64, "LoongArch64"),
@@ -140,7 +141,8 @@ public enum Architecture {
return MIPSEL;
case "riscv":
case "risc-v":
return RISCV;
case "riscv64":
return RISCV64;
case "ia64":
case "ia64w":
case "itanium64":
@@ -131,11 +131,11 @@ public class ManagedProcess {
}
public synchronized void pumpInputStream(Consumer<String> onLogLine) {
addRelatedThread(Lang.thread(new StreamPump(process.getInputStream(), onLogLine), "ProcessInputStreamPump", true));
addRelatedThread(Lang.thread(new StreamPump(process.getInputStream(), onLogLine, OperatingSystem.NATIVE_CHARSET), "ProcessInputStreamPump", true));
}
public synchronized void pumpErrorStream(Consumer<String> onLogLine) {
addRelatedThread(Lang.thread(new StreamPump(process.getErrorStream(), onLogLine), "ProcessErrorStreamPump", true));
addRelatedThread(Lang.thread(new StreamPump(process.getErrorStream(), onLogLine, OperatingSystem.NATIVE_CHARSET), "ProcessErrorStreamPump", true));
}
/**
@@ -256,6 +256,7 @@ public enum OperatingSystem {
return Optional.empty();
}
@SuppressWarnings("removal")
public static void forceGC() {
System.gc();
try {
@@ -0,0 +1,8 @@
Exception in thread "main" java.lang.ClassNotFoundException: org.glavo.log4j.patch.agent.Log4jAgent
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
FATAL ERROR in native method: processing of -javaagent failed
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)