Structure / Lifecycle

The following page describes the general layout and lifecycle of a plugin.

All plugins must implement the HogwarpSdk.IPlugin interface.

  1. Upon start of the server, the server will invoke the constructor of all existing classes that implement the IPlugin interface

  2. After all plugins have been loaded, their PostLoad method will be called.

  3. If the server is shutdown (gracefully), the Shutdown method of each plugin is called.

Additionally, the fields Author, Nameand Versionare required

Example

public class Plugin : HogWarpSdk.IPlugin
{
    public string Author { get; } = "";
    public string Name { get; } = "";
    public Version Version { get; } = new(1, 0, 0, 0);
    
    public Plugin()
    {
        // Called first, when server starts
    }

    public void PostLoad()
    {
        // Called after all plugins have been loaded
    }

    public void Shutdown()
    {
        // Called when plugin / server gets shutdown
    }
}

Last updated