mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Added a random interval option to the wait command
This commit is contained in:
parent
8891b65eb8
commit
fe5f07306d
1 changed files with 17 additions and 1 deletions
|
|
@ -205,7 +205,23 @@ namespace MinecraftClient.ChatBots
|
||||||
int ticks = 10;
|
int ticks = 10;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ticks = Convert.ToInt32(instruction_line[5..]);
|
if (instruction_line[5..].Contains("to", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
instruction_line[5..].Contains("-"))
|
||||||
|
{
|
||||||
|
var processedLine = instruction_line.Replace("wait", "")
|
||||||
|
.Trim()
|
||||||
|
.ToLower();
|
||||||
|
processedLine = string.Join("", processedLine.Split(default(string[]), StringSplitOptions.RemoveEmptyEntries));
|
||||||
|
var parts = processedLine.Contains("to") ? processedLine.Split("to") : processedLine.Split("-");
|
||||||
|
|
||||||
|
if (parts.Length == 2)
|
||||||
|
{
|
||||||
|
var min = Convert.ToInt32(parts[0]);
|
||||||
|
var max = Convert.ToInt32(parts[1]);
|
||||||
|
|
||||||
|
ticks = new Random().Next(min, max);
|
||||||
|
} else ticks = Convert.ToInt32(instruction_line[5..]);
|
||||||
|
} else ticks = Convert.ToInt32(instruction_line[5..]);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
sleepticks = ticks;
|
sleepticks = ticks;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue