public void Broadcast(ChessPacket p) { log($"{REF} === {p.ToString()}"); string data = p.ToString(); foreach (var pl in ChessService.CurrentGame.GetPlayers()) { if (pl is ChessAIPlayer ai) { ai.recievePacket(p); } else { try { pl.Send(data); } catch (Exception ex) { Program.LogMsg($"{ex}", Discord.LogSeverity.Warning, $"Send-{pl.ID}-{pl.Player?.Name ?? ""}"); } } } }
public virtual void Send(ChessPacket p) { log($"{REF} <<< {p.ToString()}"); this.Send(p.ToString()); }