2021-11-03 16:42:12 +01:00
|
|
|
package com.myname.mymodid;
|
|
|
|
|
|
2022-06-23 20:53:03 +01:00
|
|
|
import java.io.File;
|
2021-11-03 16:42:12 +01:00
|
|
|
import net.minecraftforge.common.config.Configuration;
|
|
|
|
|
|
|
|
|
|
public class Config {
|
2022-02-14 15:44:40 -06:00
|
|
|
|
2023-01-28 21:08:45 +01:00
|
|
|
public static String greeting = "Hello World";
|
2021-11-03 16:42:12 +01:00
|
|
|
|
2023-01-28 21:08:45 +01:00
|
|
|
public static void synchronizeConfiguration(File configFile) {
|
2021-11-03 16:42:12 +01:00
|
|
|
Configuration configuration = new Configuration(configFile);
|
2022-02-14 15:44:40 -06:00
|
|
|
|
2023-01-28 21:08:45 +01:00
|
|
|
greeting = configuration.getString("greeting", Configuration.CATEGORY_GENERAL, greeting, "How shall I greet?");
|
2021-11-03 16:42:12 +01:00
|
|
|
|
2022-06-23 20:53:03 +01:00
|
|
|
if (configuration.hasChanged()) {
|
2021-11-03 16:42:12 +01:00
|
|
|
configuration.save();
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-06-23 20:53:03 +01:00
|
|
|
}
|