From 0a571361a9c4a3c94a1b692aa5d61a8016aec399 Mon Sep 17 00:00:00 2001 From: Hudson Shykowski Date: Wed, 23 Dec 2020 15:21:49 -0700 Subject: [PATCH] [fix] BaritoneUtils not unpausing correctly (#1758) * Fix not unpausing even though control is lost Sometimes, we call unpause() even though the temporary process lost control. We should still change the paused variable to false if it is paused regardless. Co-authored-by: theredstoner Co-authored-by: Xiaro <62033805+Xiaro@users.noreply.github.com> --- .../me/zeroeightsix/kami/util/BaritoneUtils.kt | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/util/BaritoneUtils.kt b/src/main/java/me/zeroeightsix/kami/util/BaritoneUtils.kt index 095f3b5c0..71469cd87 100644 --- a/src/main/java/me/zeroeightsix/kami/util/BaritoneUtils.kt +++ b/src/main/java/me/zeroeightsix/kami/util/BaritoneUtils.kt @@ -15,26 +15,17 @@ object BaritoneUtils { val isPathing get() = primary?.pathingBehavior?.isPathing ?: false val isActive get() = primary?.customGoalProcess?.isActive ?: false - || primary?.pathingControlManager?.mostRecentInControl()?.let { - it.isPresent && it.get().isActive - } ?: false + || primary?.pathingControlManager?.mostRecentInControl()?.orElse(null)?.isActive ?: false fun pause() { if (!paused) { - primary?.pathingControlManager?.registerProcess(TemporaryPauseProcess) paused = true + primary?.pathingControlManager?.registerProcess(TemporaryPauseProcess) } } fun unpause() { - if (paused) { - primary?.pathingControlManager?.mostRecentInControl()?.let { - if (it.isPresent && it.get() == TemporaryPauseProcess) /* Don't run if not paused lol */ { - paused = false - it.get().onLostControl() - } - } - } + paused = false } fun cancelEverything() = primary?.pathingBehavior?.cancelEverything()