Skip to content

Commit 5bfd408

Browse files
committed
fix config event crash
1 parent 627125b commit 5bfd408

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

src/main/java/com/falsepattern/lib/internal/impl/config/event/ClientEventHandlerPre.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import com.falsepattern.lib.config.event.ConfigValidationFailureEvent;
2929
import com.falsepattern.lib.internal.FPLog;
3030
import com.falsepattern.lib.internal.config.ConfigEngineConfig;
31-
import com.falsepattern.lib.internal.config.MiscConfig;
3231
import com.falsepattern.lib.text.FormattedText;
3332
import com.falsepattern.lib.toasts.GuiToast;
3433
import com.falsepattern.lib.toasts.SimpleToast;
@@ -75,6 +74,9 @@ public void onConfigSyncFinished(ConfigSyncEvent.End e) {
7574
false,
7675
5000));
7776
}
77+
if (ConfigEngineConfig.CONFIG_SYNC_SUCCESS_LOGGING != ConfigEngineConfig.LoggingLevel.None) {
78+
FPLog.LOG.info("Synced config: {}:{}", cfg.modid(), cfg.category());
79+
}
7880
} else {
7981
if (ConfigEngineConfig.CONFIG_SYNC_FAILURE_LOGGING == ConfigEngineConfig.LoggingLevel.LogAndToast) {
8082
GuiToast.add(new SimpleToast(ToastBG.TOAST_DARK,
@@ -86,6 +88,13 @@ public void onConfigSyncFinished(ConfigSyncEvent.End e) {
8688
false,
8789
5000));
8890
}
91+
if (ConfigEngineConfig.CONFIG_SYNC_FAILURE_LOGGING != ConfigEngineConfig.LoggingLevel.None) {
92+
FPLog.LOG.error("Failed to sync config: {}:{}", cfg.modid(), cfg.category());
93+
val t = e.error;
94+
if (t != null) {
95+
FPLog.LOG.error(t.getMessage(), t);
96+
}
97+
}
8998

9099
}
91100
}

src/main/java/com/falsepattern/lib/internal/impl/config/event/CommonEventHandlerPre.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,4 @@ public void onValidationErrorLog(ConfigValidationFailureEvent e) {
5757
e.logWarn();
5858
}
5959
}
60-
61-
@SubscribeEvent
62-
public void onConfigSyncFinished(ConfigSyncEvent.End e) {
63-
if (e.successful) {
64-
if (ConfigEngineConfig.CONFIG_SYNC_SUCCESS_LOGGING != ConfigEngineConfig.LoggingLevel.None) {
65-
val cfg = e.configClass.getAnnotation(Config.class);
66-
FPLog.LOG.info("Synced config: {}:{}", cfg.modid(), cfg.category());
67-
}
68-
} else {
69-
if (ConfigEngineConfig.CONFIG_SYNC_FAILURE_LOGGING != ConfigEngineConfig.LoggingLevel.None) {
70-
val cfg = e.configClass.getAnnotation(Config.class);
71-
FPLog.LOG.error("Failed to sync config: {}:{}", cfg.modid(), cfg.category());
72-
val t = e.error;
73-
if (t != null) {
74-
FPLog.LOG.error(t.getMessage(), t);
75-
}
76-
}
77-
}
78-
}
7960
}

0 commit comments

Comments
 (0)