This commit is contained in:
StanislausCichocki
2025-06-30 11:18:49 +02:00
parent 83e6d7b559
commit 35e730fc4b
5 changed files with 222 additions and 0 deletions

47
MyFirstMod/MyFirstMod.cs Normal file
View File

@ -0,0 +1,47 @@
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LobbyCompatibility.Attributes;
using LobbyCompatibility.Enums;
namespace MyFirstMod;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
[BepInDependency("BMX.LobbyCompatibility", BepInDependency.DependencyFlags.HardDependency)]
[LobbyCompatibility(CompatibilityLevel.ClientOnly, VersionStrictness.None)]
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!");
}
}