Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- using Newtonsoft.Json;
-
- namespace Oxide.Plugins
- {
- [Info("Config example", "Mughisi", 1.0)]
- class ConfigExample : RustPlugin
- {
- private ConfigExampleConfig config;
-
- public class ConfigExampleConfig
- {
- public bool Enabled;
-
- public int Timeout;
-
- public string IP;
-
- [JsonProperty(PropertyName = "Domain Names - Use Proxy")]
- public Dictionary<string, string> DomainNames;
- public static ConfigExampleConfig DefaultConfig()
- {
- return new ConfigExampleConfig
- {
- Enabled = true,
- Timeout = 5,
- IP = "127.0.0.1",
- DomainNames = new Dictionary<string, string>
- {
- ["SomeDefaultKey"] = "SomeDefaultValue",
- ["SomeOtherDefaultKey"] = "SomeOtherDefaultValue"
- }
- };
- }
- }
- protected override void LoadConfig()
- {
- base.LoadConfig();
- config = Config.ReadObject<ConfigExampleConfig>();
- }
-
- protected override void LoadDefaultConfig() => config = ConfigExampleConfig.DefaultConfig();
-
- protected override void SaveConfig() => Config.WriteObject(config);
-
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement