mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-22 10:25:33 +00:00
34 lines
1.0 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|
|
} |