Files
LMod/MyFirstMod/MyFirstMod.cs
StanislausCichocki c2bbecbffb updated
2025-08-11 15:24:03 +02:00

44 lines
1.0 KiB
C#

using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
namespace MyFirstMod;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class MyFirstMod : BaseUnityPlugin
{
public static MyFirstMod Instance { get; private set; } = null!;
internal new static ManualLogSource Logger { get; private set; } = null!;
internal static Harmony? Harmony { get; set; }
private void Awake()
{
Logger = base.Logger;
Instance = this;
Patch();
Logger.LogInfo($"{MyPluginInfo.PLUGIN_GUID} v{MyPluginInfo.PLUGIN_VERSION} has loaded!");
}
internal static void Patch()
{
Harmony ??= new Harmony(MyPluginInfo.PLUGIN_GUID);
Logger.LogDebug("Patching...");
Harmony.PatchAll();
Logger.LogDebug("Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug("Unpatching...");
Harmony?.UnpatchSelf();
Logger.LogDebug("Finished unpatching!");
}
}