private readonly ConcurrentDictionary<Type, Action<IClientPacket, Connection>>[] _listeners = [];
public void SetListener<T>(ConnectionState state, Type type, Action<T, Connection> listener) where T : IClientPacket
{
var dict = _listeners[(int)state];
dict[type] = listener; // cannot set this because its not IClientPacket, but rather T
}
private readonly ConcurrentDictionary<Type, Action<IClientPacket, Connection>>[] _listeners = [];
public void SetListener<T>(ConnectionState state, Type type, Action<T, Connection> listener) where T : IClientPacket
{
var dict = _listeners[(int)state];
dict[type] = listener; // cannot set this because its not IClientPacket, but rather T
}