Structure / Lifecycle
The following page describes the general layout and lifecycle of a plugin.
Upon start of the server, the server will invoke the constructor of all existing classes that implement the IPlugin interface
After all plugins have been loaded, their
PostLoad
method will be called.If the server is shutdown (gracefully), the
Shutdown
method of each plugin is called.
The Shutdown
method may be skipped, in case the server process is killed, so it cannot be guaranteed to be executed correctly.
Additionally, the fields Author
, Name
and Version
are 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