1. Code:
    using System.Collections.Generic;
    using Oxide.Core.Plugins;
    using System;
    using Oxide.Core;
    using System.Text.RegularExpressions;
    using Oxide.Core.Libraries.Covalence;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Linq;
    using System.Linq;
    using Oxide.Plugins;namespace Oxide.Plugins
    {
        [Info("TestPlugin", "austinv900", "2.0.0")]
        [Description("A AIO Server Protection Tool")]
        public class TestPlugin: CovalencePlugin
        {
            static TestPlugin plugin  = new TestPlugin();
            class Player
            {
                int Test = plugin.test
            }
            int test;
            protected override void LoadDefaultConfig()
            {
                SetConfig("TestValue", 10);
                SaveConfig();
                test = GetConfig(10, "TestValue")
            }
        }
    }
    The config and everything works the issue I am having is if I try to access the value test from within the class but I also want value test to be set by the config witch is the issue im having. since plugin is technically a new instance of of TestPlugin it doesnt have the value set by the config because it hasn't been loaded yet. Any tips on how I can go about doing this so the value can be set by the config without changing the structure of the code much and also being able to load values from within the class?
     
  2. Wulf

    Wulf Community Admin

    That looks like the wrong way to go about it... If all you want is a variable set from the config, take a look at any of my plugins or any of @Nogrod's plugins. There are plenty examples of how to do this without a mess.

    Also, AIO? Tsk tsk... :p
     
  3. I essentially made a bunch of functions inside that class that requires a external value. For example if I define Player as pl

    I can do pl.ban(string reason);
    And it will ban but if for say I have a default string in the config file it doesn't load it.

    I know there might be other ways but I want to try to see if I can make this method work first
     
  4. Wulf

    Wulf Community Admin

    I don't see the purpose of that... also not quite following what you want.
     
  5. It's might be kinda hard if I don't share the full plugin