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

View File

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