예제 #1
0
 private void OnReceiveAddonData(AddonDataPacket packet, NetPeer peer)
 {
     if (ClientAddons.TryGetValue(packet.AddonId, out IAddonClient <IConfig> addon))
     {
         addon.OnMessageReceived(new NetDataReader(packet.Data));
     }
     else
     {
         Logger.Error($"Failed receiving data while addon with id \"{packet.AddonId}\" is not loaded!");
     }
 }
예제 #2
0
        private void OnReceiveAddonData(AddonDataPacket packet, NetPeer peer)
        {
            if (!Servers.TryGetValue(peer, out NPServer server))
            {
                return;
            }

            var addon = server.GetAddon(packet.AddonId);

            if (addon == null)
            {
                Logger.Error($"Failed receiving data while addon with id \"{packet.AddonId}\" is not loaded on that server!");
                return;
            }

            addon.OnMessageReceived(new NetDataReader(packet.Data));
        }