Only call config initialisers if reload succeeded
This commit is contained in:
Submodule YamlConfig updated: 9230f1af49...67552e7707
@@ -9,7 +9,7 @@ loader_version=0.16.5
|
|||||||
neoforge_version=21.1.79
|
neoforge_version=21.1.79
|
||||||
snakeyaml_version=2.3
|
snakeyaml_version=2.3
|
||||||
concurrentutil_version=0.0.2-SNAPSHOT
|
concurrentutil_version=0.0.2-SNAPSHOT
|
||||||
yamlconfig_version=1.0.1-SNAPSHOT
|
yamlconfig_version=1.0.2-SNAPSHOT
|
||||||
cloth_version=15.0.128
|
cloth_version=15.0.128
|
||||||
# version ids from modrinth
|
# version ids from modrinth
|
||||||
fabric_lithium_version=frXUdgvL
|
fabric_lithium_version=frXUdgvL
|
||||||
|
|||||||
@@ -47,14 +47,6 @@ public final class ConfigHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean reloadConfig() {
|
public static boolean reloadConfig() {
|
||||||
final boolean ret = reloadConfig0();
|
|
||||||
|
|
||||||
CONFIG.callInitialisers();
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean reloadConfig0() {
|
|
||||||
synchronized (CONFIG) {
|
synchronized (CONFIG) {
|
||||||
if (CONFIG_FILE.exists()) {
|
if (CONFIG_FILE.exists()) {
|
||||||
try {
|
try {
|
||||||
@@ -65,6 +57,8 @@ public final class ConfigHolder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CONFIG.callInitialisers();
|
||||||
|
|
||||||
// write back any changes, or create if needed
|
// write back any changes, or create if needed
|
||||||
return saveConfig();
|
return saveConfig();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ public final class MoonriseCommand {
|
|||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
ctx.getSource().sendFailure(
|
ctx.getSource().sendFailure(
|
||||||
Component.literal("Reloaded Moonrise config.")
|
Component.literal("Failed to reload Moonrise config, see logs.")
|
||||||
.withStyle(ChatFormatting.RED)
|
.withStyle(ChatFormatting.RED)
|
||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user