Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0d2a385
Merge pull request #1421 from chsami/development
gmason0 Aug 23, 2025
ec99d87
Merge pull request #1426 from chsami/development
chsami Aug 24, 2025
13af940
Merge pull request #1435 from chsami/development
gmason0 Aug 27, 2025
8da3f86
feat(sandminer): drop empty waterskins when humidify disabled (#1440)
runsonmypc Aug 29, 2025
f66fc28
Revert "feat(sandminer): drop empty waterskins when humidify disabled…
gmason0 Aug 29, 2025
9e635ef
Merge pull request #1444 from g-mason0/revert-8da3f86
gmason0 Aug 29, 2025
f1cf4b2
Merge pull request #3 from chsami/main
Netoxique Aug 30, 2025
d78b9a8
Check logout setting as boolean.
Netoxique Aug 30, 2025
ce17e9d
Also actually log out if logout option is enabled..
Netoxique Aug 30, 2025
83bbbfb
Added tracking for the pre-break world and if a logout occurred.
Netoxique Aug 30, 2025
f6f0dcc
Fixed typo.
Netoxique Aug 30, 2025
9a40cfa
Added region filter drop-down for Random World.
Netoxique Aug 30, 2025
436dcf8
Added check for random world check and region filter.
Netoxique Aug 30, 2025
ac9c0f3
Enum for region filter selection.
Netoxique Aug 30, 2025
771f1d2
Changed version since new feature, random world filter, was added.
Netoxique Aug 30, 2025
6ea7322
Added checks for microbreak option when checking for break cases.
Netoxique Aug 30, 2025
04f081a
Ensured the Antiban now evaluates microbreak only when micro breaks a…
Netoxique Aug 30, 2025
10eb2d8
Revert "Ensured the Antiban now evaluates microbreak only when micro …
Netoxique Aug 30, 2025
481b3be
Revert "Added checks for microbreak option when checking for break ca…
Netoxique Aug 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ default boolean logoutAfterBreak() {

@ConfigItem(
keyName = "useRandomWorld",
name = "Use RandomWorld",
name = "Use Random World",
description = "Change to a random world once break is finished",
position = 2,
section = breakBehaviorOptions
Expand All @@ -132,11 +132,22 @@ default boolean useRandomWorld() {
return false;
}

@ConfigItem(
keyName = "regionFilter",
name = "Region Filter",
description = "Restrict random worlds to a specific region",
position = 3,
section = breakBehaviorOptions
)
default RegionFilter regionFilter() {
return RegionFilter.ANY;
}

@ConfigItem(
keyName = "shutdownClient",
name = "Shutdown Client",
description = "<html><b style='color:red;'>WARNING:</b> This will completely shutdown the entire RuneLite client during breaks.<br/>Use with caution - you will need to manually restart the client after breaks.</html>",
position = 3,
position = 4,
section = breakBehaviorOptions
)
default boolean shutdownClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*/
@Slf4j
public class BreakHandlerScript extends Script {
public static String version = "2.0.0";
public static String version = "2.1.0";

// Constants for configuration and timing
private static final int SCHEDULER_INTERVAL_MS = 1000;
Expand Down Expand Up @@ -106,6 +106,10 @@ public static void setLockState(boolean state) {
private String originalWindowTitle = "";
private BreakHandlerConfig config;

// Track world state across breaks
private int preBreakWorld = -1;
private boolean loggedOutDuringBreak = false;

/**
* Checks if a break is currently active (any break state except waiting).
*/
Expand Down Expand Up @@ -323,8 +327,14 @@ private void handleInitiatingBreakState() {
Microbot.pauseAllScripts.compareAndSet(false, true);
PluginPauseEvent.setPaused(true);
Rs2Walker.setTarget(null);

// Remember the world we were in before the break
preBreakWorld = Microbot.getClient().getWorld();

// Determine next state based on break type
if (Rs2AntibanSettings.microBreakActive && (config.onlyMicroBreaks() || !shouldLogout())) {
boolean logout = shouldLogout();
loggedOutDuringBreak = logout && !(Rs2AntibanSettings.microBreakActive && config.onlyMicroBreaks());
if (!logout || (Rs2AntibanSettings.microBreakActive && config.onlyMicroBreaks())) {
setBreakDuration();
transitionToState(BreakHandlerState.MICRO_BREAK_ACTIVE);
} else {
Expand Down Expand Up @@ -447,9 +457,12 @@ private void handleLoginRequestedState() {
try {
// Use the Login utility class to handle login
if (Login.activeProfile != null) {
new Login();
int world = config.useRandomWorld()
? Login.getRandomWorld(Rs2Player.isMember(), config.regionFilter().getRegion())
: preBreakWorld;
new Login(world);
} else {
// If no active profile, use default login
// If no active profile, fall back to default login
new Login();
}
transitionToState(BreakHandlerState.LOGGING_IN);
Expand Down Expand Up @@ -551,7 +564,10 @@ private boolean isSafeToBreak() {
* Determines if logout should occur based on configuration and conditions.
*/
private boolean shouldLogout() {
return isOutsidePlaySchedule() || config.logoutAfterBreak();
// Only attempt to logout during a normal break. When a micro break is
// active we should remain logged in regardless of the logout setting.
return !Rs2AntibanSettings.microBreakActive &&
(isOutsidePlaySchedule() || config.logoutAfterBreak());
}

/**
Expand Down Expand Up @@ -608,9 +624,9 @@ private void resumeFromBreak() {
* Handles world switching based on configuration.
*/
private void handleWorldSwitching() {
if (config.useRandomWorld()) {
if (config.useRandomWorld() && !loggedOutDuringBreak) {
try {
int randomWorld = Login.getRandomWorld(Rs2Player.isMember());
int randomWorld = Login.getRandomWorld(Rs2Player.isMember(), config.regionFilter().getRegion());
Microbot.hopToWorld(randomWorld);
log.info("Switched to world {}", randomWorld);
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package net.runelite.client.plugins.microbot.breakhandler;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.runelite.http.api.worlds.WorldRegion;

/**
* Region options for selecting random worlds.
*/
@RequiredArgsConstructor
public enum RegionFilter {
ANY(null, "Any"),
US(WorldRegion.UNITED_STATES_OF_AMERICA, "US"),
UK(WorldRegion.UNITED_KINGDOM, "UK"),
GERMANY(WorldRegion.GERMANY, "Germany"),
AUSTRALIA(WorldRegion.AUSTRALIA, "Australia");

@Getter
private final WorldRegion region;

private final String name;

@Override
public String toString() {
return name;
}
}