2022-08-28 20:06:59 +02:00
|
|
|
package io.gitlab.jfronny.respackopts;
|
|
|
|
|
|
|
|
import io.gitlab.jfronny.libjf.config.api.v1.ConfigInstance;
|
|
|
|
import io.gitlab.jfronny.libjf.config.api.v1.JfCustomConfig;
|
|
|
|
import io.gitlab.jfronny.libjf.config.api.v1.dsl.DSL;
|
|
|
|
import io.gitlab.jfronny.respackopts.util.MetaCache;
|
|
|
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
public class RespackoptsConfig implements JfCustomConfig {
|
|
|
|
public static boolean debugCommands = false;
|
|
|
|
public static boolean debugLogs = false;
|
|
|
|
public static boolean dashloaderCompat = true;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void register(DSL.Defaulted dsl) {
|
|
|
|
dsl.register(builder -> builder
|
|
|
|
.value("debugCommands", debugCommands, () -> debugCommands, v -> debugCommands = v)
|
|
|
|
.value("debugLogs", debugLogs, () -> debugLogs, v -> debugLogs = v)
|
|
|
|
.value("dashloaderCompat", dashloaderCompat, () -> dashloaderCompat, v -> dashloaderCompat = v)
|
|
|
|
.setPath(Respackopts.FALLBACK_CONF_DIR.resolve("_respackopts.conf"))
|
|
|
|
.referenceConfig(() -> {
|
|
|
|
List<ConfigInstance> instances = new LinkedList<>();
|
|
|
|
MetaCache.forEach((key, state) -> instances.add(DSL.create(state.packId())
|
2022-08-28 20:52:27 +02:00
|
|
|
.config(cb -> state.configBranch().buildConfig(cb, state.packId(), key.dataLocation()))
|
2022-08-28 20:06:59 +02:00
|
|
|
));
|
|
|
|
return instances;
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|