Skip to content

Commit e4f76c2

Browse files
committed
feat: Refactor config
1 parent 43cfd1d commit e4f76c2

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

src/main/java/dev/loat/config/parser/annotation/Comment.java renamed to src/main/java/dev/loat/config/annotation/Comment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package dev.loat.config.parser.annotation;
1+
package dev.loat.config.annotation;
22

33
import java.lang.annotation.ElementType;
44
import java.lang.annotation.Retention;
Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
package dev.loat.config.files;
22

3-
import dev.loat.config.components.Level;
4-
import dev.loat.config.parser.annotation.Comment;
3+
import dev.loat.config.annotation.Comment;
54

65
public final class BackupConfigFile {
7-
@Comment("The Port to use for the API server.")
8-
public int port = 8080;
6+
@Comment("""
7+
Path to the directory where backup files should be saved. This can be both,
8+
an absolute or relative path to the game folder.
99
10-
@Comment("""
11-
Maximum log level to use for transmit. This is the highest level of logging a connected client can receive.
12-
13-
Setting this for example to "INFO" will log INFO, WARN and ERROR messages.
14-
ERROR > WARN > INFO > DEBUG
15-
16-
Possible Values:
17-
- "DEBUG"
18-
- "INFO"
19-
- "WARN"
20-
- "ERROR"
10+
If no absolute path is specified, it defaults to the current working directory,
11+
aka. to the directory where the server.jar sits in.
2112
""")
22-
public String logLevel = Level.INFO;
13+
public String path = "./backups";
2314
}

src/main/java/dev/loat/config/parser/YamlSerializer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package dev.loat.config.parser;
22

3-
import dev.loat.config.parser.annotation.Comment;
43
import org.yaml.snakeyaml.DumperOptions;
54
import org.yaml.snakeyaml.LoaderOptions;
65
import org.yaml.snakeyaml.Yaml;
76
import org.yaml.snakeyaml.constructor.Constructor;
87
import org.yaml.snakeyaml.nodes.Tag;
98
import org.yaml.snakeyaml.representer.Representer;
109

10+
import dev.loat.config.annotation.Comment;
11+
1112
import java.io.InputStream;
1213
import java.lang.reflect.Field;
1314
import java.nio.file.Files;

0 commit comments

Comments
 (0)