Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis pull request updates the Microbot version to 2.1.11 and extends Break Handler functionality with two new configuration options: plugin stopping during breaks and world-switching control. The BreakHandlerV2Config interface adds methods for selecting which plugin to stop and whether to ignore world switching. The BreakHandlerV2Overlay displays these settings in the UI. The BreakHandlerV2Script implements lifecycle hooks that manage stopping and restarting configured plugins at break boundaries and adjusts world selection logic based on the ignore-world-switching setting. Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In
`@runelite-client/src/main/java/net/runelite/client/plugins/microbot/breakhandler/breakhandlerv2/BreakHandlerV2Config.java`:
- Around line 99-107: BreakHandlerV2Config references an unresolved type
MicrobotPluginChoice in the pluginToStop() config method causing build failure;
fix by either creating the missing enum/class named MicrobotPluginChoice with
the expected members (e.g., NONE and any plugin choices) or correcting the
import/reference to the existing type, then update pluginToStop() signature if
necessary so BreakHandlerV2Config::pluginToStop and any overlay/script usage
compile against the defined type.
In
`@runelite-client/src/main/java/net/runelite/client/plugins/microbot/breakhandler/breakhandlerv2/BreakHandlerV2Script.java`:
- Around line 568-574: selectWorld() currently returns -1 when
ignoreWorldSwitching() is true but no world is selected, which causes
handleLoginRequested() to treat this as an error and abort login; update
selectWorld() so it does not return -1 in this case—either return 0 (or another
sentinel that handleLoginRequested() treats as "no-op but allow login") or
adjust the logic so setWorld() is not skipped while still reusing the current
selection; change the return in selectWorld() (and the log message) to return 0
when currentWorld <= 0, and ensure handleLoginRequested() accepts that value and
continues the login flow.
| @ConfigItem( | ||
| keyName = "pluginToStop", | ||
| name = "Stop Plugin On Break", | ||
| description = "Select a Microbot plugin to stop automatically when a break begins.", | ||
| position = 2, | ||
| section = breakBehaviorOptions | ||
| ) | ||
| default MicrobotPluginChoice pluginToStop() { | ||
| return MicrobotPluginChoice.NONE; |
There was a problem hiding this comment.
MicrobotPluginChoice is undefined (build failure).
CI shows MicrobotPluginChoice cannot be resolved; this config (and dependent overlay/script usage) won’t compile until the enum/type exists or the import is corrected.
🧰 Tools
🪛 GitHub Actions: CI
[error] 106-106: cannot find symbol: MicrobotPluginChoice used in return type
🤖 Prompt for AI Agents
In
`@runelite-client/src/main/java/net/runelite/client/plugins/microbot/breakhandler/breakhandlerv2/BreakHandlerV2Config.java`
around lines 99 - 107, BreakHandlerV2Config references an unresolved type
MicrobotPluginChoice in the pluginToStop() config method causing build failure;
fix by either creating the missing enum/class named MicrobotPluginChoice with
the expected members (e.g., NONE and any plugin choices) or correcting the
import/reference to the existing type, then update pluginToStop() signature if
necessary so BreakHandlerV2Config::pluginToStop and any overlay/script usage
compile against the defined type.
| private int selectWorld() { | ||
| // When world switching is disabled, reuse whatever world is already selected | ||
| if (config.ignoreWorldSwitching()) { | ||
| int currentWorld = Microbot.getClient() != null ? Microbot.getClient().getWorld() : -1; | ||
| log.info("[BreakHandlerV2] World switching ignored; reusing current selected world {}", currentWorld); | ||
| return currentWorld > 0 ? currentWorld : -1; // -1 skips setWorld(), leaving client selection unchanged | ||
| } |
There was a problem hiding this comment.
ignoreWorldSwitching can short‑circuit login when no world is selected.
selectWorld() returns -1 when the current world isn’t set, but handleLoginRequested() treats -1 as an error and exits early. That means “stay on current world” can block login on fresh clients or after world selection resets.
🛠 Proposed fix
- if (config.ignoreWorldSwitching()) {
- int currentWorld = Microbot.getClient() != null ? Microbot.getClient().getWorld() : -1;
- log.info("[BreakHandlerV2] World switching ignored; reusing current selected world {}", currentWorld);
- return currentWorld > 0 ? currentWorld : -1; // -1 skips setWorld(), leaving client selection unchanged
- }
+ if (config.ignoreWorldSwitching()) {
+ int currentWorld = Microbot.getClient() != null ? Microbot.getClient().getWorld() : -1;
+ if (currentWorld > 0) {
+ log.info("[BreakHandlerV2] World switching ignored; reusing current selected world {}", currentWorld);
+ return currentWorld;
+ }
+ log.warn("[BreakHandlerV2] World switching ignored but no current world selected; falling back");
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private int selectWorld() { | |
| // When world switching is disabled, reuse whatever world is already selected | |
| if (config.ignoreWorldSwitching()) { | |
| int currentWorld = Microbot.getClient() != null ? Microbot.getClient().getWorld() : -1; | |
| log.info("[BreakHandlerV2] World switching ignored; reusing current selected world {}", currentWorld); | |
| return currentWorld > 0 ? currentWorld : -1; // -1 skips setWorld(), leaving client selection unchanged | |
| } | |
| private int selectWorld() { | |
| // When world switching is disabled, reuse whatever world is already selected | |
| if (config.ignoreWorldSwitching()) { | |
| int currentWorld = Microbot.getClient() != null ? Microbot.getClient().getWorld() : -1; | |
| if (currentWorld > 0) { | |
| log.info("[BreakHandlerV2] World switching ignored; reusing current selected world {}", currentWorld); | |
| return currentWorld; | |
| } | |
| log.warn("[BreakHandlerV2] World switching ignored but no current world selected; falling back"); | |
| } |
🤖 Prompt for AI Agents
In
`@runelite-client/src/main/java/net/runelite/client/plugins/microbot/breakhandler/breakhandlerv2/BreakHandlerV2Script.java`
around lines 568 - 574, selectWorld() currently returns -1 when
ignoreWorldSwitching() is true but no world is selected, which causes
handleLoginRequested() to treat this as an error and abort login; update
selectWorld() so it does not return -1 in this case—either return 0 (or another
sentinel that handleLoginRequested() treats as "no-op but allow login") or
adjust the logic so setWorld() is not skipped while still reusing the current
selection; change the return in selectWorld() (and the log message) to return 0
when currentWorld <= 0, and ensure handleLoginRequested() accepts that value and
continues the login flow.
allow stop plugin for breakhandler