don't crash on thisway typo lol

This commit is contained in:
Leijurv 2018-09-13 16:40:55 -07:00
parent e3830643f6
commit 7d0914bd43
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
1 changed files with 7 additions and 3 deletions

View File

@ -209,9 +209,13 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
return;
}
if (msg.toLowerCase().startsWith("thisway")) {
Goal goal = GoalXZ.fromDirection(playerFeetAsVec(), player().rotationYaw, Double.parseDouble(msg.substring(7).trim()));
PathingBehavior.INSTANCE.setGoal(goal);
logDirect("Goal: " + goal);
try {
Goal goal = GoalXZ.fromDirection(playerFeetAsVec(), player().rotationYaw, Double.parseDouble(msg.substring(7).trim()));
PathingBehavior.INSTANCE.setGoal(goal);
logDirect("Goal: " + goal);
} catch (NumberFormatException ex) {
logDirect("Error unable to parse '" + msg.substring(7).trim() + "' to a double.");
}
event.cancel();
return;
}