I have two methods with same names
public static List<Player> GetPlayers()
{
return GetPlayers<Player>();
}
public static List<T> GetPlayers<T>() where T : IPlayer
{
if (!FactoryManager.FactoryTypes.TryGetValue(typeof(T), out var value))
{
return (List<T>)Enumerable.Empty<T>();
}
if (!FactoryManager.PlayerFactories.TryGetValue(value, out var value2))
{
return (List<T>)Enumerable.Empty<T>();
}
foreach (ReferenceHub allHub in ReferenceHub.AllHubs)
{
if (!allHub.isLocalPlayer)
{
value2.AddIfNotExists(allHub);
}
}
return value2.Entities.Values.Cast<T>().ToList();
}
sooo this is my code and error said that harmony0 dont undersend witch of those methods he need to patch. I need to patch second where "public static List<T> GetPlayers<T>() where T : IPlayer"
using System;
using System.Collections.Generic;
using Exiled.API.Features;
using Exiled.Events;
using HarmonyLib;
using PluginAPI.Core.Interfaces;
using Log = Exiled.API.Features.Log;
using Player = PluginAPI.Core.Player;
namespace Seedonaters
{
public class Main : Plugin<Config>
{
public override string Author => "Discord=>pelemenb";
public override string Name => "SeeDonaters";
public override Version Version => new Version(1, 0, 0);
private Harmony harmony;
public override void OnEnabled()
{
Log.Info("Patch...");
harmony = new Harmony("Seedontat");
harmony.PatchAll();
base.OnEnabled();
}
public override void OnDisabled()
{
Log.Info("UnPatch...");
harmony.UnpatchAll();
base.OnDisabled();
}
[HarmonyPatch(typeof(Player), nameof(Player.GetPlayers))]
public static class DonatPatchGeneric
{
static bool Prefix<T>(ref List<T> __result) where T : IPlayer
{
__result = new List<T>();
return false;
}
}
}
}
if u know how to patch it pls help | thx :]
idk how to patch it, rly :/ but i know that harmony0 can understand if method is generic