HogWarp
  • Home
    • Frequently Asked Questions
    • Supported Versions
  • Client
    • Quick start
      • Playstation Controller not working
      • Epic Games Version Saves Fix
  • Server
    • Quick Start
    • Server Requirements
    • Troubleshooting
  • Scripting
    • Getting Started
    • Client side
      • Basics
      • Setting up mods
        • Local Cooking / Building
    • Server side
      • Plugin
        • Creating a Plugin
        • Structure / Lifecycle
        • Plugin ↔ Plugin
      • Debugging
      • Event handling
      • API Documentation
        • Server
          • IPlugin
          • PlayerSystem
          • RpcManager
          • Timer
          • World
        • Game
          • Types
        • Systems
          • Logger
          • ClientRpcAttribute
          • ReplicatedAttribute
          • ServerRpcAttribute
Powered by GitBook
On this page
  1. Scripting
  2. Server side
  3. Plugin

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.

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, 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
    }
}

PreviousCreating a PluginNextPlugin ↔ Plugin

Last updated 3 months ago