From 7d0914bd43a7cf0536b6b769c1d880a794bf29ef Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 13 Sep 2018 16:40:55 -0700 Subject: [PATCH] don't crash on thisway typo lol --- .../java/baritone/utils/ExampleBaritoneControl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 7a9326c2..dab4ca01 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -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; }