Preparing Config-Objects to automatically sync from Server to Client
This commit is contained in:
parent
589151af81
commit
16cbba6e76
6 changed files with 49 additions and 50 deletions
|
@ -15,20 +15,17 @@ public class ConfigWriter {
|
|||
private JsonObject configObject;
|
||||
|
||||
public ConfigWriter(String modID, String configFile) {
|
||||
this(modID, configFile, null);
|
||||
}
|
||||
|
||||
public ConfigWriter(String modID, String configFile, File configFolder) {
|
||||
this.configFile = new File((configFolder == null ? GAME_CONFIG_DIR.resolve(modID).toFile() : new File(
|
||||
configFolder,
|
||||
modID
|
||||
)), configFile + ".json");
|
||||
this.configFile = new File(GAME_CONFIG_DIR.resolve(modID).toFile() , configFile + ".json");
|
||||
File parent = this.configFile.getParentFile();
|
||||
if (!parent.exists()) {
|
||||
parent.mkdirs();
|
||||
}
|
||||
this.load();
|
||||
}
|
||||
|
||||
File getConfigFile(){
|
||||
return this.configFile;
|
||||
}
|
||||
|
||||
public JsonObject getConfig() {
|
||||
return configObject;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue