Skip to content
This repository was archived by the owner on Sep 12, 2020. It is now read-only.

Plugin Configs

GrafDimenzio edited this page Jun 23, 2020 · 7 revisions

Server-Configs

You can use Synapse.Plugin.Config to get the configs that are in server-configs.yml

It is a Yaml Config so you can do Config.GetString("configname","default value"); or Config.GetInt("configname",default value) etc. to get the values

Example:

In the Plugin
Plugin.Config.GetBool("myplugin_enabled",true)

In the Config file
myplugin_enabled: false (or true)

Own-Configs

If you need a own config file like you can just create one in your Own Folder that synapse creates for you.

You just have to get the string OwnPluginFolder in your Plugin and create a file in it.

Example:

using Synapse;

namespace Example
{
    public class Example : Plugin
    {
        public override void OnEnable()
        {
            File.Create(this.OwnPluginFolder + "FileName.txt"); // This will create a FileName.txt in \Synapse\Plugins\Server-{ServerPort}\{Your Plugin Name}
        }

        public override string GetName => "YourPluginName";
    }
}

Clone this wiki locally