Skip to content

Commit

Permalink
~ Change: Change config initialization location.
Browse files Browse the repository at this point in the history
  • Loading branch information
FaeWulf committed Oct 4, 2024
1 parent 1304c1c commit d8e2f30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions common/src/main/java/xyz/faewulf/diversity/CommonClass.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package xyz.faewulf.diversity;

import xyz.faewulf.diversity.platform.Services;
import xyz.faewulf.diversity.registry.CauldronInteractionRegister;
import xyz.faewulf.diversity.util.config.Config;

Expand All @@ -16,7 +15,7 @@ public static void init() {

CauldronInteractionRegister.register();

//load config
//load config, moved to util.mixinPlugin.ConditionalMixinPlugin method: onLoad()
Config.init();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ public class Config {
public static final String path = "config/diversity.toml";
public static final Class<?> configClass = ModConfigs.class;
public static final String translatePath = "diversity.config.";
private static boolean alreadyInit = false;

public static void init() {

//prevent calling twice and so on
if (alreadyInit)
return;

ConfigLoaderFromAnnotation.initializeDefaults(configClass);
loadFromFile(path);
saveConfig(path);
alreadyInit = true;
}

public static void save() {
Expand Down

0 comments on commit d8e2f30

Please sign in to comment.