Beispiel #1
0
 public IReadOnlyCollection<ServerClient> Find(TalkyChannel channel)
 {
     lock (_lock)
     {
         return _clients.FindAll(client => Equals(client.Channel, channel));
     }
 }
Beispiel #2
0
        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.");
            }
        }
Beispiel #3
0
 public void Store(TalkyChannel channel)
 {
     lock (_lock)
     {
         _channels.Add(channel);
     }
 }
Beispiel #4
0
 public void Remove(TalkyChannel channel)
 {
     lock (_lock)
     {
         _channels.Remove(channel);
     }
 }
Beispiel #5
0
        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!");
            }
        }