Example #1
0
 private void ReloadConfig(string command, string[] args)
 {
     try
     {
         Config = Helper.ReadConfig <Models.TimeConfig>();
         Monitor.Log(Helper.Translation.Get("config_reload_success"), LogLevel.Debug);
     }
     catch (Exception ex)
     {
         Monitor.Log(Helper.Translation.Get("config_reload_error"), LogLevel.Warn);
         Monitor.Log("Exception-Message: " + ex.Message, LogLevel.Warn);
     }
 }
Example #2
0
        public override void Entry(IModHelper helper)
        {
            Config = helper.ReadConfig <Models.TimeConfig>();
            if (Config.IdleTime > 0 && Config.IdleTime <= 15)
            {
                Config.IdleTime = 15;
            }
            if (!Config.IsActive || Config.IdleTime <= 0)
            {
                Monitor.Log("Mod is disabled caused by the config-file!", LogLevel.Warn);
                return;
            }

            helper.ConsoleCommands.Add("afktimer_reloadconfig", "Reloads changed config file without restarting game", ReloadConfig);
            helper.Events.GameLoop.SaveLoaded += GameLoop_SaveLoaded;
        }