adamk33n3r / runelite-watchdog

Custom notification plugin for RuneLite
BSD 2-Clause "Simplified" License
6 stars 24 forks source link

Indicate that you are in a banned area #140

Closed adamk33n3r closed 7 months ago

adamk33n3r commented 7 months ago

We do this by changing the panel icon and the Watchdog text in the main panel to red. We also display the current list of banned areas in the Watchdog tooltip.

Summary by CodeRabbit

coderabbitai[bot] commented 7 months ago

Walkthrough

The recent update involves enhancing the Region class to support multiple region IDs and introduces the WatchdogMuxer class for better state management across the plugin's UI components. The update refactors the navigation logic based on region-specific bans and integrates the new WatchdogMuxer across various panels, replacing the older MultiplexingPluginPanel. Additionally, the version properties file has been updated to reflect the new build number and timestamp.

Changes

Files Summary
.../watchdog/Region.java Updated to handle multiple region IDs per enum instance and added a method to check banned regions.
.../watchdog/WatchdogMuxer.java Introduced a new class to manage UI component states and interactions.
.../watchdog/WatchdogPanel.java, .../watchdog/hub/AlertHubPanel.java, .../watchdog/ui/panels/HistoryPanel.java, .../watchdog/ui/panels/ToolsPanel.java Replaced MultiplexingPluginPanel with WatchdogMuxer and updated related logic.
.../watchdog/WatchdogPlugin.java Refactored navigation button logic to respond to region ban status.
.../watchdog/version.properties Updated VERSION_BUILD to 4633 and modified the timestamp.

Recent Review Details **Configuration used: CodeRabbit UI**
Commits Files that changed from the base of the PR and between 6322d40e6ae888e42a9ece77b52e559ead2e2cd5 and 1fe9b38d29f40951726b888836c5d411eccb49cf.
Files selected for processing (8) * src/main/java/com/adamk33n3r/runelite/watchdog/Region.java (2 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogMuxer.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogPanel.java (3 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogPlugin.java (8 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/hub/AlertHubPanel.java (3 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/HistoryPanel.java (2 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/ToolsPanel.java (2 hunks) * src/main/resources/com/adamk33n3r/runelite/watchdog/version.properties (1 hunks)
Files skipped from review due to trivial changes (1) * src/main/resources/com/adamk33n3r/runelite/watchdog/version.properties
Additional comments not posted (12)
src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogMuxer.java (3)
`14-16`: Constructor correctly initializes the superclass with the provided `root` panel. --- `18-24`: Ensure to monitor the linked issue for resolution and remove the workaround as appropriate.
Verification successful --- The GitHub issue [#17712](https://github.com/runelite/runelite/issues/17712) linked in the code comment is still open. Therefore, the workaround implemented in the `onAdd` method remains necessary until the issue is resolved. The review comment is correct in advising to monitor the issue for future updates. -
Scripts Executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Check for updates on the linked issue curl -s "https://api.github.com/repos/runelite/runelite/issues/17712" | jq '.state' ``` Length of output: 88
--- `26-36`: Activation and deactivation methods correctly manage the `isActive` state.
src/main/java/com/adamk33n3r/runelite/watchdog/Region.java (2)
`16-53`: Ensure that all region IDs are correctly listed and that no regions are mistakenly commented out unless intentionally excluded. --- `62-66`: Method `isBannedRegion` efficiently checks if a given region ID is among the banned regions using streams.
src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/ToolsPanel.java (1)
`26-26`: Constructor correctly initializes with `WatchdogMuxer`. Ensure that all uses of `muxer` are updated to reflect this change.
Verification successful --- The search for references to `MultiplexingPluginPanel` in the `ToolsPanel.java` file returned no results, confirming that this class is no longer referenced in the `ToolsPanel` constructor or elsewhere in the file. This aligns with the expected update where `WatchdogMuxer` should replace `MultiplexingPluginPanel`. Therefore, the changes are correctly implemented as described in the review comment.
Scripts Executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Search for any remaining references to MultiplexingPluginPanel in ToolsPanel.java rg "MultiplexingPluginPanel" src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/ToolsPanel.java ``` Length of output: 101
src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/HistoryPanel.java (1)
`39-39`: Constructor correctly initializes with `WatchdogMuxer`. Ensure that all uses of `muxer` are updated to reflect this change.
src/main/java/com/adamk33n3r/runelite/watchdog/hub/AlertHubPanel.java (1)
`44-44`: Constructor correctly initializes with `WatchdogMuxer`. Ensure that all uses of `muxer` are updated to reflect this change.
Verification successful --- The search for references to `MultiplexingPluginPanel` in the `AlertHubPanel.java` file returned no results, confirming that this class is no longer referenced in the file. This aligns with the expected update where `WatchdogMuxer` should replace `MultiplexingPluginPanel`. Therefore, the constructor change appears to have been implemented correctly. - No references to `MultiplexingPluginPanel` found in `AlertHubPanel.java`.
Scripts Executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Search for any remaining references to MultiplexingPluginPanel in AlertHubPanel.java rg "MultiplexingPluginPanel" src/main/java/com/adamk33n3r/runelite/watchdog/hub/AlertHubPanel.java ``` Length of output: 98
src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogPlugin.java (2)
`165-177`: Navigation buttons are correctly initialized with appropriate icons and tooltips. Ensure that the icons represent the correct state (enabled/disabled). --- `209-230`: The logic to switch between enabled and disabled navigation buttons based on the banned area status is correctly implemented. Monitor for any edge cases or unexpected behavior during runtime.
src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogPanel.java (2)
`64-64`: `WatchdogMuxer` is correctly instantiated and used within `WatchdogPanel`. This aligns with the changes in other parts of the application. --- `107-116`: The logic to update the title color and tooltip based on the banned area status is correctly implemented. Ensure that the tooltip provides accurate and helpful information to the user.
Verification successful ``` --- The tooltip generation logic in the code dynamically fetches names from the `Region` enum and correctly formats them as a comma-separated list. This matches the intended functionality as described in the review comment. The script output confirms that the `Region` enum contains the expected region names, although it also includes some numeric codes and the word "public" due to the script capturing extra lines. However, these do not affect the tooltip's correctness since the code uses a method (`Region::name`) that should correctly extract only the names. - The tooltip accurately reflects the list of banned areas as dynamically fetched from the `Region` enum.
Scripts Executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Verify that the tooltip information is accurate and matches the list of banned areas. echo "Check tooltip accuracy against the list of banned areas." ``` Length of output: 122 --- --- Script: ```shell #!/bin/bash # Extract the names of the regions from the Region enum and print them fd "Region.java" --exec cat {} | grep 'public enum Region' -A 20 | grep -oP '(?<=,|^)\s*\K\w+' ``` Length of output: 288
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.