A tiny config library, packaged for fabric
repositories {
...
maven { url 'https://jitpack.io' }
}
dependencies {
...
modImplementation 'com.github.P03W:Microconfig:<VERSION>'
include 'com.github.P03W:Microconfig:<VERSION>'
}
- Make a class implement
ConfigData
- Use
ConfigClass config = MicroConfig.getOrCreate("config_file_name", new ConfigClass())
wherever
- Boolean
- Int
- Float
- Double
- String
- Custom Handled types
- ArrayList of the above types
- Nested Classes
Everything must be a top level field, public, and be one of those data types.
- Nested classes must be
static
and implementConfigData
ArrayList
s must be annotated with@TypeProvider
which tells microconfig what type it contains- Comments are supported through the
@Comment
annotation, and use\n
for extra lines
To handle custom types, you need to create a class (or more) that implements MicroConfigTypeHandler
and annotate it with @TypeProvider
to tell micro config what type it handles.
You then change your code slightly, instead calling new MicroConfig
and passing a List
of all handlers.
The handler will only ever receive a single line, so you cannot use newlines in your output, or it will break.
Then, call getOrCreateWithHandlers
to read/write the config using the passed handlers.
This is because the library is run through proguard to compress it significantly (roughly 6kb removed). All public API is left intact so it shouldn't cause any issues. If you find a meaningful problem with this, please open an issue