mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-01-30 14:39:56 +08:00
Remove truePredicate/falsePredicate/emptyConsumer
This commit is contained in:
parent
b33e014f71
commit
ed91771594
@ -23,7 +23,6 @@ import org.jackhuang.hmcl.download.DefaultDependencyManager;
|
||||
import org.jackhuang.hmcl.download.GameBuilder;
|
||||
import org.jackhuang.hmcl.game.DefaultGameRepository;
|
||||
import org.jackhuang.hmcl.task.Task;
|
||||
import org.jackhuang.hmcl.util.Constants;
|
||||
import org.jackhuang.hmcl.util.gson.JsonUtils;
|
||||
import org.jackhuang.hmcl.util.io.FileUtils;
|
||||
|
||||
@ -93,7 +92,7 @@ public final class CurseInstallTask extends Task {
|
||||
} catch (JsonParseException | IOException ignore) {
|
||||
}
|
||||
this.config = config;
|
||||
dependents.add(new ModpackInstallTask<>(zipFile, run, manifest.getOverrides(), Constants.truePredicate(), config));
|
||||
dependents.add(new ModpackInstallTask<>(zipFile, run, manifest.getOverrides(), any -> true, config));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,7 +100,7 @@ public final class MultiMCModpackInstallTask extends Task {
|
||||
} catch (JsonParseException | IOException ignore) {
|
||||
}
|
||||
|
||||
dependents.add(new ModpackInstallTask<>(zipFile, run, "/" + manifest.getName() + "/minecraft", Constants.truePredicate(), config));
|
||||
dependents.add(new ModpackInstallTask<>(zipFile, run, "/" + manifest.getName() + "/minecraft", any -> true, config));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package org.jackhuang.hmcl.task;
|
||||
|
||||
import org.jackhuang.hmcl.util.Constants;
|
||||
import org.jackhuang.hmcl.util.Logging;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
@ -113,7 +112,7 @@ public final class Schedulers {
|
||||
return newThread();
|
||||
}
|
||||
|
||||
static final Scheduler NONE = new SchedulerImpl(Constants.emptyConsumer());
|
||||
static final Scheduler NONE = new SchedulerImpl(any -> {});
|
||||
|
||||
public static synchronized void shutdown() {
|
||||
Logging.LOG.info("Shutting down executor services.");
|
||||
|
@ -27,7 +27,6 @@ import org.jackhuang.hmcl.util.platform.OperatingSystem;
|
||||
import java.awt.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Constants.
|
||||
@ -63,16 +62,4 @@ public final class Constants {
|
||||
|
||||
// lazy loading
|
||||
public static final ObjectBinding<Image> DEFAULT_ICON = Bindings.createObjectBinding(() -> new Image("/assets/img/icon.png"));
|
||||
|
||||
public static <T> Predicate<T> truePredicate() {
|
||||
return s -> true;
|
||||
}
|
||||
|
||||
public static <T> Predicate<T> falsePredicate() {
|
||||
return s -> false;
|
||||
}
|
||||
|
||||
public static <T> Consumer<T> emptyConsumer() {
|
||||
return x -> {};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user