/// <summary> /// Loads the savefile of the plugin settings of the world and stores it /// int the Settings member variable /// </summary> public override void LoadData() { MyPluginLog.Log("Loading Session settings data"); Static = this; if (MyFileUtils.FileExistsInWorldStorage(FILE_NAME)) { Settings = MyFileUtils.ReadXmlFileFromWorld <MyObjectBuilder_WorldSettings>(FILE_NAME); MyPluginLog.Log("Session settings read from file"); } else { MyPluginLog.Log("Session settings do not exist, creating new ones."); if (MySettings.Static == null) { var s = new MySettings(); s.LoadSettings(); } if (MySettings.Static.SessionSettings != null) { Settings = MySettings.Static.SessionSettings; } else { Settings = new MyObjectBuilder_WorldSettings(); } MySettings.Static.SessionSettings = null; } MyPluginLog.Log("Loading Session settings data completed"); }
public override void Init(MyObjectBuilder_SessionComponent sessionComponent) { base.Init(sessionComponent); if (!Sync.IsServer) { PluginEventHandler.Static.RaiseStaticEvent(GetSettingsServer, Sync.MyId); Static = this; return; } }