-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEventsPlugin.cs
38 lines (31 loc) · 1.05 KB
/
EventsPlugin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using VRisingServerEvents.Events;
using VRisingServerEvents.Network;
namespace VRisingServerEvents;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class EventsPlugin : BasePlugin
{
internal static ManualLogSource Logger { get; private set; }
Harmony _harmony;
public override void Load()
{
Logger = Log;
// Plugin startup logic
EventPublisher.RegisterEventHandlers();
EventManager.RegisterEventFactories();
EventsSerializationHook.Initialize();
Log.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} version {MyPluginInfo.PLUGIN_VERSION} is loaded!");
// Harmony patching
_harmony = new Harmony(MyPluginInfo.PLUGIN_GUID);
_harmony.PatchAll(System.Reflection.Assembly.GetExecutingAssembly());
}
public override bool Unload()
{
EventsSerializationHook.Dispose();
_harmony?.UnpatchSelf();
return true;
}
}