Ejemplo n.º 1
0
        public void SendChannelMessage(string msg, ClientSocket sender)
        {
            MinecraftHandler mc        = Tunnel.MinecraftHandler;
            char             colorCode = mc.Config.ServerBroadcastColorChar;
            List <Channel>   channels  = Channels.FindAll(x => x.User.IsInlist(sender.Name));
            UserCollection   users     = new UserCollection();

            foreach (Channel c in channels)
            {
                foreach (User u in c.User)
                {
                    if (mc.IsStringInList(u.Name, mc.Player))
                    {
                        if (!users.IsInlist(u))
                        {
                            users.Add(u);
                        }
                    }
                }
            }

            foreach (User player in users)
            {
                ClientSocket client = (ClientSocket)FindPlayer(player.Name);
                if (client != null)
                {
                    String message = string.Concat(new object[] { "§" + colorCode, msg });
                    foreach (var item in CreateList(message, 119))
                    {
                        client.SendPacket(3, ByteArythmetic.StoA(item));
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void SendServerMessage(string msg, char colorCode)
        {
            foreach (ClientSocket player in this.Clients)
            {
                String message = string.Concat(new object[] { "§" + colorCode, msg });

                foreach (var item in CreateList(message, 119))
                {
                    player.SendPacket(3, ByteArythmetic.StoA(item));
                }
            }
        }
Ejemplo n.º 3
0
        public void SendMessageToClient(string playerName, string msg, char colorCode)
        {
            ClientSocket player = this.FindPlayer(playerName) as ClientSocket;

            if (player == null)
            {
                this.SendServerMessage(msg, colorCode);
            }
            else
            {
                String message = string.Concat(new object[] { "\x00c2\x00a7" + colorCode, msg });
                foreach (var item in CreateList(message, 119))
                {
                    player.SendPacket(3, ByteArythmetic.StoA(item));
                }
            }
        }