Skip to content

Commit

Permalink
Merge remote-tracking branch 'official/main' into support3093/depreca…
Browse files Browse the repository at this point in the history
…te-custom-version-folder
  • Loading branch information
burningtnt committed Aug 31, 2024
2 parents c111f47 + 48417b9 commit 8b80373
Show file tree
Hide file tree
Showing 52 changed files with 2,862 additions and 1,616 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body:
value: |
提交前请确认:
* 该问题确实是 **HMCL 的错误**,而**不是 Minecraft 非正常退出**,如果你的 Minecraft 非正常退出,请前往 [QQ 群](https://docs.hmcl.net/groups.html)/[Discord 频道](https://discord.gg/jVvC7HfM6U) 中获取帮助。
* 你的启动器版本是**最新的快照版本**,可以点击 [此处](https://github.com/burningtnt/HMCL-Snapshot-Update/raw/master/datas/HMCL-dev.jar) 下载最新快照版本。
* 你的启动器版本是**最新的快照版本**,可以点击 [此处](https://zkitefly.github.io/HMCL-Snapshot-Update/) 下载最新快照版本。
如果你的问题并不属于上述两类,你可以选取另一种 Issue 类型,或者直接前往 [QQ 群](https://docs.hmcl.net/groups.html)/[Discord 频道](https://discord.gg/jVvC7HfM6U) 中获取帮助。

Expand Down
86 changes: 0 additions & 86 deletions HMCL/src/main/java/org/jackhuang/hmcl/countly/Countly.java

This file was deleted.

56 changes: 0 additions & 56 deletions HMCL/src/main/java/org/jackhuang/hmcl/countly/CrashReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,25 @@
import org.jackhuang.hmcl.util.platform.Architecture;
import org.jackhuang.hmcl.util.platform.OperatingSystem;

import java.io.File;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Map;

import static org.jackhuang.hmcl.util.Lang.mapOf;
import static org.jackhuang.hmcl.util.Pair.pair;
import static org.jackhuang.hmcl.util.logging.Logger.LOG;

public class CrashReport {

private final Thread thread;
private final Throwable throwable;
private final String stackTrace;

private boolean nonFatal;

public CrashReport(Thread thread, Throwable throwable) {
this.thread = thread;
this.throwable = throwable;
stackTrace = StringUtils.getStackTrace(throwable);
nonFatal = false;
}

public Throwable getThrowable() {
return this.throwable;
}

public CrashReport setNonFatal() {
nonFatal = true;
return this;
}

public boolean shouldBeReport() {
if (!stackTrace.contains("org.jackhuang"))
return false;
Expand All @@ -48,23 +34,6 @@ public boolean shouldBeReport() {
return true;
}

public Map<String, Object> getMetrics(long runningTime) {
return mapOf(
pair("_run", runningTime),
pair("_app_version", Metadata.VERSION),
pair("_os", OperatingSystem.SYSTEM_NAME),
pair("_os_version", OperatingSystem.SYSTEM_VERSION),
pair("_disk_current", getDiskAvailable()),
pair("_disk_total", getDiskTotal()),
pair("_ram_current", getMemoryAvailable()),
pair("_ram_total", Runtime.getRuntime().maxMemory() / BYTES_IN_MB),
pair("_error", stackTrace),
pair("_logs", LOG.getLogs()),
pair("_name", throwable.getLocalizedMessage()),
pair("_nonfatal", nonFatal)
);
}

public String getDisplayText() {
return "---- Hello Minecraft! Crash Report ----\n" +
" Version: " + Metadata.VERSION + "\n" +
Expand All @@ -82,29 +51,4 @@ public String getDisplayText() {
" JVM Total Memory: " + Runtime.getRuntime().totalMemory() + "\n" +
" JVM Free Memory: " + Runtime.getRuntime().freeMemory() + "\n";
}

private static final Long BYTES_IN_MB = 1024L * 1024;

private static long getMemoryAvailable() {
Long total = Runtime.getRuntime().totalMemory();
Long availMem = Runtime.getRuntime().freeMemory();
return (total - availMem) / BYTES_IN_MB;
}

private static long getDiskAvailable() {
long total = 0, free = 0;
for (File f : File.listRoots()) {
total += f.getTotalSpace();
free += f.getUsableSpace();
}
return (total - free) / BYTES_IN_MB;
}

private static long getDiskTotal() {
long total = 0;
for (File f : File.listRoots()) {
total += f.getTotalSpace();
}
return total / BYTES_IN_MB;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public void onStop(boolean success, TaskExecutor executor) {
launchingStepsPane.fireEvent(new DialogCloseEvent());
if (!success) {
Exception ex = executor.getException();
if (!(ex instanceof CancellationException)) {
if (ex != null && !(ex instanceof CancellationException)) {
String message;
if (ex instanceof ModpackCompletionException) {
if (ex.getCause() instanceof FileNotFoundException)
Expand Down
38 changes: 0 additions & 38 deletions HMCL/src/main/java/org/jackhuang/hmcl/game/LoadingState.java

This file was deleted.

11 changes: 8 additions & 3 deletions HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,19 @@
import static org.jackhuang.hmcl.ui.FXUtils.onInvalidating;
import static org.jackhuang.hmcl.util.Lang.immutableListOf;
import static org.jackhuang.hmcl.util.Lang.mapOf;
import static org.jackhuang.hmcl.util.logging.Logger.LOG;
import static org.jackhuang.hmcl.util.Pair.pair;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
import static org.jackhuang.hmcl.util.logging.Logger.LOG;

/**
* @author huangyuhui
*/
public final class Accounts {
private Accounts() {}
private Accounts() {
}

private static final AuthlibInjectorArtifactProvider AUTHLIB_INJECTOR_DOWNLOADER = createAuthlibInjectorArtifactProvider();

private static void triggerAuthlibInjectorUpdateCheck() {
if (AUTHLIB_INJECTOR_DOWNLOADER instanceof AuthlibInjectorDownloader) {
Schedulers.io().execute(() -> {
Expand All @@ -87,6 +89,7 @@ private static void triggerAuthlibInjectorUpdateCheck() {
// ==== login type / account factory mapping ====
private static final Map<String, AccountFactory<?>> type2factory = new HashMap<>();
private static final Map<AccountFactory<?>, String> factory2type = new HashMap<>();

static {
type2factory.put("offline", FACTORY_OFFLINE);
type2factory.put("authlibInjector", FACTORY_AUTHLIB_INJECTOR);
Expand Down Expand Up @@ -130,7 +133,7 @@ else if (account instanceof MicrosoftAccount)
private static final String GLOBAL_PREFIX = "$GLOBAL:";
private static final ObservableList<Map<Object, Object>> globalAccountStorages = FXCollections.observableArrayList();

private static final ObservableList<Account> accounts = observableArrayList(account -> new Observable[] { account });
private static final ObservableList<Account> accounts = observableArrayList(account -> new Observable[]{account});
private static final ObjectProperty<Account> selectedAccount = new SimpleObjectProperty<>(Accounts.class, "selectedAccount");

/**
Expand Down Expand Up @@ -465,6 +468,8 @@ public static String localizeErrorMessage(Exception exception) {
} else {
return i18n("account.methods.microsoft.error.unknown", errorCode);
}
} else if (exception instanceof MicrosoftService.XBox400Exception) {
return i18n("account.methods.microsoft.error.wrong_verify_method");
} else if (exception instanceof MicrosoftService.NoMinecraftJavaEditionProfileException) {
return i18n("account.methods.microsoft.error.no_character");
} else if (exception instanceof MicrosoftService.NoXuiException) {
Expand Down
5 changes: 4 additions & 1 deletion HMCL/src/main/java/org/jackhuang/hmcl/setting/Theme.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ public Color getForegroundColor() {
public String[] getStylesheets(String overrideFontFamily) {
String css = "/assets/css/blue.css";

String fontFamily = System.getProperty("hmcl.font.override", overrideFontFamily);
String fontFamily = overrideFontFamily == null
? System.getProperty("hmcl.font.override", System.getenv("HMCL_FONT"))
: overrideFontFamily;

String fontStyle = null;
if (fontFamily == null) {
Optional<Font> font = tryLoadFont();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ private final class View extends VBox {

TwoLineListItem version = new TwoLineListItem();
version.getStyleClass().setAll("two-line-item-second-large");
version.setTitle(i18n("archive.game_version"));
version.setTitle(i18n("game.version"));
version.setSubtitle(GameCrashWindow.this.version.getId());

TwoLineListItem total_memory = new TwoLineListItem();
Expand Down
Loading

0 comments on commit 8b80373

Please sign in to comment.