Implement Auto Config Screen registration (Forge/ModMenu)

This commit is contained in:
2022-08-06 23:36:19 +02:00
parent 34eca384e5
commit ff8301f7e2
11 changed files with 119 additions and 0 deletions

View File

@@ -39,4 +39,7 @@ public class ConfigController implements Serializable {
}
}
public static HashMap<Object, FileWatcher> getMonitoredConfigs() {
return monitoredConfigs;
}
}

View File

@@ -18,6 +18,8 @@ public class ModuleConfig {
private final transient String configName;
private final transient String modId;
/**
* Set up the config
*
@@ -36,6 +38,7 @@ public class ModuleConfig {
File configDir = new File("config" + (subFolder.isEmpty() ? "" : File.separator + subFolder));
configPath = new File(configDir + File.separator + configName + ".toml");
networkID = modId + ":conf_" + configName.replace("-", "_");
this.modId = modId;
this.configName = configName;
/* Check if the required directories exists, otherwise we create them */
@@ -154,4 +157,12 @@ public class ModuleConfig {
public String getConfigName() {
return configName;
}
/**
* Get the MODID of the Module the config is registered to
* @return
*/
public String getModId() {
return modId;
}
}

View File

@@ -0,0 +1,13 @@
package me.hypherionmc.craterlib.common.config.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* @author HypherionSA
* @date 06/08/2022
* Allows Modules to disable Automatic Config Screens
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface NoConfigScreen {
}