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