public bool AddOrReplacePlayerConfig(DiscordPlayerConfig config)
        {
            var removed = DiscordPluginConfig.PlayerConfigs.Remove(config);

            DiscordPluginConfig.PlayerConfigs.Add(config);
            SavePlayerConfig();
            return(removed);
        }
Beispiel #2
0
        public bool AddOrReplacePlayerConfig(DiscordPlayerConfig config)
        {
            var playerConfigs = DLConfig.Data.PlayerConfigs;
            var removed       = playerConfigs.Remove(config);

            playerConfigs.Add(config);
            DLConfig.Instance.Save();
            return(removed);
        }
        public DiscordPlayerConfig GetOrCreatePlayerConfig(string identifier)
        {
            var config = DiscordPluginConfig.PlayerConfigs.FirstOrDefault(user => user.Username == identifier);

            if (config == null)
            {
                config = new DiscordPlayerConfig
                {
                    Username = identifier
                };
                AddOrReplacePlayerConfig(config);
            }

            return(config);
        }