Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Script starts adding a new player to friends list while it is supposed to delete a player from friends list.


    Recommended Posts

    How do I make the script wait until it has finished removing the player before starting to add a new one? For some reason it will add players without problem but it refuses to remove the player afterwards. I have tried to make the thread sleep after the add friend method is called but it still just skips deleting the friend entirely and clicks on the add new friend button and starts adding another player.

    import org.dreambot.api.methods.friend.*;
    List<Player> players = Players.all();
    players.forEach(player -> {
      Friend PlayerFriend = Friends.getFriend(player.getName());
      boolean playerIsOnline = PlayerFriend.isOnline();


    Link to comment
    Share on other sites

    Okay I made it work by calling the method twice, is this a bug @Pandemic


    This worked



    This did not work

    Link to comment
    Share on other sites

    @Pandemic I spent an hour debugging and I tried to add sleep calls up to 3 seconds  everywhere. Like after it added the player etc, the only thing I could do to make it work was to run the method twice. If it does not work with a 3 seconds delay it should not work by running the method twice as I assume it goes much faster than 3 seconds.

    Edited by DarkFalcon
    Link to comment
    Share on other sites

    • 4 months later...

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.