Introduction
This is a simple library for creating config files for your plugins. It uses reflection to get and set values from the config file, which means that you can access data from the config the same way you access data from any Java object.
Default Serializable Types
Adding to your project
Gradle
Maven
Important
After you added the library as a dependency, you have 2 choices:
1. Add the library as a plugin to your server
2. Shade the library into your code
Creating your config class
It is super easy to create a new config class, just extend the Config class, add your fields, and provide a default no-args constructor. That's it.
Don't forget to leave any review! <3
This is a simple library for creating config files for your plugins. It uses reflection to get and set values from the config file, which means that you can access data from the config the same way you access data from any Java object.
Default Serializable Types
- Primitives
- Objects
- Enums
- Maps
- Collections
- Arrays
- UUIDs
- ItemStacks
- Locations
- Adventure Text Components
Adding to your project
Gradle
Code (Java):
repositories
{
maven {
url 'https://jitpack.io'
}
}
dependencies {
implementation 'com.github.goldfinchx:configs:1.1.2'
}
maven {
url 'https://jitpack.io'
}
}
dependencies {
implementation 'com.github.goldfinchx:configs:1.1.2'
}
Code (YAML):
<repositories
>
<repository >
<id>jitpack.io</id >
<url>https://jitpack.io</url >
</repository >
</repositories >
<dependencies >
<dependency >
<groupId>com.github.goldfinchx</groupId >
<artifactId>configs</artifactId >
<version>1.1.2</version >
</dependency >
</dependencies>
<repository >
<id>jitpack.io</id >
<url>https://jitpack.io</url >
</repository >
</repositories >
<dependencies >
<dependency >
<groupId>com.github.goldfinchx</groupId >
<artifactId>configs</artifactId >
<version>1.1.2</version >
</dependency >
</dependencies>
After you added the library as a dependency, you have 2 choices:
1. Add the library as a plugin to your server
Code (YAML):
depends
:
[Configs
]
Creating your config class
It is super easy to create a new config class, just extend the Config class, add your fields, and provide a default no-args constructor. That's it.
Code (Java):
@Getter
@NoArgsConstructor // you MUST add no-args constructor
public class TestConfig extends Config {
private String value = "This is String value!" ;
private Material enumValue = Material. DIAMOND ;
private ItemStack itemStackValue = new ItemStack (Material. STONE, 1 ) ;
private Map < Integer, Material > mapValue = Map. of ( 1, Material. STONE ) ;
private final String ignoredValue ;
private transient int ignoredValue2 ;
public TestConfig (JavaPlugin plugin ) {
// Formats available: JSON and YAML (change the type of the file to x.json or x.yaml/x.yml)
super ( "fileName.yml", plugin. getDataFolder ( ). getPath ( ) ) ;
// you MUST add this command to get updated values from the file and use this in your reload command
this. reload ( ) ;
}
}
@NoArgsConstructor // you MUST add no-args constructor
public class TestConfig extends Config {
private String value = "This is String value!" ;
private Material enumValue = Material. DIAMOND ;
private ItemStack itemStackValue = new ItemStack (Material. STONE, 1 ) ;
private Map < Integer, Material > mapValue = Map. of ( 1, Material. STONE ) ;
private final String ignoredValue ;
private transient int ignoredValue2 ;
public TestConfig (JavaPlugin plugin ) {
// Formats available: JSON and YAML (change the type of the file to x.json or x.yaml/x.yml)
super ( "fileName.yml", plugin. getDataFolder ( ). getPath ( ) ) ;
// you MUST add this command to get updated values from the file and use this in your reload command
this. reload ( ) ;
}
}
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.18, 1.19, 1.20
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
Reflective Configs is a free Minecraft Java mod. Compatible with Minecraft 1.18, 1.19, 1.20. Downloaded 173 times (via Spigot). Download it and open it directly in the game.