feat: shift+click claim all, ESC close, notification toggle - #66
Conversation
- Shift+左键一键领取邮件所有附件 - ESC直接关闭MailViewerMenu,不强制弹回收件箱 - 新增enableMailNotification配置项控制邮件通知开关 - 新增shiftLeftClickTo和clickActionClaimAll消息配置
|
Warning Review limit reached
Next review available in: 54 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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.
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))); |
| } | ||
|
|
||
| public static void checkNotify(Player player, PlayerMailUser user, boolean login) { | ||
| if (!config().enableMailNotification) return; |
| 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()) { |
There was a problem hiding this comment.
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();
}
}| protected void onClose(@NotNull Player player, @Nullable InventoryView inventory) { | ||
| if (openPreviousMenu) { | ||
| setNextMenu(new InboxMenu(player, owner)); | ||
| } | ||
| // ESC直接关闭,不强制弹回收件箱 | ||
| } |
There was a problem hiding this comment.
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.
UI Improvements
Shift+Left Click Claim All Attachments
ESC Close Behavior
Mail Notification Toggle
Use Cases