Class ConfigSync

java.lang.Object
net.neoforged.neoforge.network.ConfigSync

@Internal public final class ConfigSync extends Object
  • Field Details

    • lock

      private static final Object lock
    • configsToSync

      private static final Map<Connection,Map<String,byte[]>> configsToSync
      Connection -> Config file name -> byte[] of the config serialized to TOML.

      Pending config updates get sent to players in the PLAY phase only, but start being tracked as soon as the SyncConfig configuration task runs. This ensures that all updates during the configuration phase will eventually arrive to the clients.

      Connections get removed when GC'ed thanks to the WeakHashMap.

  • Constructor Details

    • ConfigSync

      private ConfigSync()
  • Method Details

    • syncAllConfigs

      public static void syncAllConfigs(ServerConfigurationPacketListener listener)
    • registerEventListeners

      public static void registerEventListeners()
      Registers a listener for ModConfigEvent.Reloading for all mod busses, that will sync changes to server configs to connected clients.
    • syncPendingConfigs

      public static void syncPendingConfigs(MinecraftServer server)
    • receiveSyncedConfig

      public static void receiveSyncedConfig(byte[] contents, String fileName)