Jump to content

Ayylmao420

Members
  • Posts

    4
  • Joined

  • Last visited

Ayylmao420's Achievements

Bronze Member

Bronze Member (1/10)

  1. No reset condition though 😬
  2. uhh, not sure, i'm a noob so i really don't know what's the correct way lol.
  3. import com.epicbot.api.shared.APIContext; import com.epicbot.api.shared.util.Random; import com.epicbot.api.shared.util.time.Time; import java.util.function.BooleanSupplier; public class Sleep { public static boolean sleep(APIContext apiContext, int timeout) { long startTime = System.currentTimeMillis(); while (apiContext.script().isRunning() && !apiContext.script().isPaused()) { if (System.currentTimeMillis() - startTime >= timeout) { return true; } Time.sleep(10); } return true; } public static boolean sleepUntil(APIContext apiContext, BooleanSupplier breakCondition, int timeout) { long startTime = System.currentTimeMillis(); while (apiContext.script().isRunning() && !apiContext.script().isPaused()) { if (breakCondition.getAsBoolean()) { return true; } if (System.currentTimeMillis() - startTime >= timeout) { return true; } Time.sleep(10); } return true; } public static boolean sleepUntil(APIContext apiContext, BooleanSupplier breakCondition, BooleanSupplier resetCondition, int timeout) { long startTime = System.currentTimeMillis(); while (apiContext.script().isRunning() && !apiContext.script().isPaused()) { if (breakCondition.getAsBoolean()) { return true; } if (resetCondition.getAsBoolean()) { startTime = System.currentTimeMillis(); } if (System.currentTimeMillis() - startTime >= timeout) { return true; } Time.sleep(10); } return true; } }
×
×
  • Create New...