feat: improve plugin hub UI#1808
Conversation
…rvals cross Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rate comment Addresses Copilot review feedback on #1795. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fix(antiban): prevent action-cooldown stall when play-style tick intervals cross
fix: update camera compatibility for RuneLite 1.12.31
…tion-hardening fix: harden ground item action reflection
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughBumps Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 1
🧹 Nitpick comments (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/camera/NpcTracker.java (1)
27-29: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReuse the centralized yaw target path.
Rs2Camera.setYawInstant(yaw)already handles legacy yaw normalization, conversion, and client-thread dispatch, so keeping a separate conversion path here can drift from the camera utility contract.♻️ Proposed simplification
int yaw = Rs2Camera.calculateCameraYaw(Rs2Camera.angleToTile(actor)); -int clientYaw = Rs2Camera.toClientAngleUnits(yaw); -Microbot.getClientThread().invokeLater(() -> Microbot.getClient().setCameraYawTarget(clientYaw)); +Rs2Camera.setYawInstant(yaw);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/camera/NpcTracker.java` around lines 27 - 29, Reuse the centralized yaw-target flow in NpcTracker instead of manually converting and dispatching the camera yaw: replace the separate Rs2Camera.calculateCameraYaw, Rs2Camera.toClientAngleUnits, and Microbot.getClientThread().invokeLater setCameraYawTarget path with the existing Rs2Camera.setYawInstant(yaw) helper so the legacy normalization, unit conversion, and client-thread handling stay consistent with the camera utility contract.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/tileitem/models/Rs2TileItemModel.java`:
- Around line 227-255: The empty-action handling in Rs2TileItemModel should not
return false before the widget-selected interaction path runs. Update the action
resolution logic so the early return on index == -1 only applies when a real
ground-item menu action is required, and allow the
Microbot.getClient().isWidgetSelected() branch to proceed with
MenuAction.WIDGET_TARGET_ON_GROUND_ITEM even when groundActions is empty or
null-only. Keep the behavior aligned with Rs2GroundItem.interact(...) by using
the existing action/index setup but deferring the failure decision until after
the widget-selected check.
---
Nitpick comments:
In
`@runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/camera/NpcTracker.java`:
- Around line 27-29: Reuse the centralized yaw-target flow in NpcTracker instead
of manually converting and dispatching the camera yaw: replace the separate
Rs2Camera.calculateCameraYaw, Rs2Camera.toClientAngleUnits, and
Microbot.getClientThread().invokeLater setCameraYawTarget path with the existing
Rs2Camera.setYawInstant(yaw) helper so the legacy normalization, unit
conversion, and client-thread handling stay consistent with the camera utility
contract.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 3a4a2695-8f3b-478d-a4cf-5e2688033237
📒 Files selected for processing (20)
gradle.propertiesrunelite-api/src/main/java/net/runelite/api/EntityOps.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/api/tileitem/models/Rs2TileItemModel.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/externalplugins/MicrobotPluginClient.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/externalplugins/MicrobotPluginManager.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/externalplugins/MicrobotPluginManifest.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/ui/MicrobotFixedWidthPanel.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/ui/MicrobotPluginHubPanel.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/ui/MicrobotPluginListItem.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/ui/MicrobotPluginListPanel.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/util/antiban/Rs2Antiban.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/util/antiban/enums/PlayStyle.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/util/camera/NpcTracker.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/util/camera/Rs2Camera.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/util/grounditem/Rs2GroundItem.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/util/reflection/Rs2Reflection.javarunelite-client/src/test/java/groundactionfixture/GroundItemActionFixture.javarunelite-client/src/test/java/net/runelite/client/plugins/microbot/util/antiban/enums/PlayStyleRandomTickIntervalTest.javarunelite-client/src/test/java/net/runelite/client/plugins/microbot/util/grounditem/GroundItemMenuActionResolutionTest.javarunelite-client/src/test/java/net/runelite/client/plugins/microbot/util/reflection/Rs2ReflectionGroundItemActionsTest.java
| int index = -1; | ||
| if (action.isEmpty()) { | ||
| action = groundActions[0]; | ||
| index = 0; | ||
| for (int i = 0; i < groundActions.length; i++) { | ||
| if (groundActions[i] == null) { | ||
| continue; | ||
| } | ||
| action = groundActions[i]; | ||
| index = i; | ||
| break; | ||
| } | ||
| if (index == -1) return false; | ||
| } else { | ||
| for (int i = 0; i < groundActions.length; i++) { | ||
| String groundAction = groundActions[i]; | ||
| if (groundAction == null || !groundAction.equalsIgnoreCase(action)) continue; | ||
| index = i; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| if (Microbot.getClient().isWidgetSelected()) { | ||
| menuAction = MenuAction.WIDGET_TARGET_ON_GROUND_ITEM; | ||
| } else if (index == 0) { | ||
| menuAction = MenuAction.GROUND_ITEM_FIRST_OPTION; | ||
| } else if (index == 1) { | ||
| menuAction = MenuAction.GROUND_ITEM_SECOND_OPTION; | ||
| } else if (index == 2) { | ||
| menuAction = MenuAction.GROUND_ITEM_THIRD_OPTION; | ||
| } else if (index == 3) { | ||
| menuAction = MenuAction.GROUND_ITEM_FOURTH_OPTION; | ||
| } else if (index == 4) { | ||
| menuAction = MenuAction.GROUND_ITEM_FIFTH_OPTION; | ||
| } | ||
| if (menuAction == MenuAction.CANCEL) { | ||
| log.warn("Unable to interact with ground item '{}' using action '{}'; actions={}", getName(), action, java.util.Arrays.toString(groundActions)); | ||
| return false; | ||
| } else { | ||
| menuAction = groundItemMenuAction(index); | ||
| if (menuAction == null) { | ||
| log.warn("Unable to interact with ground item '{}' using action '{}'; actions={}", getName(), action, Arrays.toString(groundActions)); | ||
| return false; | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Don't short-circuit widget-target clicks on empty ground actions.
Line 237 now returns false before the WIDGET_TARGET_ON_GROUND_ITEM branch runs. That makes click("") fail whenever reflection returns an empty/null-only action list, even though the widget-selected path below can still dispatch the interaction. Rs2GroundItem.interact(...) does not have this early return, so the two entry points now behave differently.
Suggested fix
- if (action.isEmpty()) {
+ boolean widgetSelected = Microbot.getClient().isWidgetSelected();
+ if (!widgetSelected && action.isEmpty()) {
for (int i = 0; i < groundActions.length; i++) {
if (groundActions[i] == null) {
continue;
@@
- if (Microbot.getClient().isWidgetSelected()) {
+ if (widgetSelected) {
menuAction = MenuAction.WIDGET_TARGET_ON_GROUND_ITEM;
} else {📝 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.
| int index = -1; | |
| if (action.isEmpty()) { | |
| action = groundActions[0]; | |
| index = 0; | |
| for (int i = 0; i < groundActions.length; i++) { | |
| if (groundActions[i] == null) { | |
| continue; | |
| } | |
| action = groundActions[i]; | |
| index = i; | |
| break; | |
| } | |
| if (index == -1) return false; | |
| } else { | |
| for (int i = 0; i < groundActions.length; i++) { | |
| String groundAction = groundActions[i]; | |
| if (groundAction == null || !groundAction.equalsIgnoreCase(action)) continue; | |
| index = i; | |
| break; | |
| } | |
| } | |
| if (Microbot.getClient().isWidgetSelected()) { | |
| menuAction = MenuAction.WIDGET_TARGET_ON_GROUND_ITEM; | |
| } else if (index == 0) { | |
| menuAction = MenuAction.GROUND_ITEM_FIRST_OPTION; | |
| } else if (index == 1) { | |
| menuAction = MenuAction.GROUND_ITEM_SECOND_OPTION; | |
| } else if (index == 2) { | |
| menuAction = MenuAction.GROUND_ITEM_THIRD_OPTION; | |
| } else if (index == 3) { | |
| menuAction = MenuAction.GROUND_ITEM_FOURTH_OPTION; | |
| } else if (index == 4) { | |
| menuAction = MenuAction.GROUND_ITEM_FIFTH_OPTION; | |
| } | |
| if (menuAction == MenuAction.CANCEL) { | |
| log.warn("Unable to interact with ground item '{}' using action '{}'; actions={}", getName(), action, java.util.Arrays.toString(groundActions)); | |
| return false; | |
| } else { | |
| menuAction = groundItemMenuAction(index); | |
| if (menuAction == null) { | |
| log.warn("Unable to interact with ground item '{}' using action '{}'; actions={}", getName(), action, Arrays.toString(groundActions)); | |
| return false; | |
| } | |
| } | |
| int index = -1; | |
| boolean widgetSelected = Microbot.getClient().isWidgetSelected(); | |
| if (action.isEmpty()) { | |
| for (int i = 0; i < groundActions.length; i++) { | |
| if (groundActions[i] == null) { | |
| continue; | |
| } | |
| action = groundActions[i]; | |
| index = i; | |
| break; | |
| } | |
| if (!widgetSelected && index == -1) return false; | |
| } else { | |
| for (int i = 0; i < groundActions.length; i++) { | |
| String groundAction = groundActions[i]; | |
| if (groundAction == null || !groundAction.equalsIgnoreCase(action)) continue; | |
| index = i; | |
| break; | |
| } | |
| } | |
| if (widgetSelected) { | |
| menuAction = MenuAction.WIDGET_TARGET_ON_GROUND_ITEM; | |
| } else { | |
| menuAction = groundItemMenuAction(index); | |
| if (menuAction == null) { | |
| log.warn("Unable to interact with ground item '{}' using action '{}'; actions={}", getName(), action, Arrays.toString(groundActions)); | |
| return false; | |
| } | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/tileitem/models/Rs2TileItemModel.java`
around lines 227 - 255, The empty-action handling in Rs2TileItemModel should not
return false before the widget-selected interaction path runs. Update the action
resolution logic so the early return on index == -1 only applies when a real
ground-item menu action is required, and allow the
Microbot.getClient().isWidgetSelected() branch to proceed with
MenuAction.WIDGET_TARGET_ON_GROUND_ITEM even when groundActions is empty or
null-only. Keep the behavior aligned with Rs2GroundItem.interact(...) by using
the existing action/index setup but deferring the failure decision until after
the widget-selected check.
Summary
microbot.versionto2.6.10for the releaseValidation
./gradlew :client:compileJavagit diff --check