upload
This commit is contained in:
34
README.md
34
README.md
@@ -27,17 +27,43 @@ Dependency
|
||||
File file = new File("config.yml");
|
||||
ConfigManager config = new ConfigManager(file);
|
||||
|
||||
// Load the data from the disk
|
||||
// 1. Load the data from the disk
|
||||
config.load();
|
||||
|
||||
// Read values easily
|
||||
// 2. Read values easily (supports dot-notation)
|
||||
String host = config.getString("mysql.host");
|
||||
int port = config.getInt("mysql.port");
|
||||
|
||||
// Update or Create new keys
|
||||
// 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
|
||||
|
||||
// Save the changes back to the file
|
||||
// 5. Save the changes back to the file
|
||||
config.save();
|
||||
```
|
||||
```yml
|
||||
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
|
||||
```
|
||||
Reference in New Issue
Block a user