adamk33n3r / runelite-watchdog

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

fix: add request focus section to config prop #153

Closed adamk33n3r closed 6 months ago

adamk33n3r commented 6 months ago

also optimized imports as it's been a while

Summary by CodeRabbit

coderabbitai[bot] commented 6 months ago

Walkthrough

The recent updates primarily focus on refining import statements across various Java files in the project. The changes involve removing unnecessary wildcard imports and replacing them with specific class imports to improve code clarity and maintainability. Additionally, an unused import was removed, further streamlining the codebase.

Changes

File Path Change Summary
src/main/java/com/.../watchdog/ui/panels/HistoryPanel.java Removed the import of com.google.common.base.Splitter.
src/main/java/com/.../watchdog/ui/panels/NotificationsPanel.java Replaced wildcard imports from the java.awt package with specific imports for BorderLayout and Dimension.
src/main/java/com/.../watchdog/ui/panels/ToolsPanel.java Replaced wildcard imports from javax.swing and java.awt packages with specific imports for JButton, JLabel, JPanel, BorderLayout, and Dimension.

Recent Review Details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between 20f2be87f241586b3241b9ed1b3a8ef5324ff2c4 and 19cb56e840c068c15f4a58178f7642789a7a27f0.
Files selected for processing (40) * src/main/java/com/adamk33n3r/runelite/watchdog/FlashOverlay.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/GameMessageType.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/NotificationOverlay.java (2 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/PlayerChatType.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/SoundItem.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/SoundPlayer.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/TrayNotifier.java (2 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/Util.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogConfig.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogPanel.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogPlugin.java (2 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/hub/AlertHubClient.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/notifications/GameMessage.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/notifications/Notification.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/notifications/Overhead.java (2 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/notifications/RequestFocus.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/notifications/ScreenFlash.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/notifications/Sound.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/notifications/SoundEffect.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/AlertListItem.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/ComparableNumber.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/MessagePickerDialog.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/alerts/LocationAlertPanel.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/alerts/NotificationPickerButton.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/alerts/StatChangedAlertPanel.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/alerts/XPDropAlertPanel.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/panels/DismissOverlayNotificationPanel.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/panels/NotificationPanel.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/panels/ScreenMarkerNotificationPanel.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/panels/SoundNotificationPanel.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerCreationOverlay.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerMouseListener.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerOverlay.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerRenderable.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerUtil.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerWidgetHighlightOverlay.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/AlertListPanel.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/HistoryPanel.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/NotificationsPanel.java (1 hunks) * src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/ToolsPanel.java (1 hunks)
Files skipped from review due to trivial changes (28) * src/main/java/com/adamk33n3r/runelite/watchdog/FlashOverlay.java * src/main/java/com/adamk33n3r/runelite/watchdog/GameMessageType.java * src/main/java/com/adamk33n3r/runelite/watchdog/SoundItem.java * src/main/java/com/adamk33n3r/runelite/watchdog/SoundPlayer.java * src/main/java/com/adamk33n3r/runelite/watchdog/TrayNotifier.java * src/main/java/com/adamk33n3r/runelite/watchdog/Util.java * src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogPlugin.java * src/main/java/com/adamk33n3r/runelite/watchdog/hub/AlertHubClient.java * src/main/java/com/adamk33n3r/runelite/watchdog/notifications/Notification.java * src/main/java/com/adamk33n3r/runelite/watchdog/notifications/RequestFocus.java * src/main/java/com/adamk33n3r/runelite/watchdog/notifications/ScreenFlash.java * src/main/java/com/adamk33n3r/runelite/watchdog/notifications/Sound.java * src/main/java/com/adamk33n3r/runelite/watchdog/notifications/SoundEffect.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/MessagePickerDialog.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/alerts/LocationAlertPanel.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/alerts/NotificationPickerButton.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/alerts/StatChangedAlertPanel.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/alerts/XPDropAlertPanel.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/panels/DismissOverlayNotificationPanel.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/panels/NotificationPanel.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/panels/ScreenMarkerNotificationPanel.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerCreationOverlay.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerMouseListener.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerRenderable.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerWidgetHighlightOverlay.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/HistoryPanel.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/NotificationsPanel.java * src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/ToolsPanel.java
Additional comments not posted (11)
src/main/java/com/adamk33n3r/runelite/watchdog/notifications/GameMessage.java (1)
`14-14`: Use of Lombok annotations enhances maintainability and readability.
src/main/java/com/adamk33n3r/runelite/watchdog/notifications/Overhead.java (1)
`14-14`: Use of Lombok's `@Accessors(chain = true)` for fluent setters is a good practice.
src/main/java/com/adamk33n3r/runelite/watchdog/PlayerChatType.java (1)
Line range hint `1-39`: Ensure the logic in `PlayerChatType` aligns with the intended chat categorization functionality.
Verification successful To verify the logic in `PlayerChatType` aligns with the intended chat categorization functionality, we need to review the implementation of `PlayerChatType` and its usage in the identified files. Let's start by examining the implementation of `PlayerChatType` and then check its usage in the files listed in the search results. --- The implementation and usage of the `PlayerChatType` enum have been thoroughly reviewed. The enum categorizes different types of chat messages and includes a static block to handle the `ANY` type. The usage in various files such as `AlertManager`, `MessagePickerButton`, `PlayerChatAlertPanel`, `PlayerChatAlert`, and `EventHandler` aligns with the intended functionality of categorizing and handling different chat message types. - **Implementation of `PlayerChatType`**: The enum correctly defines various chat types and includes a static block to handle the `ANY` type by aggregating all other chat message types. - **Usage in `AlertManager`**: The `PlayerChatType` is used to set the type of chat messages for different alerts, ensuring that the alerts are categorized correctly. - **Usage in `MessagePickerButton`**: The `PlayerChatType` is used to filter messages based on their type when creating a player chat picker button. - **Usage in `PlayerChatAlertPanel`**: The `PlayerChatType` is used to set and get the type of chat messages for alerts in the UI panel. - **Usage in `PlayerChatAlert`**: The `PlayerChatType` is used to define the type of chat messages that trigger the alert. - **Usage in `EventHandler`**: The `PlayerChatType` is used to filter and process chat messages based on their type. The logic in `PlayerChatType` aligns with the intended chat categorization functionality.
Scripts Executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Description: Verify the logic of PlayerChatType enum. # Test: Search for the usage of PlayerChatType enum. Expect: Correct usage in context. rg --type java $'PlayerChatType' ``` Length of output: 2501 --- --- Script: ```shell #!/bin/bash # Description: Retrieve the implementation details of PlayerChatType and its usage in the identified files. # Get the implementation of PlayerChatType echo "Implementation of PlayerChatType:" rg --type java --context 10 'public enum PlayerChatType' src/main/java/com/adamk33n3r/runelite/watchdog/PlayerChatType.java # Get the usage of PlayerChatType in AlertManager echo -e "\nUsage in AlertManager:" rg --type java --context 10 'PlayerChatType' src/main/java/com/adamk33n3r/runelite/watchdog/AlertManager.java # Get the usage of PlayerChatType in MessagePickerButton echo -e "\nUsage in MessagePickerButton:" rg --type java --context 10 'PlayerChatType' src/main/java/com/adamk33n3r/runelite/watchdog/ui/alerts/MessagePickerButton.java # Get the usage of PlayerChatType in PlayerChatAlertPanel echo -e "\nUsage in PlayerChatAlertPanel:" rg --type java --context 10 'PlayerChatType' src/main/java/com/adamk33n3r/runelite/watchdog/ui/alerts/PlayerChatAlertPanel.java # Get the usage of PlayerChatType in PlayerChatAlert echo -e "\nUsage in PlayerChatAlert:" rg --type java --context 10 'PlayerChatType' src/main/java/com/adamk33n3r/runelite/watchdog/alerts/PlayerChatAlert.java # Get the usage of PlayerChatType in EventHandler echo -e "\nUsage in EventHandler:" rg --type java --context 10 'PlayerChatType' src/main/java/com/adamk33n3r/runelite/watchdog/EventHandler.java ``` Length of output: 9725
src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/panels/SoundNotificationPanel.java (1)
`13-15`: Proper use of Swing components for building the sound notification UI.
src/main/java/com/adamk33n3r/runelite/watchdog/ui/ComparableNumber.java (1)
`11-13`: Proper use of Swing components for building the comparable number UI.
src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerOverlay.java (1)
`39-47`: Proper use of Lombok annotations and Java AWT components for rendering screen markers.
src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerUtil.java (1)
`10-18`: Added imports for Gson, Lombok, and Java AWT classes. Ensure these are utilized effectively within the file to avoid unnecessary imports.
Verification successful --- The imports for Gson, Lombok, and Java AWT classes are indeed utilized within the `ScreenMarkerUtil.java` file. Here are the specific usages: - **Gson**: Used as a private field. - **Lombok**: Annotations `@Getter` and `@Setter` are used on various fields. - **Java AWT**: Classes `Dimension` and `Point` are used for defining default sizes and locations. These imports are effectively utilized within the file. -
Scripts Executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Description: Verify the usage of newly added imports in ScreenMarkerUtil.java. # Test: Search for the usage of Gson, Lombok, and AWT classes. Expect: At least one usage of each import. rg --type java --files-with-matches -- 'Gson|Getter|Setter|Dimension|Point' src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerUtil.java ``` Length of output: 275 --- --- Script: ```shell #!/bin/bash # Description: Extract lines containing the usage of Gson, Lombok, and AWT classes in ScreenMarkerUtil.java. # Extract lines with usage of Gson, Lombok, and AWT classes. rg --type java -- 'Gson|Getter|Setter|Dimension|Point' src/main/java/com/adamk33n3r/runelite/watchdog/ui/notifications/screenmarker/ScreenMarkerUtil.java ``` Length of output: 671
src/main/java/com/adamk33n3r/runelite/watchdog/ui/AlertListItem.java (1)
`15-15`: Added imports for Lombok's `Setter` and AWT layout managers. Verify that these are used appropriately in the class to manage properties and layout respectively. Also applies to: 20-21
Verification successful --- The imports for Lombok's `Setter` and AWT layout managers (`BorderLayout` and `FlowLayout`) are indeed used in the `AlertListItem.java` file. The `@Setter` annotation is applied to a field, and the layout managers are used to set up the UI components. - `@Setter` is used to generate setter methods for fields. - `BorderLayout` and `FlowLayout` are used to manage the layout of various UI components within the class. These usages confirm that the imports are appropriate and necessary for the functionality implemented in the class.
Scripts Executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Description: Verify the usage of Lombok's Setter and AWT layout managers in AlertListItem.java. # Test: Search for the usage of Setter, BorderLayout, and FlowLayout. Expect: At least one usage of each import. rg --type java --files-with-matches -- 'Setter|BorderLayout|FlowLayout' src/main/java/com/adamk33n3r/runelite/watchdog/ui/AlertListItem.java ``` Length of output: 211 --- --- Script: ```shell #!/bin/bash # Extract lines containing @Setter, BorderLayout, and FlowLayout from AlertListItem.java rg --type java '@Setter|BorderLayout|FlowLayout' src/main/java/com/adamk33n3r/runelite/watchdog/ui/AlertListItem.java ``` Length of output: 756
src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/AlertListPanel.java (1)
`21-23`: Added imports for AWT layout managers. Ensure these are used effectively within the panel to manage its layout.
Verification successful --- The imports for `BorderLayout`, `Dimension`, and `FlowLayout` are effectively used within the `AlertListPanel.java` file. The code includes multiple instances where these layout managers are applied to manage the UI layout. - `BorderLayout` is used for setting the layout of the main panel and several sub-panels. - `Dimension` is used to set the preferred size of a panel. - `FlowLayout` is used to manage the layout of a sub-panel with specific alignment and spacing.
Scripts Executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Description: Verify the usage of AWT layout managers in AlertListPanel.java. # Test: Search for the usage of BorderLayout, Dimension, and FlowLayout. Expect: At least one usage of each import. rg --type java --files-with-matches -- 'BorderLayout|Dimension|FlowLayout' src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/AlertListPanel.java ``` Length of output: 230 --- --- Script: ```shell #!/bin/bash # Extract lines containing BorderLayout, Dimension, and FlowLayout from AlertListPanel.java rg 'BorderLayout|Dimension|FlowLayout' src/main/java/com/adamk33n3r/runelite/watchdog/ui/panels/AlertListPanel.java ``` Length of output: 820
src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogPanel.java (1)
`9-12`: Added imports for various panels. Verify that these panels are integrated effectively into the `WatchdogPanel` to enhance its functionality.
Verification successful --- The imported panels `AlertListPanel`, `HistoryPanel`, `PanelUtils`, and `ToolsPanel` are effectively integrated into the `WatchdogPanel` class, enhancing its functionality. - `AlertListPanel` is instantiated and assigned to `alertListPanel`. - `HistoryPanel` and `ToolsPanel` are used with `Provider`. - `PanelUtils` is used to create various buttons and an alert drop-down button.
Scripts Executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Description: Verify the integration of imported panels in WatchdogPanel.java. # Test: Search for the usage of AlertListPanel, HistoryPanel, PanelUtils, and ToolsPanel. Expect: At least one usage of each import. rg --type java --files-with-matches -- 'AlertListPanel|HistoryPanel|PanelUtils|ToolsPanel' src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogPanel.java ``` Length of output: 224 --- --- Script: ```shell #!/bin/bash # Description: Extract code snippets showing the usage of imported panels in WatchdogPanel.java. # Extract lines where AlertListPanel, HistoryPanel, PanelUtils, and ToolsPanel are used. rg --type java -- 'AlertListPanel|HistoryPanel|PanelUtils|ToolsPanel' src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogPanel.java ``` Length of output: 1374
src/main/java/com/adamk33n3r/runelite/watchdog/WatchdogConfig.java (1)
`423-424`: Added a new configuration item for default force focus. This aligns with the PR's objective to add a request focus section to the configuration properties. Ensure this new setting is properly documented and integrated into the application's configuration management.
--- 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.