XPLM MSG WILL WRITE PREFS
From X-Plane SDK
#define XPLM_MSG_WILL_WRITE_PREFS 107This message is sent to your plugin right before X-Plane writes its preferences file. You can use this for two purposes: to write your own preferences, and to modify any datarefs to influence preferences output. For example, if your plugin temporarily modifies saved preferences, you can put them back to their default values here to avoid having the tweaks be persisted if your plugin is not loaded on the next invocation of X-Plane.