File tree Expand file tree Collapse file tree
commons/src/main/java/net/swofty/commons/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import lombok .Setter ;
55import lombok .experimental .Accessors ;
66import org .spongepowered .configurate .CommentedConfigurationNode ;
7- import org .spongepowered .configurate .loader .ConfigurationLoader ;
8- import org .spongepowered .configurate .objectmapping .ObjectMapper ;
9- import org .spongepowered .configurate .objectmapping .meta .NodeResolver ;
107import org .spongepowered .configurate .yaml .NodeStyle ;
118import org .spongepowered .configurate .yaml .YamlConfigurationLoader ;
129import org .tinylog .Logger ;
@@ -21,22 +18,14 @@ public class ConfigProvider {
2118 @ Accessors (fluent = true )
2219 private static Settings settings ;
2320
24- static YamlConfigurationLoader createLoader (final Path source ) {
25- final ObjectMapper .Factory customFactory = ObjectMapper .factoryBuilder ()
26- .build ();
27-
28- return YamlConfigurationLoader .builder ()
29- .path (source )
30- .nodeStyle (NodeStyle .BLOCK )
31- .defaultOptions (opts -> opts .serializers (build -> build .registerAnnotatedObjects (customFactory )))
32- .build ();
33- }
34-
3521 static {
3622 try {
3723 Logger .info ("Loading config..." );
3824
39- YamlConfigurationLoader loader = createLoader (Path .of ("./configuration/config.yml" ));
25+ YamlConfigurationLoader loader = YamlConfigurationLoader .builder ()
26+ .path (Path .of ("./configuration/config.yml" ))
27+ .nodeStyle (NodeStyle .BLOCK )
28+ .build ();
4029
4130 CommentedConfigurationNode root = loader .load ();
4231 CommentedConfigurationNode defaults = loader .createNode ();
You can’t perform that action at this time.
0 commit comments