Trim before parse

This commit is contained in:
BruceChen 2022-09-05 22:21:04 +08:00
parent 0eb8d9998c
commit e5c3b914dd
2 changed files with 2 additions and 2 deletions

View file

@ -91,7 +91,7 @@ namespace MinecraftClient.Commands
try
{
Location current = handler.GetCurrentLocation(), currentCenter = new Location(current).ConvertToCenter();
double x = args[0].StartsWith('~') ? current.X + (args[0].Length > 1 ? double.Parse(args[0][1..]) : 0) : double.Parse(args[0]);
double y = args[1].StartsWith('~') ? current.Y + (args[1].Length > 1 ? double.Parse(args[1][1..]) : 0) : double.Parse(args[1]);
double z = args[2].StartsWith('~') ? current.Z + (args[2].Length > 1 ? double.Parse(args[2][1..]) : 0) : double.Parse(args[2]);