Example #1
0
 public override void OnEnabled()
 {
     if (!Config.IsEnabled)
     {
         return;
     }
     EventHandlers = new EventHandlers(this);
     LoadEvents();
     Log.Info("브로드캐스트 플러그인 활성화");
 }
Example #2
0
 public override void OnEnabled()
 {
     if (!Config.IsEnabled)
     {
         return;
     }
     Log.Info("ScpHealingPlugin enabled.");
     EventHandlers = new EventHandlers(this);
     LoadEvents();
 }
Example #3
0
 public override void OnEnabled()
 {
     if (!Config.IsEnabled)
     {
         Log.Info("CustomDoorAccess is disabled via configs. It will not be loaded.");
         return;
     }
     _eventHandlers          = new EventHandlers(this);
     Player.InteractingDoor += _eventHandlers.OnDoorInteract;
 }
Example #4
0
 public override void OnEnabled()
 {
     if (!Config.IsEnabled)
     {
         return;
     }
     EventHandlers         = new EventHandlers(this);
     PlayerConsolecommands = new ConsoleCommands(this);
     LoadEvents();
     ServerEvents.SendingConsoleCommand += PlayerConsolecommands.OnConsoleCommand;
     Log.Info("ChaosPlugin Enabled.");
 }
Example #5
0
        public void LoadTranslation()
        {
            string configPath                = Path.Combine(Paths.Configs, "DiscordIntegration");
            string translationFileName       = Path.Combine(configPath, "translations.json");
            string translationBackupFileName = Path.Combine(configPath, "translations_backup.json");

            if (!Directory.Exists(configPath))
            {
                Directory.CreateDirectory(configPath);
            }

            if (!File.Exists(translationFileName))
            {
                string defaults = JObject.FromObject(Translation).ToString();

                File.WriteAllText(translationFileName, defaults);
                return;
            }

            string  fileText = File.ReadAllText(translationFileName);
            JObject o;

            try
            {
                o = JObject.Parse(fileText);
            }
            catch (Exception e)
            {
                Log.Info("Invalid or corrupted translation file, creating backup and overwriting.");
                Log.Error(e.Message);

                string json = JObject.FromObject(Translation).ToString();

                File.Copy(translationFileName, translationBackupFileName, true);

                File.WriteAllText(translationFileName, json);
                return;
            }

            JsonSerializer j = new JsonSerializer();

            j.Error += Json_Error;

            try
            {
                Translation = o.ToObject <Translation>(j);
            }
            catch (Exception e)
            {
                Log.Info("Invalid or corrupted translation file, creating backup and overwriting.");
                Log.Error(e.Message);
                refreshTranslationFile = true;
            }

            if (refreshTranslationFile)
            {
                string json = JObject.FromObject(Translation).ToString();

                Log.Info("Invalid or missing translation element detected fixing: " + string.Join(", ", propertyNames) + ".");

                File.Copy(translationFileName, translationBackupFileName, true);

                File.WriteAllText(translationFileName, json);
                return;
            }
        }
Example #6
0
        /// <inheritdoc/>
        public virtual void OnEnabled()
        {
            AssemblyInformationalVersionAttribute attribute = Assembly.GetCustomAttribute <AssemblyInformationalVersionAttribute>();

            Log.Info($"{Name} v{(attribute == null ? $"{Version.Major}.{Version.Minor}.{Version.Build}" : attribute.InformationalVersion)} by {Author} has been enabled!");
        }
Example #7
0
 /// <inheritdoc/>
 public virtual void OnReloaded() => Log.Info($"{Name} has been reloaded!");
Example #8
0
 /// <inheritdoc/>
 public virtual void OnDisabled() => Log.Info($"{Name} has been disabled!");