mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-15 23:06:07 -04:00
fix: tasks with default name will not be displayed
This commit is contained in:
parent
5c25ab3eda
commit
0a68e52fca
@ -128,12 +128,12 @@ public final class LauncherHelper {
|
||||
Optional<String> gameVersion = GameVersion.minecraftVersion(repository.getVersionJar(version));
|
||||
|
||||
TaskExecutor executor = Task.allOf(
|
||||
Task.composeAsync(null, () -> {
|
||||
Task.composeAsync(() -> {
|
||||
if (setting.isNotCheckGame())
|
||||
return null;
|
||||
else
|
||||
return dependencyManager.checkGameCompletionAsync(version, repository.unmarkVersionLaunchedAbnormally(selectedVersion));
|
||||
}), Task.composeAsync(null, () -> {
|
||||
}), Task.composeAsync(() -> {
|
||||
try {
|
||||
ModpackConfiguration<?> configuration = ModpackHelper.readModpackConfiguration(repository.getModpackConfiguration(selectedVersion));
|
||||
if ("Curse".equals(configuration.getType()))
|
||||
@ -146,7 +146,7 @@ public final class LauncherHelper {
|
||||
return null;
|
||||
}
|
||||
})).withStage("launch.state.dependencies")
|
||||
.thenComposeAsync(Task.supplyAsync((String) null, () -> {
|
||||
.thenComposeAsync(Task.supplyAsync(() -> {
|
||||
try {
|
||||
return account.logIn();
|
||||
} catch (CredentialExpiredException e) {
|
||||
@ -157,7 +157,7 @@ public final class LauncherHelper {
|
||||
return account.playOffline().orElseThrow(() -> e);
|
||||
}
|
||||
}).withStage("launch.state.logging_in"))
|
||||
.thenComposeAsync(authInfo -> Task.supplyAsync((String) null, () -> {
|
||||
.thenComposeAsync(authInfo -> Task.supplyAsync(() -> {
|
||||
return new HMCLGameLauncher(
|
||||
repository,
|
||||
version.getPatches().isEmpty() ? repository.getResolvedVersion(selectedVersion) : version,
|
||||
@ -169,9 +169,9 @@ public final class LauncherHelper {
|
||||
);
|
||||
}).thenComposeAsync(launcher -> { // launcher is prev task's result
|
||||
if (scriptFile == null) {
|
||||
return Task.supplyAsync((String) null, launcher::launch);
|
||||
return Task.supplyAsync(launcher::launch);
|
||||
} else {
|
||||
return Task.supplyAsync((String) null, () -> {
|
||||
return Task.supplyAsync(() -> {
|
||||
launcher.makeLaunchScript(scriptFile);
|
||||
return null;
|
||||
});
|
||||
@ -192,7 +192,7 @@ public final class LauncherHelper {
|
||||
Controllers.dialog(i18n("version.launch_script.success", scriptFile.getAbsolutePath()));
|
||||
});
|
||||
}
|
||||
}).thenRunAsync(null, Schedulers.defaultScheduler(), () -> {
|
||||
}).thenRunAsync(Schedulers.defaultScheduler(), () -> {
|
||||
launchingLatch = new CountDownLatch(1);
|
||||
launchingLatch.await();
|
||||
}).withStage("launch.state.waiting_launching"))
|
||||
|
@ -86,7 +86,7 @@ public abstract class VersionList<T extends RemoteVersion> {
|
||||
}
|
||||
|
||||
public Task<?> loadAsync(String gameVersion) {
|
||||
return Task.composeAsync(null, () -> {
|
||||
return Task.composeAsync(() -> {
|
||||
lock.readLock().lock();
|
||||
boolean loaded;
|
||||
|
||||
|
@ -63,8 +63,9 @@ public abstract class Task<T> {
|
||||
return significance;
|
||||
}
|
||||
|
||||
public final void setSignificance(TaskSignificance significance) {
|
||||
public final Task<T> setSignificance(TaskSignificance significance) {
|
||||
this.significance = significance;
|
||||
return this;
|
||||
}
|
||||
|
||||
// cancel
|
||||
@ -419,7 +420,7 @@ public abstract class Task<T> {
|
||||
* @return the new Task
|
||||
*/
|
||||
public <U, E extends Exception> Task<U> thenApplyAsync(Executor executor, ExceptionalFunction<T, U, E> fn) {
|
||||
return thenApplyAsync(getCaller(), executor, fn);
|
||||
return thenApplyAsync(getCaller(), executor, fn).setSignificance(TaskSignificance.MODERATE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -460,7 +461,7 @@ public abstract class Task<T> {
|
||||
* @return the new Task
|
||||
*/
|
||||
public <E extends Exception> Task<Void> thenAcceptAsync(Executor executor, ExceptionalConsumer<T, E> action) {
|
||||
return thenAcceptAsync(getCaller(), executor, action);
|
||||
return thenAcceptAsync(getCaller(), executor, action).setSignificance(TaskSignificance.MODERATE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -502,7 +503,7 @@ public abstract class Task<T> {
|
||||
* @return the new Task
|
||||
*/
|
||||
public <E extends Exception> Task<Void> thenRunAsync(Executor executor, ExceptionalRunnable<E> action) {
|
||||
return thenRunAsync(getCaller(), executor, action);
|
||||
return thenRunAsync(getCaller(), executor, action).setSignificance(TaskSignificance.MODERATE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -614,7 +615,7 @@ public abstract class Task<T> {
|
||||
* @return the new Task
|
||||
*/
|
||||
public <E extends Exception> Task<Void> withRunAsync(Executor executor, ExceptionalRunnable<E> action) {
|
||||
return withRunAsync(getCaller(), executor, action);
|
||||
return withRunAsync(getCaller(), executor, action).setSignificance(TaskSignificance.MODERATE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -701,7 +702,7 @@ public abstract class Task<T> {
|
||||
public List<String> getStages() {
|
||||
return Lang.merge(Task.this.getStages(), super.getStages());
|
||||
}
|
||||
}.setExecutor(executor).setName(getCaller());
|
||||
}.setExecutor(executor).setName(getCaller()).setSignificance(TaskSignificance.MODERATE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -810,7 +811,7 @@ public abstract class Task<T> {
|
||||
}
|
||||
|
||||
public static Task<Void> runAsync(Executor executor, ExceptionalRunnable<?> closure) {
|
||||
return runAsync(getCaller(), executor, closure);
|
||||
return runAsync(getCaller(), executor, closure).setSignificance(TaskSignificance.MODERATE);
|
||||
}
|
||||
|
||||
public static Task<Void> runAsync(String name, Executor executor, ExceptionalRunnable<?> closure) {
|
||||
@ -818,7 +819,7 @@ public abstract class Task<T> {
|
||||
}
|
||||
|
||||
public static <T> Task<T> composeAsync(ExceptionalSupplier<Task<T>, ?> fn) {
|
||||
return composeAsync(getCaller(), fn);
|
||||
return composeAsync(getCaller(), fn).setSignificance(TaskSignificance.MODERATE);
|
||||
}
|
||||
|
||||
public static <T> Task<T> composeAsync(String name, ExceptionalSupplier<Task<T>, ?> fn) {
|
||||
@ -845,11 +846,11 @@ public abstract class Task<T> {
|
||||
}
|
||||
|
||||
public static <V> Task<V> supplyAsync(Callable<V> callable) {
|
||||
return supplyAsync(getCaller(), callable);
|
||||
return supplyAsync(getCaller(), callable).setSignificance(TaskSignificance.MODERATE);
|
||||
}
|
||||
|
||||
public static <V> Task<V> supplyAsync(Executor executor, Callable<V> callable) {
|
||||
return supplyAsync(getCaller(), executor, callable);
|
||||
return supplyAsync(getCaller(), executor, callable).setSignificance(TaskSignificance.MODERATE);
|
||||
}
|
||||
|
||||
public static <V> Task<V> supplyAsync(String name, Callable<V> callable) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user