Line | |
---|
1 | using JetBrains.Annotations;
|
---|
2 | using Webserver.UrlHandlers;
|
---|
3 |
|
---|
4 | namespace Webserver {
|
---|
5 | [UsedImplicitly]
|
---|
6 | public class ModApi : IModApi {
|
---|
7 | private Web webInstance;
|
---|
8 | private Mod modInstance;
|
---|
9 |
|
---|
10 | public void InitMod (Mod _modInstance) {
|
---|
11 | ModEvents.GameStartDone.RegisterHandler (GameStartDone);
|
---|
12 | ModEvents.GameShutdown.RegisterHandler (GameShutdown);
|
---|
13 | modInstance = _modInstance;
|
---|
14 | }
|
---|
15 |
|
---|
16 | private void GameStartDone () {
|
---|
17 | if (!ConnectionManager.Instance.IsServer) {
|
---|
18 | return;
|
---|
19 | }
|
---|
20 |
|
---|
21 | webInstance = new Web (modInstance.Path);
|
---|
22 | LogBuffer.Init ();
|
---|
23 |
|
---|
24 | if (ItemIconHandler.Instance != null) {
|
---|
25 | ItemIconHandler.Instance.LoadIcons ();
|
---|
26 | }
|
---|
27 | }
|
---|
28 |
|
---|
29 | private void GameShutdown () {
|
---|
30 | webInstance?.Shutdown ();
|
---|
31 | }
|
---|
32 | }
|
---|
33 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.