public IReadOnlyCollection<ServerClient> Find(TalkyChannel channel) { lock (_lock) { return _clients.FindAll(client => Equals(client.Channel, channel)); } }
public void Kick(ServerClient client, string reason = null) { if (!(this is LobbyChannel)) { LobbyChannel lobby = ChannelRepository.Instance.GetLobby(); if (lobby == null) { return; } if (client.Channel.Equals(lobby)) { return; } TalkyChannel oldChannel = client.Channel; client.JoinChannel(lobby, false); if (reason != null) { oldChannel.BroadcastMessage(client.Username + " was kicked from the channel (" + reason + ")."); } oldChannel.BroadcastMessage(client.Username + " was kicked from the channel."); } }
public void Store(TalkyChannel channel) { lock (_lock) { _channels.Add(channel); } }
public void Remove(TalkyChannel channel) { lock (_lock) { _channels.Remove(channel); } }
public void JoinChannel(TalkyChannel channel, bool announce = true) { if (channel.Locked) { if (Account == null || !Account.Role.Equals("admin")) { SendMessage("§2That channel is locked!"); return; } } if (Channel != null) { Channel.BroadcastMessage(Username + " left " + "§4" + Channel.Name + "§0."); } Channel = channel; if (announce) { channel.BroadcastMessage(Username + " joined " + "§4" + channel.Name + "§0!"); } }