public override void Execute(ServerClient client, string[] args) { if (args.Length != 1) { SendUsage(client); return; } string desiredChannel = args[0]; if (!desiredChannel.StartsWith("+")) { desiredChannel = "+" + desiredChannel; } TalkyChannel channel = ChannelRepository.Instance.Get(desiredChannel); if (channel == null) { client.SendMessage("§2That channel does not exist."); client.SendMessage("§2Use /clist to see a list of channels."); client.SendMessage("§2Use /cc to create a temporary channel."); return; } if (client.Channel.Equals(channel)) { client.SendMessage("§2You are already in that channel!"); return; } client.JoinChannel(channel); }
public override void Execute(ServerClient client, string[] args) { if (args.Length != 1) { SendUsage(client); return; } string desiredChannel = args[0]; if (!desiredChannel.StartsWith("++")) { desiredChannel = "++" + desiredChannel; } if (desiredChannel.Length > 16 || desiredChannel.Substring(2).Contains("+") || desiredChannel.Contains("%") || desiredChannel.Contains("/") || desiredChannel.Contains("@") || desiredChannel.Contains("\\") || desiredChannel.Contains(";")) { client.SendMessage("§2Invalid Channel name. Channel names may not contain +, %, /, @, ; or \\. Channel names also have a maximum length of 16 characters."); return; } TalkyChannel channel = ChannelRepository.Instance.Get(desiredChannel); if (channel != null) { client.SendMessage("§2That channel already exists."); return; } ClientChannel chan = new ClientChannel(desiredChannel); ChannelRepository.Instance.Store(chan); client.SendMessage("§4Your channel has been created."); client.JoinChannel(chan); }
public IReadOnlyCollection <ServerClient> Find(TalkyChannel channel) { lock (_lock) { return(_clients.FindAll(client => Equals(client.Channel, 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!"); } }