public void Process(string Text)
        {
            ProcessCommand(Rgx.Parse(Text, "^\\[(.*?):(.*?):(.*?)\\] \\[Server thread\\/INFO\\]: [<|\\[](.*?)[>|\\]] !(.*?)$", false));

            if (Rgx.Contains(Text, "^\\[(.*?):(.*?):(.*?)\\] \\[Server thread\\/INFO\\]: Saving players$", false))
            {
                Sys.Ref.Save();
            }

            if (Rgx.Contains(Text, "^\\[(.*?):(.*?):(.*?)\\] \\[Server thread\\/INFO\\]: Stopping server$", false))
            {
                Sys.Ref.Running = false;
            }

            var JoinedMatches = Rgx.Parse(Text, "^\\[(.*?):(.*?):(.*?)\\] \\[Server thread\\/INFO\\]: (.*?) joined the game$", false);

            foreach (var JoinedMatch in JoinedMatches)
            {
                Players.Get(JoinedMatch[3]).Online = true;

                if (Players.Get(JoinedMatch[3]).PlayedBefore == false)
                {
                    NBT TellRaw = new NBT();
                    TellRaw["text"]  = JoinedMatch[3] + Str.Tr(" впервые подключи(лся)/(лась) на сервер");
                    TellRaw["color"] = "aqua";

                    RCON.Command("tellraw", "@a", TellRaw.ToString());

                    RCON.Command("recipe give", JoinedMatch[3], "*");
                    RCON.Command("recipe take", JoinedMatch[3], "minecraft:tnt");
                    RCON.Command("recipe take", JoinedMatch[3], "minecraft:tnt_minecart");

                    Players.Get(JoinedMatch[3]).PlayedBefore = true;

                    NBT NewTellRaw = new NBT();
                    NewTellRaw["text"]  = Str.Tr("Приветствуем тебя на нашем сервере Unary Vanilla Server!\nПрочитай все таблички вокруг тебя и начинай игру");
                    NewTellRaw["color"] = "light_green";

                    RCON.Command("tellraw", JoinedMatch[3], NewTellRaw.ToString());

                    continue;
                }
            }

            var LeftMatches = Rgx.Parse(Text, "^\\[(.*?):(.*?):(.*?)\\] \\[Server thread\\/INFO\\]: (.*?) left the game$", false);

            foreach (var LeftMatch in LeftMatches)
            {
                Players.Get(LeftMatch[3]).Online = false;
            }
        }
예제 #2
0
        public void Execute(string PlayerName, params object[] Arguments)
        {
            string PositionString = RCON.Command("data get entity", PlayerName, "Pos");

            var Result = Rgx.Parse(PositionString, ": \\[(.*?)d, (.*?)d, (.*?)d\\]");

            int X = Convert.ToInt32(JsonConvert.DeserializeObject <double>(Result[0][0]));
            int Y = Convert.ToInt32(JsonConvert.DeserializeObject <double>(Result[0][1]));
            int Z = Convert.ToInt32(JsonConvert.DeserializeObject <double>(Result[0][2]));

            Players.Get(PlayerName).Home = new Position <int>(X, Y, Z);

            NBT TellRaw = new NBT();

            TellRaw["text"]  = Str.Tr("Успешно установили дом на ") + Players.Get(PlayerName).Home.ToString();
            TellRaw["color"] = "green";

            RCON.Command("tellraw", PlayerName, TellRaw.ToString());
        }
예제 #3
0
        public void Init()
        {
            string PlayerList = Sys.Ref.Get <RCON>().Command("list");

            var Matches = Rgx.Parse(PlayerList, "^There are (.*?) of a max (.*?) players online: (.*?)$");

            string NewPlayers = Matches[0][2];

            NewPlayers = NewPlayers.Replace(",", "");

            if (!NewPlayers.Contains(' '))
            {
                Get(NewPlayers).Online = true;
            }
            else
            {
                string[] NewOnlinePlayers = NewPlayers.Split(' ');

                foreach (var NewOnlinePlayer in NewOnlinePlayers)
                {
                    Get(NewOnlinePlayer).Online = true;
                }
            }
        }