Skip to content

Commit 210e1ac

Browse files
Create configs.md
1 parent cd70fec commit 210e1ac

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/configs.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Configs
2+
3+
## READ ME FIRST
4+
If you'd like to make a config **without** having a template file in your resources folder (configs created at-runtime with changing filenames), use a `CaramelBlankConfig` instead of a `CaramelConfig` class!
5+
6+
## Creating one
7+
First, make a variable for it:
8+
```java
9+
CaramelConfig coolConfig;
10+
```
11+
12+
Then in your onEnable, initialize it:
13+
```java
14+
coolConfig = new CaramelConfig(this, "coolest-config.yml");
15+
// If using blank configs, use .saveBlankConfig() instead.
16+
coolConfig.saveDefaultConfig();
17+
```
18+
19+
And use it:
20+
```java
21+
coolConfig.getData() // returns a FileConfiguration
22+
coolConfig.getData().getString("my.path");
23+
coolConfig.getData().setString("my.path", "Setting!");
24+
```

0 commit comments

Comments
 (0)