private static bool loadModSessions(Session session) { if (CollabModule.Instance.SaveData.ModSessionsPerLevel.TryGetValue(session.Area.GetSID(), out Dictionary <string, string> sessions)) { // restore all mod sessions we can restore. foreach (EverestModule mod in Everest.Modules) { if (mod._Session != null && sessions.TryGetValue(mod.Metadata.Name, out string savedSession)) { try { // note: we are deserializing the session rather than just storing the object, because loading the session usually does that, // and a mod could react to a setter on its session being called. YamlHelper.DeserializerUsing(mod._Session).Deserialize(savedSession, mod.SessionType); } catch (Exception e) { // this is the same fallback message as the base EverestModule class if something goes wrong. Logger.Log(LogLevel.Warn, "CollabUtils2/ReturnToLobbyHelper", "Failed to load the session of " + mod.Metadata.Name + "!"); Logger.LogDetailed(e); } } } return(true); } return(false); }