-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.cs
More file actions
41 lines (32 loc) · 1.08 KB
/
Copy pathPlugin.cs
File metadata and controls
41 lines (32 loc) · 1.08 KB
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
using MelonLoader;
using CustomRPCs;
[assembly: MelonInfo(typeof(Plugin), ModInfo.MOD_NAME, ModInfo.MOD_VERSION, ModInfo.MOD_AUTHOR, $"{ModInfo.MOD_LINK}/releases/latest/download/Release.zip")]
[assembly: MelonGame("Landfall Games", "Knightfall")]
namespace CustomRPCs;
internal class Plugin : MelonMod
{
public static MelonPreferences_Entry<bool> ENABLED;
public override void OnInitializeMelon()
{
InitConfig();
if (!ENABLED.Value)
{
UnloadMod();
return;
}
LoggerInstance.Msg($"Plugin {ModInfo.MOD_NAME} loaded successfully!");
}
/// <summary>
/// Load or create all MelonLoader config entries.
/// Stored in `UserData/MelonPreferences.cfg`.
/// </summary>
private void InitConfig()
{
var mlCategory = MelonPreferences.CreateCategory("CustomRPCs", "CustomRPCs settings");
ENABLED = mlCategory.CreateEntry("Enabled", true);
}
/// <summary>
/// Remove all Harmony Patches.
/// </summary>
private void UnloadMod() => HarmonyInstance.UnpatchSelf();
}