From 23125b27113a7f20a9d526f8baafdc3b33065ae6 Mon Sep 17 00:00:00 2001 From: Yuri Moens Date: Thu, 21 Oct 2021 14:37:12 +0200 Subject: [PATCH] Sleep until login screen is reached --- CShopper/src/io/reisub/dreambot/cshopper/tasks/Stop.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CShopper/src/io/reisub/dreambot/cshopper/tasks/Stop.java b/CShopper/src/io/reisub/dreambot/cshopper/tasks/Stop.java index dbbd883..1ced8de 100644 --- a/CShopper/src/io/reisub/dreambot/cshopper/tasks/Stop.java +++ b/CShopper/src/io/reisub/dreambot/cshopper/tasks/Stop.java @@ -2,6 +2,9 @@ package io.reisub.dreambot.cshopper.tasks; import io.reisub.dreambot.cshopper.CShopper; import io.reisub.dreambot.cshopper.ItemWrapper; +import org.dreambot.api.Client; +import org.dreambot.api.data.GameState; +import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.MethodProvider; import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.methods.tabs.Tabs; @@ -27,6 +30,8 @@ public class Stop extends TaskNode { public int execute() { MethodProvider.log("Finished buying"); Tabs.logout(); + MethodProvider.sleepUntil(() -> Client.getGameState() == GameState.LOGIN_SCREEN, Calculations.random(4000, 4500)); + ScriptManager.getScriptManager().stop(); return 1000;