server-master/srcs/WingsAPI.Game/Core/PacketHandling/IPacketHandlerContainer.cs
2026-02-10 18:21:30 +01:00

45 lines
No EOL
1.4 KiB
C#

// WingsEmu
//
// Developed by NosWings Team
using System;
using System.Threading.Tasks;
using WingsEmu.Game.Networking;
using WingsEmu.Packets;
namespace WingsEmu.Game._packetHandling;
public interface IPacketHandlerContainer<in T> where T : IPacketHandler
{
/// <summary>
/// Registers the given packet handler for the given packetType
/// </summary>
/// <param name="packetType"></param>
/// <param name="handler"></param>
void Register(Type packetType, T handler);
/// <summary>
/// Unregisters the given packetType from the container
/// </summary>
/// <param name="packetType"></param>
void Unregister(Type packetType);
/// <summary>
/// Executes the given packet with the given packetType
/// assuming that the sender is the given session
/// </summary>
/// <param name="session"></param>
/// <param name="packet"></param>
/// <param name="packetType"></param>
void Execute(IClientSession session, IClientPacket packet, Type packetType);
/// <summary>
/// Asynchronously executes the given packet with the given packetType
/// assuming that the sender is the given session
/// </summary>
/// <param name="session"></param>
/// <param name="packet"></param>
/// <param name="packetType"></param>
/// <returns></returns>
Task ExecuteAsync(IClientSession session, IClientPacket packet, Type packetType);
}