[config] Tweak docs
This commit is contained in:
parent
7c3b7503d8
commit
4f3ee6df65
|
@ -37,14 +37,18 @@ ConfigInstance.get("yourmod").write();
|
|||
ConfigHolder.getInstance().get("yourmod").write();
|
||||
```
|
||||
|
||||
LibJF config is only intended for simple config screens, it does not support nested classes, multiple pages or controls like sliders.
|
||||
Use something else for those
|
||||
LibJF config is intentionally designed to be easy to implement, pleasant for the user and somewhat lightweight.
|
||||
It is not intended to be used as a general purpose solution for everything, other libraries are better suited for that.
|
||||
|
||||
## Translations
|
||||
Config keys are translated as `<mod id>.jfconfig.<field name>`.
|
||||
You may add a tooltip as follows: `<mod id>.jfconfig.<field name>.tooltip`.
|
||||
Enum keys are translated as follows: `<mod id>.jfconfig.enum.<enum class name>.<entry name>`
|
||||
|
||||
## Categories
|
||||
Categories can be added by creating public static subclasses in your config class and annotating them with @Category.
|
||||
Entries will be read as before, however translations for fields will use `jfconfig.<category>.<field name>` instead of `jfconfig.<field name>`
|
||||
|
||||
## Presets
|
||||
libjf-config-v0 provides a preset system to automatically fill in certain values based on a function.
|
||||
To add a snippet, add a public static method to your config class and annotate it with @Preset.
|
||||
|
|
|
@ -3,6 +3,9 @@ package io.gitlab.jfronny.libjf.config.test;
|
|||
import io.gitlab.jfronny.libjf.config.api.*;
|
||||
import io.gitlab.jfronny.libjf.gson.GsonHidden;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestConfig implements JfConfig {
|
||||
@Entry public static boolean disablePacks = false;
|
||||
@Entry public static Boolean disablePacks2 = false;
|
||||
|
@ -13,6 +16,7 @@ public class TestConfig implements JfConfig {
|
|||
@Entry @GsonHidden public static String guiOnlyStr = "lolz";
|
||||
public static String gsonOnlyStr = "lolz";
|
||||
@Entry public static Test enumTest = Test.Test;
|
||||
@Entry public static List<String> stringList;
|
||||
|
||||
@Preset
|
||||
public static void moskau() {
|
||||
|
@ -29,6 +33,11 @@ public class TestConfig implements JfConfig {
|
|||
if (disablePacks) intTest = 0;
|
||||
}
|
||||
|
||||
@Verifier
|
||||
public static void stringListVerifier() {
|
||||
if (stringList == null) stringList = new ArrayList<>(List.of("Obama"));
|
||||
}
|
||||
|
||||
public enum Test {
|
||||
Test, ER
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue