Fix /move crash and /setrnd (#1914)

* Fix /move crash
* Fix substring cutting in SetRnd
This commit is contained in:
Daenges 2022-01-23 21:31:44 +01:00 committed by GitHub
parent 223db4af6a
commit bbe000b640
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -16,6 +16,9 @@ namespace MinecraftClient.Commands
List<string> args = getArgs(command.ToLower()).ToList(); List<string> args = getArgs(command.ToLower()).ToList();
bool takeRisk = false; bool takeRisk = false;
if (args.Count < 1)
return GetCmdDescTranslated();
if (args.Contains("-f")) if (args.Contains("-f"))
{ {
takeRisk = true; takeRisk = true;

View file

@ -55,7 +55,7 @@ namespace MinecraftClient.Commands
else else
{ {
// extract all arguments of the command // 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 // process all arguments similar to regular terminals with quotes and escaping
List<string> values = parseCommandLine(argString); List<string> values = parseCommandLine(argString);