-
Notifications
You must be signed in to change notification settings - Fork 34
Adding Configurations (P1)
ced777ric edited this page Feb 10, 2025
·
1 revision
If you only need a plugin with one configuration file, you can use the Plugin<T> class. To use it, you just have to edit your Plugin class to inherit from Plugin<T>.
This is a beginner friendly solution, but we always recommend using the advanced configuration system to handle configurations in case you need more customization or freedom.
public class MyFirstPlugin : Plugin<MyPluginConfigurationClass>
{
public override void Enable()
{
// this.Config will have my loaded configuration!
Logger.Info("MyConfigurableInt is " + Config.MyConfigurableInt);
// We can also easily save our configuration!
Config.MyConfigurableInt = 20;
SaveConfig();
}
}Plugin<T> ensures that if the user has broken the configuration file, Config will use its default values.
You can also override the default path of the config file for the plugin!
public override string ConfigFileName { get; set; } = "config.yml";- Making Plugins
- Features
- Guides