-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plugin.cs
54 lines (50 loc) · 1.74 KB
/
Plugin.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using BepInEx;
using BepInEx.IL2CPP;
using HarmonyLib;
using ProjectM;
using ProjectM.Network;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using UnityEngine;
using VRising.PVP.Patches;
using Wetstone.API;
using Wetstone.Hooks;
namespace VRising.PVP
{
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency("xyz.molenzwiebel.wetstone")]
[Wetstone.API.Reloadable]
public class Plugin : BasePlugin
{
private Harmony _hooks;
private Commands.CommandHandler _commandHandler;
private Events.EventHandler _eventHandler;
public override void Load()
{
Log.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
/*
* TODO: this log is absurdly annoying - for some reason it is a property on the `BasePlugin`
* class, I can't send a reference to it and I still want to use the same log instance to
* write infos/warnings in patches and in command actions..
*/
DeathEventListenerSystemPatch.Load(Log);
CreateDropTableItemsJobPatch.Load(Log);
_hooks = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly());
_commandHandler = new Commands.CommandHandler();
Chat.OnChatMessage += _commandHandler.HandleChatMessage;
_eventHandler = new Events.EventHandler(Log);
}
public override bool Unload()
{
_hooks.UnpatchSelf();
Chat.OnChatMessage -= _commandHandler.HandleChatMessage;
return true;
}
}
}