Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static async void TryFill(string player, string sentence)
- {
- string[] Cmsg = sentence.Split(' ');
- string[] Lmsg = sentence.ToLower().Split(' ');
- int withpos = -1;
- bool k = true;
- if (Lmsg.Any(x => x.Contains("dont")))
- {
- int wot = 1;
- foreach (string word in Lmsg)
- {
- if (word == "dont")
- {
- wot = wot * -1;
- }
- }
- if (wot == 1)
- {
- PM(player, "Okay dear...");
- k = false;
- }
- }
- if (k)
- {
- if (Lmsg.Any(x => x.Equals("with")))
- {
- withpos = Array.IndexOf(Lmsg, "with");
- }
- if (withpos != -1)
- {
- if (Lmsg.Any(x => x.Any(char.IsDigit)))
- {
- int id = -1;
- foreach (string word in Lmsg) { if (Regex.IsMatch(word, @"[0-9]")) { id = int.Parse(Regex.Replace(word, "[^0-9]", string.Empty)); } }
- if (id != -1)
- {
- PM(player, "Got it dear! Filling the world with " + id);
- for (int y = 0; y <= worldy; y++)
- {
- for (int x = 0; x <= worldx; x++)
- {
- con.Send("b", 0, x, y, id);
- await Task.Delay(20);
- }
- }
- PM(player, "Done!");
- }
- }
- else if (Lmsg.Any(x => wordNumbers.Contains(x)))
- {
- int id = WordNum(sentence.Remove(0, withpos));
- if (id != -1)
- {
- PM(player, "Got it dear! Filling the world with " + id);
- for (int y = 0; y <= worldy; y++)
- {
- for (int x = 0; x <= worldx; x++)
- {
- con.Send("b", 0, x, y, id);
- await Task.Delay(20);
- }
- }
- PM(player, "Done!");
- }
- else
- {
- PM(player, "Would you mind saying it again? I couldn't hear the block id properly...");
- }
- }
- else
- {
- PM(player, "Would you mind saying it again? I couldn't hear the block id properly...");
- }
- }
- else
- {
- PM(player, "Would you mind saying it again? I couldn't detect where the block id should be...");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement