Config reload after write and hash-debug
This commit is contained in:
parent
7e36ac4159
commit
f28c3e0594
7 changed files with 76 additions and 5 deletions
|
@ -6,6 +6,7 @@ import com.google.gson.JsonElement;
|
|||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import ru.bclib.api.dataexchange.handler.DataExchange;
|
||||
import ru.bclib.util.JsonFactory;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -16,7 +17,7 @@ import java.util.function.Supplier;
|
|||
|
||||
public final class ConfigKeeper {
|
||||
private final Map<ConfigKey, Entry<?>> configEntries = Maps.newHashMap();
|
||||
private final JsonObject configObject;
|
||||
private JsonObject configObject;
|
||||
private final ConfigWriter writer;
|
||||
|
||||
private boolean changed = false;
|
||||
|
@ -35,6 +36,11 @@ public final class ConfigKeeper {
|
|||
this.writer.save();
|
||||
this.changed = false;
|
||||
}
|
||||
|
||||
void reload() {
|
||||
this.configObject = this.writer.reload();
|
||||
this.changed = false;
|
||||
}
|
||||
|
||||
private <T, E extends Entry<T>> void initializeEntry(ConfigKey key, E entry) {
|
||||
if (configObject == null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue