-
Notifications
You must be signed in to change notification settings - Fork 1
First Plugin
To Start with Synapse they are 2 Ways:
The first recommended option is to use the SynapseSL Nuget packet. To install it (in Visual Studio) click Project -> Manage NuGet Packages -> Browse -> type in search SynapseSL -> install. Now you are finished and can use Synapse in your project.
The Second way of installing Synapse is to install a scp:sl server and download the Synapse.zip and SynapseModLoader.zip and search for all dependencies you need yourself but its much more complicated so do not do it if you have the option to install the NuGet package!
Now that Synapse is installed in your project we can start with developing a Plugin!
In order to to this you must add using Synapse.Api.Plugin at the top and create a Class which inherit from Synapse.Api.Plugin.Plugin and contains the override void OnEnable(). Now we are finished already with a Synapse Plugin which do nothing but works! But Synapse doesn`t know anything about the Plugin now because of which we have to add the Attribute Synapse.Api.Plugin.PluginDetails.
Doing that should resolve in a Plugin that is looking like this:
using Synapse.Api.Plugin;
namespace Example
{
[PluginDetails(
Author = "Dimenzio",
Description = "My Awesome First Plugin!",
Name = "First-Plugin",
SynapseMajor = 1,
SynapseMinor = 0,
SynapsePatch = 0,
Version = "1.0.0"
)]
public class Example : Plugin
{
public override void OnEnable()
{
}
}
}The Method OnEnable will be called by Synapse when your plugin gets loaded. For example: You can add Log.Info("Hello World"); to log a Hello World message inside your Server Console.
Next-Step is to look into the Events to hook them and create your real first plugin. :)