@Override
    public int loop() {

        try {
            if (Game.getClientState() != Game.INDEX_MAP_LOADED) {
                return 1000;
            }


            if (client != Bot.client()) {
                WidgetCache.purge();
                Bot.context().getEventManager().addListener(this);
                client = Bot.client();
            }

            if (Game.isLoggedIn()) {
                for (Node node : jobsCollection) {
                    if (node!= null && node.activate()) {
                        node.execute();
                        return Random.nextInt(50, 100);
                    }

                }
            }
            return Random.nextInt(50, 100);


        } catch (NullPointerException e) {
            e.printStackTrace();
        }
        return Random.nextInt(50, 100);
    }