Synapse has a reload Command which will reload all the configs file, but that doesn't mean that all Plugins are reloadable automatic, since some Plugins creates Custom Config or something else that can be reloaded during runtime.
In order to create now a Reloadable Plugin must we go back to your PluginClass and inherit ReloadablePlugin instead of Plugin. This however means we have to rename our Enable method to EnablePlugin
usingNeuron.Core.Plugins;usingNinject;usingSynapse3.SynapseModule;usingSynapse3.SynapseModule.Player;namespaceDocsExample;[Plugin( Author ="Dimenzio", Name ="ExamplePlugin", Description ="An Example Plugin for the Docs", Version ="1.0.0")]publicclassExamplePlugin:ReloadablePlugin{ //The Inject Attribute will causes Neuron to automatically sets the PlayerService //This is a injected field like we mentioned on the previous page [Inject]publicPlayerService PlayerService { get; set; }publicoverridevoidLoad() {Logger.Info("My Plugin Loaded"); }publicoverridevoidEnablePlugin() {Logger.Info("My Plugin was Enabled"); }}
This Class will now also have a new method to override Named Reload()
usingNeuron.Core.Plugins;usingNinject;usingSynapse3.SynapseModule;usingSynapse3.SynapseModule.Events;usingSynapse3.SynapseModule.Player;namespaceDocsExample;[Plugin( Author ="Dimenzio", Name ="ExamplePlugin", Description ="An Example Plugin for the Docs", Version ="1.0.0")]publicclassExamplePlugin:ReloadablePlugin{ //The Inject Attribute will causes Neuron to automatically sets the PlayerService //This is a injected field like we mentioned on the previous page [Inject]publicPlayerService PlayerService { get; set; }publicoverridevoidLoad() {Logger.Info("My Plugin Loaded"); }publicoverridevoidEnablePlugin() {Logger.Info("My Plugin was Enabled"); }publicoverridevoidReload(ReloadEvent _ =null) {Logger.Info("Reload My Plugin!"); }}
This method can now be used for reloading everything you need
However there is also a second ReloadablePlugin Type that automatically reloads Config and Translation for you which would look like this
usingNeuron.Core.Plugins;usingNinject;usingSynapse3.SynapseModule;usingSynapse3.SynapseModule.Events;usingSynapse3.SynapseModule.Player;namespaceDocsExample;[Plugin( Author ="Dimenzio", Name ="ExamplePlugin", Description ="An Example Plugin for the Docs", Version ="1.0.0")]publicclassExamplePlugin:ReloadablePlugin<MyConfig,MyTranslation>{ //The Inject Attribute will causes Neuron to automatically sets the PlayerService //This is a injected field like we mentioned on the previous page [Inject]publicPlayerService PlayerService { get; set; }publicoverridevoidLoad() {Logger.Info("My Plugin Loaded"); }publicoverridevoidEnablePlugin() {Logger.Info("My Plugin was Enabled"); }publicoverridevoidOnReload() {Logger.Info("Reload My Plugin!"); }}
This Class now also has the field Config and Translation that can be accessed to get always the current Config and Translation