예제 #1
0
        public static void IPCorrelate(Client player, string username)
        {
            lock (ipUsername)
            {
                //Add if new ip
                if (ipUsername.ContainsKey(player.RemoteEndPoint.Address) == false)
                {
                    ipUsername.Add(player.RemoteEndPoint.Address, new List <string>());
                }
                List <string> usernames = ipUsername[player.RemoteEndPoint.Address];
                //Add if new username
                if (usernames.Contains(username) == false)
                {
                    usernames.Add(username);
                }

                //Dont report banned players
                if (player.MinecraftUsername == null)
                {
                    return;
                }

                foreach (string u in usernames)
                {
                    if (u == player.MinecraftUsername)
                    {
                        continue;
                    }
                    BadPlayer b = Banned.GetBanHistory(u);
                    if (b == null)
                    {
                        Log.WritePlayer(player, "AKA " + u);
                        Chatting.Parser.TellAdmin(Chat.Purple + player.MinecraftUsername + Chat.Aqua + " AKA " + Chat.Yellow + u);
                    }
                    else
                    {
                        Log.WritePlayer(player, "AKA " + b);
                        if (b.BannedUntil < DateTime.Now)
                        {
                            Chatting.Parser.TellAdmin(Chat.Purple + player.MinecraftUsername + Chat.Aqua + " AKA " + Chat.DarkRed + u + Chat.White + " Expired: " + b.Reason);
                        }
                        else
                        {
                            Chatting.Parser.TellAdmin(Chat.Purple + player.MinecraftUsername + Chat.Aqua + " AKA " + Chat.Red + u + Chat.White + " " + b.Reason);
                        }
                    }
                }
            }
        }
예제 #2
0
        static void Welcome(Client player)
        {
            var header = new PlayerListHeaderFooter();

            header.Header           = new ChatJson();
            header.Header.Translate = "%1$s\n%2$s";
            header.Header.With      = new List <ChatJson>()
            {
                new ChatJson()
                {
                    Text  = " ==== MCTraveler.eu ==== ",
                    Color = "yellow",
                },
                new ChatJson()
                {
                    Text  = " ======================= ",
                    Color = "gray",
                },
            };
            header.Footer = new ChatJson()
            {
                Text  = " ======================= ",
                Color = "gray",
            };
            player.Queue.Queue(header);

            SendTabHeader(player);
//          if (player.ClientVersion < MinecraftServer.Version)
//              player.Tell(Chat.Purple, "You should upgrade to " + MinecraftServer.Version.ToString().Replace('_', '.'));

            /*
             * int count = 0;
             * foreach (Client p in PlayerList.List)
             *  if (p.Cloaked == null && p.MinecraftUsername != "Player")
             *      count ++;
             * if (count == 1)
             *  player.Tell(Chat.Yellow, "Welcome, " + player.Name + " you are the first one here");
             * else if (count == 2)
             *  player.Tell(Chat.Yellow, "Welcome, " + player.Name + " there is one other player here");
             * else
             *  player.Tell(Chat.Yellow, "Welcome, " + player.Name + " there are " + (count - 1) + " other players here");
             */

            //Tell donor status
            //player.Tell(Donors.Status(player.MinecraftUsername));

            string version = "";

            if (player.ClientVersion < MinecraftServer.FrontendVersion)
            {
                version = Chat.Gray + "(" + player.ClientVersion.ToText() + ")";
            }
            if (player.Settings.Cloaked == null && Banned.CheckBanned(player) == null && player.MinecraftUsername != "Player")
            {
                if (player.Uptime.TotalMinutes < 1)
                {
                    Log.WritePlayer(player, "Login FirstTime");
                    Chatting.Parser.Say(Chat.Purple, "Welcome " + Chat.Yellow + player.Name + Chat.Purple + " from " + player.Country + version);
                }
                else
                {
                    if (Donors.IsDonor(player))
                    {
                        Chatting.Parser.Say(Chat.Gold, player.Name + " (donor!) joined from " + player.Country + version);
                    }
                    else
                    {
                        Chatting.Parser.Say(Chat.Yellow, player.Name + " joined from " + player.Country + version);
                    }
                }

                //Report old bans to admin
                BadPlayer bp = Banned.GetBanHistory(player.MinecraftUsername);
                if (bp != null)
                {
                    Chatting.Parser.TellAdmin("BanHistory: " + bp.BannedUntil.ToString("yyyy-MM-dd") + " " + bp.Reason);
                }
            }
        }