Files
PCK-Studio/MinecraftUSkinEditor/Classes/StoneVOX/networking/packet/PacketHandler.cs
PhoenixARC 10f1c8daa0 update
2021-08-09 19:05:20 -04:00

34 lines
1.0 KiB
C#

using Lidgren.Network;
using System.Collections.Generic;
namespace stonevox
{
public static class PacketHandler
{
public static Dictionary<PacketID, Packet> handlers = new Dictionary<PacketID, Packet>();
static PacketHandler()
{
handlers.Add(PacketID.MATRIX_RENAME, new Packet_MatrixRename());
handlers.Add(PacketID.CHAT, new Packet_Chat());
handlers.Add(PacketID.QB_IMPORTED, new Packet_QbImported());
}
public static void handle(NetIncomingMessage message, NetEndpoint endpoint)
{
PacketID id = (PacketID)message.ReadInt32();
switch (endpoint)
{
case NetEndpoint.NONE:
break;
case NetEndpoint.CLIENT:
handlers[id].onclientrecieve(message);
break;
case NetEndpoint.SERVER:
handlers[id].onserverrecieve(message);
break;
}
}
}
}