# Structure / Lifecycle

{% hint style="info" %}
All plugins **must** implement the `HogwarpSdk.IPlugin` interface.
{% endhint %}

1. Upon start of the server, the server will invoke the constructor of all existing classes that implement the [IPlugin](/hogwarp/scripting/server-side/api-documentation/server/iplugin.md) interface
2. &#x20;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.

{% hint style="warning" %}
The `Shutdown` method may be skipped, in case the server process is killed, so it cannot be guaranteed to be executed correctly.
{% endhint %}

Additionally, the fields `Author`, `Name`and `Version`are required

## Example

```csharp
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
    }
}


```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hogwarp.com/hogwarp/scripting/server-side/plugin/structure-lifecycle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
