mirror of
https://github.com/roflmuffin/CounterStrikeSharp.git
synced 2025-12-07 16:36:35 -08:00
Co-authored-by: B3none <ablackham2000@gmail.com> Co-authored-by: B3none <24966460+B3none@users.noreply.github.com>
24 lines
505 B
C#
24 lines
505 B
C#
using System.Collections.Generic;
|
|
|
|
namespace CounterStrikeSharp.API.Core.Capabilities;
|
|
|
|
public sealed class PluginCapability<T>
|
|
{
|
|
public string Name { get; }
|
|
internal static readonly Dictionary<string, List<Func<T>>> Providers = new();
|
|
|
|
public PluginCapability(string name)
|
|
{
|
|
Name = name;
|
|
}
|
|
|
|
public T? Get()
|
|
{
|
|
foreach (var provider in Providers[Name])
|
|
{
|
|
return provider();
|
|
}
|
|
|
|
return default;
|
|
}
|
|
} |