Error on config load in custom pluginSolved
After i add a new color in this case to the config file i get this error.

Failed to initialize plugin 'Test v1.0.0' (InvalidCastException: Object must implement IConvertible.)
  at System.Convert.ChangeType (System.Object value, System.Type conversionType, System.IFormatProvider provider) [0x00055] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Convert.ChangeType (System.Object value, System.Type conversionType) [0x0000c] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Oxide.Plugins.Test.GetConfig[T] (T defaultValue, System.String[] path) [0x0007d] in <7d49e65284b94d10982864852a46b775>:0 
  at Oxide.Plugins.Test.GetConfig[T] (T& variable, System.String[] path) [0x00000] in <7d49e65284b94d10982864852a46b775>:0 
  at Oxide.Plugins.Test.LoadConfig () [0x00000] in <7d49e65284b94d10982864852a46b775>:0 
  at Oxide.Plugins.Test.Loaded () [0x00006] in <7d49e65284b94d10982864852a46b775>:0 
  at Oxide.Plugins.Test.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x000d3] in <7d49e65284b94d10982864852a46b775>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 
  at Oxide.Plugins.CSharpPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x0006e] in <9affce1cd15c4ec183941adef8db1722>:0
(00:54:31) | Unloaded plugin Test v1.0.0 by Test
(00:54:31) | Previous version of plugin failed to load: Test​
using System.Collections.Generic;
using Newtonsoft.Json;
using UnityEngine;
using System.Linq;
using Oxide.Core;
using System;

namespace Oxide.Plugins
{
    [Info("Test", "Test", "1.0.0")]
    [Description("Test")]

    internal class Test : RustPlugin
    {
        private static Test _instance;

        private static class Configuration
        {
            public static Dictionary<string, string> colors = new Dictionary<string, string>
            {
                {"red", "#ff0000"},
                {"white", "#ffffff"}

            };
        }//end config class

        private void LoadMessages()
        {
            lang.RegisterMessages(new Dictionary<string, string>
            {
                ["No Permission"] = "You don't have permission to use this command."
            }, this);
        }

        private new void LoadConfig()
        {
            GetConfig(ref Configuration.colors, "Colors");

            SaveConfig();
        }

        protected override void LoadDefaultConfig() => PrintWarning("Generating new configuration file...");

        private void Loaded()
        {
            _instance = this;

            LoadConfig();
            LoadMessages();
        }

        private static void GetConfig<T>(ref T variable, params string[] path) => variable = GetConfig(variable, path);

        private static T GetConfig<T>(T defaultValue, params string[] path)
        {
            if (path.Length == 0)
                return defaultValue;

            if (_instance.Config.Get(path) == null)
            {
                _instance.Config.Set(path.Concat(new object[] { defaultValue }).ToArray());
                _instance.PrintWarning($"Added field to config: {string.Join("/", path)}");
            }

            return (T)Convert.ChangeType(_instance.Config.Get(path), typeof(T));
        }

        private string DataFileName => Title.Replace(" ", "");

        private static void LoadData<T>(ref T data, string filename = null) => data = Core.Interface.Oxide.DataFileSystem.ReadObject<T>(filename ?? _instance.DataFileName);

        private static void SaveData<T>(T data, string filename = null) => Core.Interface.Oxide.DataFileSystem.WriteObject(filename ?? _instance.DataFileName, data);
    }
}
{
  "Colors": {
    "red": "#ff0000",
    "white": "#ffffff",
	"black": "#000000"
  }
}
Most likely..
GetConfig(ref Configuration.colors, "Colors");​
GetConfig is retrieving a Dictionary with type Dictionary<string, object> but Configuration.colors is defined as a Dictionary<string, string>
In response to Calytic ():
Most likely..
GetConfig(ref Configuration.colors, "Colors");​GetConfig is retrieving a Dictio...
Thank you both i didnt notice it. Changed it back to object and it worked :)
Locked automatically