using JetBrains.Annotations; using Webserver.UrlHandlers; namespace Webserver { [UsedImplicitly] public class ModApi : IModApi { private Web webInstance; private Mod modInstance; public void InitMod (Mod _modInstance) { ModEvents.GameStartDone.RegisterHandler (GameStartDone); ModEvents.GameShutdown.RegisterHandler (GameShutdown); modInstance = _modInstance; } private void GameStartDone () { if (!ConnectionManager.Instance.IsServer) { return; } webInstance = new Web (modInstance.Path); LogBuffer.Init (); if (ItemIconHandler.Instance != null) { ItemIconHandler.Instance.LoadIcons (); } } private void GameShutdown () { webInstance?.Shutdown (); } } }