-
Notifications
You must be signed in to change notification settings - Fork 9
First Plugin
In Order to start creating Plugins for Synapse you have to install the SynapseSL Nuget. You can install it (in Visual Studio) by clicking on Project -> Manage NuGet Packages -> Browse -> Type in the search : SynapseSL -> Install
.
Now that Synapse is installed in your project we can start with developing a Plugin!
In order to do this you must add using Synapse.Api.Plugin
at the top of your PluginClass which inherit from Synapse.Api.Plugin.AbstractPlugin and contains the override void Load()
method.The Next step is that we add the Attribute Synapse.Api.Plugin.PluginDetails
to the Head of the PluginClass.
Doing that should resolve in a Plugin that is looking like this:
using Synapse.Api;
using Synapse.Api.Plugin;
namespace FirstPlugin
{
[PluginInformation(
Name = "FirstPlugin", //The Name of Your Plugin
Author = "Dimenzio", // Your Name
Description = "My First Awesome Plugin", // A Description for your Plugin
LoadPriority = 0, //When your Plugin should get loaded (use 0 if you don't know how to use it)
SynapseMajor = 2, //The Synapse Version for which this Plugin was created for (SynapseMajor.SynapseMinor.SynapsePatch => 2.4.1)
SynapseMinor = 4,
SynapsePatch = 1,
Version = "v.1.0.0" //The Current Version of your Plugin
)]
public class PluginClass : AbstractPlugin
{
public override void Load()
{
Logger.Get.Info("Hello World");
base.Load() //This will send a Message in the Console that the plugin is loaded
}
//This Method is completely optional and you may not need it.
//It's called whenever Synapse tries to reload all config files inside the system.
public override void ReloadConfigs()
{
}
}
}
The method Load
will be called by Synapse when your plugin gets loaded. (You can add an Logger.Get.Info("Hello World");
to send a "Hello World" to the ServerConsole)
(Additional information for more advanced developers:
The AbstractPlugin
also has the fields for information (PluginInformation
) and PluginDirectory
(It gives your own working directory).
Next step is to look into the Events