コード例 #1
0
ファイル: Client.Recv.cs プロジェクト: seaboy1234/c-raft
        public static void HandleTabCompletePacket(Client client, TabCompletePacket packet)
        {
            var str = new StringBuilder();
            var s   = (from a in client.GetServer().GetClients() where a.Username.Contains(packet.Text) select a).ToList();

            if (!s.Any())
            {
                return;
            }
            if (s.Count() > 1)
            {
                foreach (var c in s)
                {
                    str.Append(c.Username);
                }
                str.Append('\0');
            }
            else
            {
                str.Append(s[0].Username);
            }
            client.Send_Sync_Packet(new TabCompletePacket {
                Text = str.ToString()
            });
        }
コード例 #2
0
ファイル: Client.Recv.cs プロジェクト: withlin/c-raft
        public static void HandleTabCompletePacket(Client client, TabCompletePacket packet)
        {
            var str = new StringBuilder();

            if (string.IsNullOrEmpty(packet.Text.Trim()))
            {
                return;
            }

            if (packet.Text.StartsWith("/"))
            {
                str.Append(client.Server.ClientCommandHandler.AutoComplete(client, packet.Text));
                if (!string.IsNullOrEmpty(str.ToString()))
                {
                    client.Send_Sync_Packet(new TabCompletePacket {
                        Text = str.ToString()
                    });
                }
                return;
            }
            str.Append(PluginSystem.Commands.AutoComplete.GetPlayers(client, packet.Text));
            if (string.IsNullOrEmpty(str.ToString()))
            {
                return;
            }
            client.Send_Sync_Packet(new TabCompletePacket {
                Text = str.ToString()
            });
        }
コード例 #3
0
        public static void ReadTabCompletePacket(Client client, PacketReader reader)
        {
            TabCompletePacket tcp = new TabCompletePacket();

            tcp.Read(reader);

            if (!reader.Failed)
            {
                Client.HandleTabCompletePacket(client, tcp);
            }
        }