fix chat sync always being enabled

reading CHAT_SYNC immediately within FMLCommonSetupEvent can lead to
timing issues that the default value instead of the real config value is
being returned.

Moving them within event.enqueueWork() fixes the timing issue.
This commit is contained in:
EoD 2025-05-02 20:08:06 +00:00
parent 0cbca7cfd8
commit 5a3e157879

View File

@ -35,10 +35,14 @@ public class PlayerSync {
private void commonSetup(final FMLCommonSetupEvent event) {
VanillaSync.register();
if (JdbcConfig.SYNC_CHAT.get()) {
LOGGER.info("Chat sync enabled.");
ChatSync.register();
}
event.enqueueWork(() -> {
// read SYNC_CHAT only within the enqueueWork to reliably get the real
// config value and not its default value.
if (JdbcConfig.SYNC_CHAT.get()) {
LOGGER.info("Chat sync enabled.");
ChatSync.register();
}
});
}
@SubscribeEvent