From bbe000b640d845952764a290c2b33ce56352807e Mon Sep 17 00:00:00 2001 From: Daenges <57369924+Daenges@users.noreply.github.com> Date: Sun, 23 Jan 2022 21:31:44 +0100 Subject: [PATCH] Fix /move crash and /setrnd (#1914) * Fix /move crash * Fix substring cutting in SetRnd --- MinecraftClient/Commands/Move.cs | 3 +++ MinecraftClient/Commands/SetRnd.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/MinecraftClient/Commands/Move.cs b/MinecraftClient/Commands/Move.cs index e68131d0..7b95750b 100644 --- a/MinecraftClient/Commands/Move.cs +++ b/MinecraftClient/Commands/Move.cs @@ -16,6 +16,9 @@ namespace MinecraftClient.Commands List args = getArgs(command.ToLower()).ToList(); bool takeRisk = false; + if (args.Count < 1) + return GetCmdDescTranslated(); + if (args.Contains("-f")) { takeRisk = true; diff --git a/MinecraftClient/Commands/SetRnd.cs b/MinecraftClient/Commands/SetRnd.cs index 7547ed48..efed8db0 100644 --- a/MinecraftClient/Commands/SetRnd.cs +++ b/MinecraftClient/Commands/SetRnd.cs @@ -55,7 +55,7 @@ namespace MinecraftClient.Commands else { // extract all arguments of the command - string argString = command.Substring(command.IndexOf(args[0]) + args[0].Length, command.Length - 8 - args[0].Length); + string argString = command.Substring(8 + command.Split(' ')[1].Length); // process all arguments similar to regular terminals with quotes and escaping List values = parseCommandLine(argString);