mirror of
https://github.com/FalsePattern/FalsePatternLib.git
synced 2026-11-11 18:27:32 +00:00
fix config event crash
This commit is contained in:
2 files changed
+10
-20
No files matched your search
+10
-1
@@ -28,7 +28,6 @@ import com.falsepattern.lib.config.event.ConfigSyncEvent;
|
||||
import com.falsepattern.lib.config.event.ConfigValidationFailureEvent;
|
||||
import com.falsepattern.lib.internal.FPLog;
|
||||
import com.falsepattern.lib.internal.config.ConfigEngineConfig;
|
||||
import com.falsepattern.lib.internal.config.MiscConfig;
|
||||
import com.falsepattern.lib.text.FormattedText;
|
||||
import com.falsepattern.lib.toasts.GuiToast;
|
||||
import com.falsepattern.lib.toasts.SimpleToast;
|
||||
@@ -75,6 +74,9 @@ public class ClientEventHandlerPre {
|
||||
false,
|
||||
5000));
|
||||
}
|
||||
if (ConfigEngineConfig.CONFIG_SYNC_SUCCESS_LOGGING != ConfigEngineConfig.LoggingLevel.None) {
|
||||
FPLog.LOG.info("Synced config: {}:{}", cfg.modid(), cfg.category());
|
||||
}
|
||||
} else {
|
||||
if (ConfigEngineConfig.CONFIG_SYNC_FAILURE_LOGGING == ConfigEngineConfig.LoggingLevel.LogAndToast) {
|
||||
GuiToast.add(new SimpleToast(ToastBG.TOAST_DARK,
|
||||
@@ -86,6 +88,13 @@ public class ClientEventHandlerPre {
|
||||
false,
|
||||
5000));
|
||||
}
|
||||
if (ConfigEngineConfig.CONFIG_SYNC_FAILURE_LOGGING != ConfigEngineConfig.LoggingLevel.None) {
|
||||
FPLog.LOG.error("Failed to sync config: {}:{}", cfg.modid(), cfg.category());
|
||||
val t = e.error;
|
||||
if (t != null) {
|
||||
FPLog.LOG.error(t.getMessage(), t);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
-19
@@ -57,23 +57,4 @@ public class CommonEventHandlerPre {
|
||||
e.logWarn();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigSyncFinished(ConfigSyncEvent.End e) {
|
||||
if (e.successful) {
|
||||
if (ConfigEngineConfig.CONFIG_SYNC_SUCCESS_LOGGING != ConfigEngineConfig.LoggingLevel.None) {
|
||||
val cfg = e.configClass.getAnnotation(Config.class);
|
||||
FPLog.LOG.info("Synced config: {}:{}", cfg.modid(), cfg.category());
|
||||
}
|
||||
} else {
|
||||
if (ConfigEngineConfig.CONFIG_SYNC_FAILURE_LOGGING != ConfigEngineConfig.LoggingLevel.None) {
|
||||
val cfg = e.configClass.getAnnotation(Config.class);
|
||||
FPLog.LOG.error("Failed to sync config: {}:{}", cfg.modid(), cfg.category());
|
||||
val t = e.error;
|
||||
if (t != null) {
|
||||
FPLog.LOG.error(t.getMessage(), t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user