Skip to content

feat: shift+click claim all, ESC close, notification toggle - #66

Open
windy664 wants to merge 1 commit into
ikafly144:masterfrom
windy664:feat/ui-improvements-and-notification-toggle
Open

feat: shift+click claim all, ESC close, notification toggle#66
windy664 wants to merge 1 commit into
ikafly144:masterfrom
windy664:feat/ui-improvements-and-notification-toggle

Conversation

@windy664

Copy link
Copy Markdown

UI Improvements

Shift+Left Click Claim All Attachments

  • Shift+左键一键领取邮件所有附件
  • New config messages:
    • shiftLeftClickTo: "Shift+Left Click to {action}"
    • clickActionClaimAll: "Claim All Attachments"
  • Lore shows claim hint when mail has unclaimed attachments

ESC Close Behavior

  • MailViewerMenu: ESC直接关闭,不强制弹回收件箱
  • Previous behavior: onClose always opened InboxMenu
  • New behavior: onClose does nothing, player returns to previous state

Mail Notification Toggle

  • New config option: enableMailNotification (default: false)
  • ScheduleManager.checkNotify respects this setting
  • When false, no login/join mail notifications shown

Use Cases

  • Quickly claim all attachments from reward mails
  • More natural ESC behavior (close = close, not navigate)
  • Disable notifications for servers with frequent automated mails

- Shift+左键一键领取邮件所有附件
- ESC直接关闭MailViewerMenu,不强制弹回收件箱
- 新增enableMailNotification配置项控制邮件通知开关
- 新增shiftLeftClickTo和clickActionClaimAll消息配置
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@windy664, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2e1a15f6-0ac0-4630-b699-0dfeee560722

📥 Commits

Reviewing files that changed from the base of the PR and between de9adac and b6738c5.

📒 Files selected for processing (3)
  • paper/src/main/java/net/sabafly/mailBox/menu/InboxMenu.java
  • paper/src/main/java/net/sabafly/mailBox/menu/MailViewerMenu.java
  • paper/src/main/java/net/sabafly/mailBox/schedule/ScheduleManager.java
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a feature to claim all mail attachments at once using Shift+Left Click, disables automatic redirection back to the inbox when closing the mail viewer, and adds a configuration check for mail notifications. The review feedback highlights critical compilation errors due to missing configuration fields (shiftLeftClickTo, clickActionClaimAll, and enableMailNotification in Config.java). Additionally, it points out potential performance issues from synchronous database updates in a loop, redundant UI refreshes, and a UX regression where players can no longer easily navigate back to the inbox from the mail viewer.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

.collect(Collectors.toCollection(ArrayList::new));
long claimable = mail.getAttachmentsInternal().stream().filter(a -> a.canOpen()).count();
if (claimable > 0) {
lore.addFirst(miniMessage().deserialize(config().messages.shiftLeftClickTo.replace("{action}", config().messages.clickActionClaimAll)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The fields shiftLeftClickTo and clickActionClaimAll are referenced here on config().messages, but they are not defined in the Config.Messages class in Config.java. This will cause a compilation error. Please ensure these fields are added to Config.java.

}

public static void checkNotify(Player player, PlayerMailUser user, boolean login) {
if (!config().enableMailNotification) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The field enableMailNotification is referenced on config(), but it is not defined in the Config class in Config.java. This will cause a compilation error. Please add public boolean enableMailNotification = false; (or similar) to Config.java.

Comment on lines +112 to +122
if (clickType.isShiftClick() && clickType.isLeftClick()) {
// Shift+左键:一键领取该邮件所有附件
for (var attachment : mail.getAttachmentsInternal()) {
if (attachment.canOpen()) {
attachment.apply(viewer);
attachment.setOpened(true);
database().updateMailAttachment(mail, attachment);
}
}
refresh();
} else if (clickType.isLeftClick()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There are two opportunities for improvement here:\n\n1. Performance: Performing database updates (database().updateMailAttachment) synchronously inside a loop on the main server thread can cause significant lag spikes (especially if using a remote MySQL database and the mail has many attachments). Consider batching these updates or running them asynchronously if possible.\n2. Redundant Refresh: Currently, refresh() is called even if no attachments were actually claimed (e.g., if all were already opened or expired). We can track if any attachment was successfully claimed and only refresh if needed.

                if (clickType.isShiftClick() && clickType.isLeftClick()) {
                    // Shift+左键:一键领取该邮件所有附件
                    boolean updated = false;
                    for (var attachment : mail.getAttachmentsInternal()) {
                        if (attachment.canOpen()) {
                            attachment.apply(viewer);
                            attachment.setOpened(true);
                            database().updateMailAttachment(mail, attachment);
                            updated = true;
                        }
                    }
                    if (updated) {
                        refresh();
                    }
                }

Comment on lines 65 to 67
protected void onClose(@NotNull Player player, @Nullable InventoryView inventory) {
if (openPreviousMenu) {
setNextMenu(new InboxMenu(player, owner));
}
// ESC直接关闭,不强制弹回收件箱
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

By removing the automatic return to the InboxMenu on close, and because there is no "Back" button in the MailViewerMenu UI, players will have no way to return to their inbox after viewing a mail other than closing the GUI and running the /mail command again.\n\nTo improve the user experience, consider adding a "Back" button (e.g., using the inboxButton item from the config) in the MailViewerMenu so players can easily navigate back to the inbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant