1.5 KiB
1.5 KiB
📄 YML-Manager
dveveloped by JernejTDO
A lightweight, high-performance YAML configuration library designed to mimic the intuitive Spigot/Bukkit YamlConfiguration API. This manager provides a simple way to read, write, and update nested YAML files.
📥 Maven
Repository
<repositories>
<repository>
<id>gitea</id>
<url>https://git.triler.eu/api/packages/JernejTDO/maven</url>
</repository>
</repositories>
Dependency
<dependency>
<groupId>net.triler</groupId>
<artifactId>yml-manager</artifactId>
<version>0.1</version>
</dependency>
🛠 Usage Example
File file = new File("config.yml");
ConfigManager config = new ConfigManager(file);
// 1. Load the data from the disk
config.load();
// 2. Read values easily (supports dot-notation)
String host = config.getString("mysql.host");
int port = config.getInt("mysql.port");
// 3. Working with Lists (e.g., worlds.fly)
List<String> flyWorlds = config.getStringList("worlds.fly");
if (!flyWorlds.contains("nether")) {
flyWorlds.add("nether");
}
// 4. Update or Create new keys
config.set("mysql.port", 3307);
config.set("commands.fly.enable", true);
config.set("worlds.fly", flyWorlds); // Save the updated list
// 5. Save the changes back to the file
config.save();
mysql:
host: localhost
port: 3307
database: database
user: root
password: "your-password"
redis:
host: localhost
password: "your-password"
commands:
fly:
enable: true
worlds:
fly:
- world
- end
- nether