mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
|
using System.Reflection;
|
||
|
using Aki.Common.Utils;
|
||
|
using Aki.Core.Utils;
|
||
|
using Aki.Reflection.Patching;
|
||
|
using HarmonyLib;
|
||
|
|
||
|
namespace Aki.Core.Patches
|
||
|
{
|
||
|
public class GameValidationPatch : ModulePatch
|
||
|
{
|
||
|
private const string PluginName = "Aki.Core";
|
||
|
private const string ErrorMessage = "Validation failed";
|
||
|
private static BepInEx.Logging.ManualLogSource _logger = null;
|
||
|
private static bool _hasRun = false;
|
||
|
|
||
|
protected override MethodBase GetTargetMethod()
|
||
|
{
|
||
|
return AccessTools.Method(typeof(BattleeyePatchClass), nameof(BattleeyePatchClass.RunValidation));
|
||
|
}
|
||
|
|
||
|
[PatchPostfix]
|
||
|
private static void PatchPostfix()
|
||
|
{
|
||
|
if (ValidationUtil.Validate() || _hasRun)
|
||
|
return;
|
||
|
|
||
|
if (_logger == null)
|
||
|
_logger = BepInEx.Logging.Logger.CreateLogSource(PluginName);
|
||
|
|
||
|
_hasRun = true;
|
||
|
ServerLog.Warn($"Warning: {PluginName}", ErrorMessage);
|
||
|
_logger?.LogWarning(ErrorMessage);
|
||
|
}
|
||
|
}
|
||
|
}
|