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!"); } }
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)); }