Skip to content

Commit

Permalink
Whitelist this plugin for spt-aki beta releases
Browse files Browse the repository at this point in the history
  • Loading branch information
sailro committed Jan 7, 2025
1 parent c2010be commit 4e2ffd7
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions BepInExPlugin/AkiEftTrainerPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using BepInEx;
using System;
using System.Collections.Generic;
using System.Reflection;
using BepInEx;
using EFT.Trainer;
using JetBrains.Annotations;

[BepInPlugin("com.spt-aki.efttrainer", "AKI.EftTrainer", "1.0.0")]
[BepInPlugin(PluginId, "AKI.EftTrainer", "1.0.0")]
[UsedImplicitly]
public class AkiDebuggingPlugin : BaseUnityPlugin
{
private const string PluginId = "com.spt-aki.efttrainer";
public static bool Loaded = false;

[UsedImplicitly]
Expand All @@ -16,6 +20,22 @@ public void Awake()

Loader.Load();
Loaded = true;

WhitelistThisPlugin();
}

private static void WhitelistThisPlugin()
{
// Whitelist this plugin for spt-aki beta releases
var type = Type.GetType("SPT.Custom.Utils.MenuNotificationManager, spt-custom", throwOnError: false);
if (type == null)
return;

var field = type.GetField("whitelistedPlugins", BindingFlags.NonPublic | BindingFlags.Static);
if (field == null)
return;

var hashset = field.GetValue(null) as HashSet<string>;
hashset?.Add(PluginId);
}
}

0 comments on commit 4e2ffd7

Please sign in to comment.