Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-870 Add /msgtoggle command #896

Merged
merged 30 commits into from
Feb 14, 2025
Merged

GH-870 Add /msgtoggle command #896

merged 30 commits into from
Feb 14, 2025

Conversation

CitralFlo
Copy link
Member

To clarify:
ON - true - means that the player has turned on msgToggle and has blocked getting private messages
OFF - false - means that the player has turned off msgToggle and has allowed getting private messages

@CitralFlo CitralFlo linked an issue Jan 22, 2025 that may be closed by this pull request
Copy link
Contributor

coderabbitai bot commented Jan 22, 2025

Walkthrough

This update introduces a new /msgtoggle command to the chat features, allowing players to manage their private message settings. A new enum, PrivateChatState, has been added to indicate whether private messages are enabled or disabled. Several service interfaces and repository implementations have been introduced to handle chat state management asynchronously. The logic for sending private messages has been updated to check the recipient's message state, notifying the sender if private messages are disabled. Additionally, enhancements to the messaging components in English and Polish ensure that appropriate notifications are displayed when private messages are toggled on or off.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6227fa3 and 5a41247.

📒 Files selected for processing (1)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateCommand.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateCommand.java

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (6)
eternalcore-api/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleService.java (1)

6-12: Add documentation to explain the interface's purpose.

Adding some simple comments would help other developers understand what this interface does and how to use it.

 public interface MsgToggleService {
+    /**
+     * Checks if a player has message toggle enabled
+     * @param uuid Player's UUID
+     * @return Future containing true if messages are toggled off
+     */
     CompletableFuture<Boolean> hasMsgToggled(UUID uuid);

+    /**
+     * Updates a player's message toggle state
+     * @param uuid Player's UUID
+     * @param toggle True to enable message blocking, false to disable
+     */
     void toggleMsg(UUID uuid, boolean toggle);
 }
eternalcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleRepository.java (1)

10-10: Make method name clearer.

The name setToggledOff might be confusing when used with false. Consider renaming it to setToggleState to better reflect its purpose.

-    CompletableFuture<Void> setToggledOff(UUID uuid, boolean toggledOff);
+    CompletableFuture<Void> setToggleState(UUID uuid, boolean enabled);
eternalcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleServiceImpl.java (1)

26-29: Consider removing @Blocking annotation

The @Blocking annotation might be misleading here since the repository operation could be asynchronous.

eternalcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleRepositoryOrmLite.java (1)

31-34: Simplify CompletableFuture chain

The thenApply(status -> null) can be replaced with thenRun(() -> {}) for better readability.

-    public CompletableFuture<Void> setToggledOff(UUID uuid, boolean toggledOff) {
-        return this.save(MsgToggleWrapper.class, new MsgToggleWrapper(uuid, toggledOff))
-            .thenApply(status -> null);
-    }
+    public CompletableFuture<Void> setToggledOff(UUID uuid, boolean toggledOff) {
+        return this.save(MsgToggleWrapper.class, new MsgToggleWrapper(uuid, toggledOff))
+            .thenRun(() -> {});
+    }
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (1)

62-78: Improve async operation flow

The nested async operations can be flattened using CompletableFuture's composition methods for better readability.

-        this.msgToggleService.hasMsgToggled(uniqueId).thenAccept(hasMsgToggled -> {
-            if (hasMsgToggled) {
-                this.noticeService.player(sender.getUniqueId(), translation -> translation.privateChat().msgToggledOff());
-
-                return;
-            }
-
-            this.ignoreService.isIgnored(uniqueId, sender.getUniqueId()).thenAccept(isIgnored -> {
-                if (!isIgnored) {
-                    this.replies.put(uniqueId, sender.getUniqueId());
-                    this.replies.put(sender.getUniqueId(), uniqueId);
-                }
-
-                PrivateChatEvent event = new PrivateChatEvent(sender.getUniqueId(), uniqueId, message);
-                this.eventCaller.callEvent(event);
-                this.presenter.onPrivate(new PrivateMessage(sender, target, event.getContent(), this.socialSpy, isIgnored));
-            });
-        });
+        this.msgToggleService.hasMsgToggled(uniqueId)
+            .thenCompose(hasMsgToggled -> {
+                if (hasMsgToggled) {
+                    this.noticeService.player(sender.getUniqueId(), translation -> translation.privateChat().msgToggledOff());
+                    return CompletableFuture.completedFuture(null);
+                }
+                return this.ignoreService.isIgnored(uniqueId, sender.getUniqueId())
+                    .thenAccept(isIgnored -> {
+                        if (!isIgnored) {
+                            this.replies.put(uniqueId, sender.getUniqueId());
+                            this.replies.put(sender.getUniqueId(), uniqueId);
+                        }
+                        PrivateChatEvent event = new PrivateChatEvent(sender.getUniqueId(), uniqueId, message);
+                        this.eventCaller.callEvent(event);
+                        this.presenter.onPrivate(new PrivateMessage(sender, target, event.getContent(), this.socialSpy, isIgnored));
+                    });
+            });
eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java (1)

499-507: Consider standardizing color usage across messages.

While the messages are clear, the color usage could be more consistent:

  • Some messages use <red>disabled while others use <green>enabled
  • The player name highlighting varies between messages

Consider standardizing to:

-        public Notice msgToggledOff = Notice.chat("<red>► <dark_red>This player has disabled private messages!");
+        public Notice msgToggledOff = Notice.chat("<red>► <white>This player has <red>disabled</red> private messages!");

-        public Notice msgToggledSelf = Notice.chat("<green>► <white>Private messages have been <red>disabled<white>!");
+        public Notice msgToggledSelf = Notice.chat("<green>► <white>Private messages have been <red>disabled</red>!");

-        public Notice msgUntoggleSelf = Notice.chat("<green>► <white>Private messages have been <green>enabled<white>!");
+        public Notice msgUntoggleSelf = Notice.chat("<green>► <white>Private messages have been <green>enabled</green>!");
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 046c0df and aa1ff47.

📒 Files selected for processing (12)
  • README.md (1 hunks)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggle.java (1 hunks)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleService.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleCommand.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleRepository.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleRepositoryOrmLite.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleServiceImpl.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleWrapper.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (4 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/translation/Translation.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/PLTranslation.java (1 hunks)
🔇 Additional comments (7)
eternalcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleServiceImpl.java (1)

20-23: Implementation looks good!

Clean and straightforward implementation of the message toggle service.

eternalcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleRepositoryOrmLite.java (1)

23-28: Verify default value choice

The method returns true by default, which means messages are blocked by default. Is this the intended behavior?

eternalcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleCommand.java (1)

14-16: Well-structured command implementation!

Clear command descriptions and good separation between self and other-player operations.

Also applies to: 32-34, 47-48, 57-59, 69-71

eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (1)

41-42: Clean integration of MsgToggleService!

The message toggle feature is well integrated with the existing private chat system.

Also applies to: 48-48

README.md (1)

43-43: LGTM! Documentation updated appropriately.

The new /msgtoggle command is properly documented in the features list.

eternalcore-core/src/main/java/com/eternalcode/core/translation/Translation.java (1)

263-267: LGTM! Well-structured interface additions.

The new message toggle methods follow a consistent naming pattern and clearly indicate their purpose.

eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/PLTranslation.java (1)

508-515: LGTM! Well-structured Polish translations.

The Polish translations are properly localized while maintaining consistency with the English version.

@CitralFlo CitralFlo changed the title Add /msgtoggle command GH-870 Add /msgtoggle command Jan 22, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleState.java (2)

3-5: Clarify the Javadoc description.

The Javadoc should clearly state what ENABLED and DISABLED mean in terms of message reception.

-/**
- * Enum representing state of blocking incoming private messages by the player.
- */
+/**
+ * Enum representing whether a player can receive private messages.
+ */

8-16: Improve state documentation.

The Javadoc for each state should be more explicit about its effect on message reception.

-    /**
-     * State that represents that the player can be messaged by other players.
-     */
-    ENABLED,
-
-    /**
-     * State that represents that the player has disabled incoming private messages.
-     */
-    DISABLED
+    /**
+     * Player can receive private messages.
+     */
+    ENABLED,
+
+    /**
+     * Player cannot receive private messages.
+     */
+    DISABLED
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java (1)

77-77: Use reference equality for enum comparison.

Use == instead of equals() for enum comparison.

-        if (state.equals(PrivateChatToggleState.DISABLED)) {
+        if (state == PrivateChatToggleState.DISABLED) {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f22fe08 and 98cb286.

📒 Files selected for processing (5)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleState.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (4 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleRepositoryOrmLite.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleRepositoryOrmLite.java
🧰 Additional context used
📓 Learnings (2)
eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleState.java (2)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java:92-102
Timestamp: 2025-01-28T21:37:36.945Z
Learning: In the EternalCore plugin's private chat feature, PrivateChatToggleState.ON means message blocking is enabled (no messages will be received), while PrivateChatToggleState.OFF means messages are allowed.
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java:1-1
Timestamp: 2025-01-30T19:49:57.192Z
Learning: In the EternalCore project's private chat toggle feature, PrivateChatToggleState.ON means messages are blocked, while OFF means messages are allowed.
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java (2)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java:92-102
Timestamp: 2025-01-28T21:37:36.945Z
Learning: In the EternalCore plugin's private chat feature, PrivateChatToggleState.ON means message blocking is enabled (no messages will be received), while PrivateChatToggleState.OFF means messages are allowed.
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java:1-1
Timestamp: 2025-01-30T19:49:57.192Z
Learning: In the EternalCore project's private chat toggle feature, PrivateChatToggleState.ON means messages are blocked, while OFF means messages are allowed.
🔇 Additional comments (5)
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java (1)

39-46: 🛠️ Refactor suggestion

Use reference equality for enum comparison and add error handling.

Use == for enum comparison and handle potential async failures.

-            privateChatToggleState.thenAccept(toggleState -> {
-                if (toggleState == PrivateChatToggleState.DISABLED) {
-                    this.enable(uniqueId);
-                }
-                else {
-                    this.disable(uniqueId);
-                }
-            });
+            privateChatToggleState
+                .thenAccept(toggleState -> {
+                    if (toggleState == PrivateChatToggleState.DISABLED) {
+                        this.enable(uniqueId);
+                    }
+                    else {
+                        this.disable(uniqueId);
+                    }
+                })
+                .exceptionally(throwable -> {
+                    this.noticeService.create()
+                        .notice(translation -> translation.general().error())
+                        .player(uniqueId)
+                        .send();
+                    return null;
+                });

Likely invalid or redundant comment.

eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java (1)

500-508: LGTM!

The messages are clear and provide good feedback to users about their private message settings.

eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (3)

5-6: Looks good! Clean import and field additions.

The new imports and field for the toggle service are well-organized and properly placed.

Also applies to: 29-29


42-44: Nice work on the constructor updates!

The new toggle service is properly injected and initialized.

Also applies to: 49-49


61-80: Let's make the async code more robust!

The toggle check works, but we should handle potential errors and simplify the nested operations.

Previous review comments already suggested:

  1. Adding exception handling for the async operations
  2. Using thenCompose to flatten the nested structure

Please refer to the previous review comments for the detailed implementation suggestions.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98cb286 and f9cd9b7.

📒 Files selected for processing (3)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleState.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (4 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleState.java
🧰 Additional context used
📓 Learnings (1)
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java (2)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java:92-102
Timestamp: 2025-01-28T21:37:36.945Z
Learning: In the EternalCore plugin's private chat feature, PrivateChatToggleState.ON means message blocking is enabled (no messages will be received), while PrivateChatToggleState.OFF means messages are allowed.
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java:1-1
Timestamp: 2025-01-30T19:49:57.192Z
Learning: In the EternalCore project's private chat toggle feature, PrivateChatToggleState.ON means messages are blocked, while OFF means messages are allowed.
🔇 Additional comments (6)
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (3)

5-6: LGTM!

The new imports and field for toggle service are properly organized.

Also applies to: 29-29


42-43: LGTM!

Constructor properly initializes the new toggle service.

Also applies to: 49-49


63-80: 🛠️ Refactor suggestion

Add error handling for async operations.

The async operations could fail silently. Add error handling to inform users when operations fail.

         this.privateChatToggleService.getPrivateChatToggleState(uniqueId).thenAccept(privateChatToggleState -> {
             if (privateChatToggleState.equals(PrivateChatToggleState.DISABLED)) {
                 this.noticeService.player(sender.getUniqueId(), translation -> translation.privateChat().receiverDisabledMessages());
                 return;
             }
             this.ignoreService.isIgnored(uniqueId, sender.getUniqueId()).thenAccept(isIgnored -> {
                 // ... existing code ...
-            });
+            }).exceptionally(throwable -> {
+                this.noticeService.player(sender.getUniqueId(), translation -> translation.general().error());
+                return null;
+            });
-        });
+        }).exceptionally(throwable -> {
+            this.noticeService.player(sender.getUniqueId(), translation -> translation.general().error());
+            return null;
+        });

Likely invalid or redundant comment.

eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java (3)

76-101: LGTM!

The method is well-structured with clear separation of concerns.


103-126: LGTM!

The utility methods are well-implemented with clear responsibilities.


36-49: 🛠️ Refactor suggestion

Add error handling and optimize state comparison.

The async operation needs error handling, and state comparison can be simplified.

         if (state == null) {
             CompletableFuture<PrivateChatToggleState> privateChatToggleState = this.privateChatToggleService.getPrivateChatToggleState(sender.getUniqueId());

             privateChatToggleState.thenAccept(toggleState -> {
-                if (toggleState == PrivateChatToggleState.DISABLED) {
+                if (toggleState == PrivateChatToggleState.DISABLED) {
                     this.enable(uniqueId);
                 }
                 else {
                     this.disable(uniqueId);
                 }
-            });
+            }).exceptionally(throwable -> {
+                this.noticeService.create()
+                    .notice(translation -> translation.general().error())
+                    .sender(sender)
+                    .send();
+                return null;
+            });

Likely invalid or redundant comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (1)

42-43: Consider adding null check for the new service.

The constructor should validate that the injected service is not null.

     PrivateChatServiceImpl(
         NoticeService noticeService,
         IgnoreService ignoreService,
         UserManager userManager,
         EventCaller eventCaller,
         PrivateChatToggleService privateChatToggleService
     ) {
+        if (privateChatToggleService == null) {
+            throw new IllegalArgumentException("privateChatToggleService cannot be null");
+        }
         this.privateChatToggleService = privateChatToggleService;

Also applies to: 49-49

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f9cd9b7 and 39b6dfc.

📒 Files selected for processing (5)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleState.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (4 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleRepositoryOrmLite.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleServiceImpl.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleState.java
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleServiceImpl.java
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleRepositoryOrmLite.java
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java
🔇 Additional comments (3)
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (3)

5-6: Looks good!

Clean additions of necessary imports and field for the toggle service.

Also applies to: 29-29


64-64: Align toggle state naming with PR description.

The PR description uses ON/OFF but the code uses DISABLE. Consider using consistent terminology.

Should this be PrivateChatToggleState.ON instead of DISABLE?


63-80: Handle CompletableFuture exceptions and simplify nested async operations.

The code could benefit from better error handling and simpler async flow.

Previous review comments already suggested:

  1. Adding exception handling for CompletableFuture
  2. Using thenCompose to simplify nested async operations

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (5)
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateRepository.java (1)

11-11: Improve parameter name clarity

The parameter name toggledOff doesn't clearly represent its purpose. Consider renaming it to state to match its type and usage.

-    CompletableFuture<Void> setPrivateChatState(UUID uuid, PrivateChatState toggledOff);
+    CompletableFuture<Void> setPrivateChatState(UUID uuid, PrivateChatState state);
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateWrapper.java (1)

27-29: Rename method to match return type

The method name isEnabled suggests a boolean return but returns PrivateChatState.

-    PrivateChatState isEnabled() {
+    PrivateChatState getState() {
         return this.state;
     }
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (1)

13-13: Consider adding cache eviction strategy

The cache might grow too large over time. Consider adding size limits or TTL for entries.

eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (1)

63-80: Simplify nested async operations.

The nested async operations can be flattened using thenCompose for better readability.

-        this.privateChatStateService.getPrivateChatState(uniqueId).thenAccept(privateChatState -> {
-            if (privateChatState == PrivateChatState.DISABLE) {
-                this.noticeService.player(sender.getUniqueId(), translation -> translation.privateChat().receiverDisabledMessages());
-                return;
-            }
-            this.ignoreService.isIgnored(uniqueId, sender.getUniqueId()).thenAccept(isIgnored -> {
+        this.privateChatStateService.getPrivateChatState(uniqueId)
+            .thenCompose(privateChatState -> {
+                if (privateChatState == PrivateChatState.DISABLE) {
+                    this.noticeService.player(sender.getUniqueId(), 
+                        translation -> translation.privateChat().receiverDisabledMessages());
+                    return CompletableFuture.completedFuture(null);
+                }
+                return this.ignoreService.isIgnored(uniqueId, sender.getUniqueId())
+                    .thenAccept(isIgnored -> {
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateCommand.java (1)

105-121: Reduce code duplication in notification logic.

The enable and disable methods share similar notification logic that can be extracted.

+    private void sendNotification(UUID uniqueId, boolean enabled) {
+        this.noticeService.create()
+            .notice(translation -> enabled 
+                ? translation.privateChat().selfMessagesEnabled()
+                : translation.privateChat().selfMessagesDisabled())
+            .player(uniqueId)
+            .send();
+    }
+
     private void enable(UUID uniqueId) {
         this.privateChatStateService.togglePrivateChat(uniqueId, PrivateChatState.ENABLE);
-        this.noticeService.create()
-            .notice(translation -> translation.privateChat().selfMessagesEnabled())
-            .player(uniqueId)
-            .send();
+        this.sendNotification(uniqueId, true);
     }

     private void disable(UUID uniqueId) {
         this.privateChatStateService.togglePrivateChat(uniqueId, PrivateChatState.DISABLE);
-        this.noticeService.create()
-            .notice(translation -> translation.privateChat().selfMessagesDisabled())
-            .player(uniqueId)
-            .send();
+        this.sendNotification(uniqueId, false);
     }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 39b6dfc and d72ae5c.

📒 Files selected for processing (9)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatState.java (1 hunks)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateService.java (1 hunks)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggle.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (4 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateCommand.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateRepository.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateRepositoryOrmLite.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateWrapper.java (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatState.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggle.java
🧰 Additional context used
📓 Learnings (5)
eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateService.java (1)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleServiceImpl.java:24-27
Timestamp: 2025-01-28T21:35:47.750Z
Learning: In EternalCore, async operations using CompletableFuture should remain non-blocking. Avoid using .join() or similar blocking operations to maintain better performance and scalability.
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (1)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleServiceImpl.java:24-27
Timestamp: 2025-01-28T21:35:47.750Z
Learning: In EternalCore, async operations using CompletableFuture should remain non-blocking. Avoid using .join() or similar blocking operations to maintain better performance and scalability.
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateRepositoryOrmLite.java (1)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggle.java:10-11
Timestamp: 2025-01-28T21:35:04.888Z
Learning: Fields in classes used with ORM Lite repository must have package-private (default) access modifier, not private, to allow ORM Lite to access them properly.
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateWrapper.java (1)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggle.java:10-11
Timestamp: 2025-01-28T21:35:04.888Z
Learning: Fields in classes used with ORM Lite repository must have package-private (default) access modifier, not private, to allow ORM Lite to access them properly.
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateCommand.java (2)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java:92-102
Timestamp: 2025-01-28T21:37:36.945Z
Learning: In the EternalCore plugin's private chat feature, PrivateChatToggleState.ON means message blocking is enabled (no messages will be received), while PrivateChatToggleState.OFF means messages are allowed.
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java:1-1
Timestamp: 2025-01-30T19:49:57.192Z
Learning: In the EternalCore project's private chat toggle feature, PrivateChatToggleState.ON means messages are blocked, while OFF means messages are allowed.

# Conflicts:
#	eternalcore-core/src/main/java/com/eternalcode/core/translation/Translation.java
#	eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java
#	eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/PLTranslation.java
@CitralFlo CitralFlo requested a review from Rollczi February 12, 2025 18:40
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/messages/ENPrivateMessages.java (1)

51-51: Fix typo in unIgnorePlayer message

There's a typo in the word "uningored".

-    public Notice unIgnorePlayer = Notice.chat("<red>► <dark_red>{PLAYER} <red>player has been uningored!");
+    public Notice unIgnorePlayer = Notice.chat("<red>► <dark_red>{PLAYER} <red>player has been unignored!");
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/messages/PLPrivateChatMessages.java (1)

52-52: Fix spacing in unIgnorePlayer message

The words "Od ignorowano" should be combined.

-    public Notice unIgnorePlayer = Notice.chat("<red>► <dark_red>Od ignorowano gracza <red>{PLAYER}<dark_red>!");
+    public Notice unIgnorePlayer = Notice.chat("<red>► <dark_red>Odignorowano gracza <red>{PLAYER}<dark_red>!");
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d72ae5c and dabdf7d.

📒 Files selected for processing (4)
  • README.md (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/messages/ENPrivateMessages.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/messages/PLPrivateChatMessages.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/messages/PrivateChatMessages.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md
🔇 Additional comments (3)
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/messages/PrivateChatMessages.java (1)

14-18: Nice work on the new message methods!

The new methods are well-organized and their names clearly describe their purpose.

eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/messages/ENPrivateMessages.java (1)

27-34: Great job on the new message fields!

The messages are clear and follow the existing color scheme consistently.

eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/messages/PLPrivateChatMessages.java (1)

32-39: Well-done on the Polish translations!

The messages maintain consistent formatting and are properly translated.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/messages/ENPrivateMessages.java (1)

32-34: Small spacing tweak needed

There's an extra space before "for" in both messages. Let's make them more consistent:

-    public Notice otherMessagesDisabled = Notice.chat("<green>► <white>Private messages have been <red>disabled <white>for <green>{PLAYER}<white>!");
-    public Notice otherMessagesEnabled = Notice.chat("<green>► <white>Private messages have been <green>enabled <white>for <green>{PLAYER}<white>!");
+    public Notice otherMessagesDisabled = Notice.chat("<green>► <white>Private messages have been <red>disabled<white> for <green>{PLAYER}<white>!");
+    public Notice otherMessagesEnabled = Notice.chat("<green>► <white>Private messages have been <green>enabled<white> for <green>{PLAYER}<white>!");
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (1)

22-29: Cache usage
To further optimize, consider storing the state from the repository in your cache for future lookups.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dabdf7d and 297cff4.

📒 Files selected for processing (4)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateService.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/messages/ENPrivateMessages.java (2 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateRepositoryOrmLite.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateRepositoryOrmLite.java
🧰 Additional context used
🧠 Learnings (2)
eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateService.java (1)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleServiceImpl.java:24-27
Timestamp: 2025-01-28T21:35:47.750Z
Learning: In EternalCore, async operations using CompletableFuture should remain non-blocking. Avoid using .join() or similar blocking operations to maintain better performance and scalability.
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (1)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleServiceImpl.java:24-27
Timestamp: 2025-01-28T21:35:47.750Z
Learning: In EternalCore, async operations using CompletableFuture should remain non-blocking. Avoid using .join() or similar blocking operations to maintain better performance and scalability.
🔇 Additional comments (12)
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/messages/ENPrivateMessages.java (2)

27-31: Nice work on the new message templates!

The messages are clear and use consistent colors to show different states.


51-51: Good catch on the spelling fixes!

The spelling corrections in the unignore messages look good.

Also applies to: 54-54

eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (5)

1-8: Looks tidy so far
Package and imports are well-organized. Everything appears good here.


9-10: Service annotation
Neat use of @service, which makes the implementation easy to spot.


12-14: Fields are straightforward
The final fields are nicely named and make the code easy to follow.


15-19: Dependency injection
Your constructor injection is set up cleanly.


31-40: Error rollback
Removing the cached state on failure helps keep data fresh and avoids confusion. Nicely done.

eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateService.java (5)

1-5: Async imports
Great to see CompletableFuture encouraged for non-blocking flows.


6-8: Helpful documentation
The quick summary ensures team members know what this service does.


9-16: Interface clarity
The descriptions make it simple to understand each method’s purpose.


17-17: Non-blocking retrieval
Using CompletableFuture for getPrivateChatState aligns with modern async practices.


19-25: Toggle method
Keeping togglePrivateChat async is a consistent and flexible design decision.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateService.java (1)

6-17: Add documentation about default state and null handling.

The documentation would be more helpful if it mentioned:

  • The default state when a player hasn't set any preference
  • How null values are handled
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (1)

13-13: Consider adding cache eviction strategy.

The cache might grow indefinitely since there's no eviction policy. Consider using CacheBuilder with expiration:

-    private final ConcurrentHashMap<UUID, PrivateChatState> cachedToggleStates;
+    private final Cache<UUID, PrivateChatState> cachedToggleStates = CacheBuilder.newBuilder()
+        .expireAfterAccess(Duration.ofHours(1))
+        .build();
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 297cff4 and 1b57a89.

📒 Files selected for processing (6)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateService.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/PrivateChatServiceImpl.java (4 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateCommand.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateRepositoryOrmLite.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateWrapper.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateRepositoryOrmLite.java
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateCommand.java
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateWrapper.java
🧰 Additional context used
🧠 Learnings (1)
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (1)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleServiceImpl.java:24-27
Timestamp: 2025-01-28T21:35:47.750Z
Learning: In EternalCore, async operations using CompletableFuture should remain non-blocking. Avoid using .join() or similar blocking operations to maintain better performance and scalability.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build (17)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (1)

37-42: ⚠️ Potential issue

Fix error handling in setChatState

Returning null on error could cause NullPointerException in the calling code.

         return this.msgToggleRepository.setPrivateChatState(playerUniqueId, state)
             .exceptionally(throwable -> {
                 this.cachedToggleStates.remove(playerUniqueId);
-                return null;
+                throw new CompletionException("Failed to set chat state", throwable);
             });
🧹 Nitpick comments (3)
eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatState.java (1)

18-20: Consider making invert() public

The invert() method could be useful for external code that needs to toggle states.

-    PrivateChatState invert() {
+    public PrivateChatState invert() {
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (2)

8-8: Remove unused import

ConcurrentSkipListMap is not used in this class.

-import java.util.concurrent.ConcurrentSkipListMap;

13-14: Consider adding cache eviction

The cache might grow indefinitely. Consider adding a mechanism to remove old entries.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b57a89 and 6227fa3.

📒 Files selected for processing (4)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatState.java (1 hunks)
  • eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateService.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateCommand.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateCommand.java
🧰 Additional context used
🧠 Learnings (3)
eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatState.java (2)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java:92-102
Timestamp: 2025-01-28T21:37:36.945Z
Learning: In the EternalCore plugin's private chat feature, PrivateChatToggleState.ON means message blocking is enabled (no messages will be received), while PrivateChatToggleState.OFF means messages are allowed.
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleCommand.java:1-1
Timestamp: 2025-01-30T19:49:57.192Z
Learning: In the EternalCore project's private chat toggle feature, PrivateChatToggleState.ON means messages are blocked, while OFF means messages are allowed.
eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateService.java (1)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleServiceImpl.java:24-27
Timestamp: 2025-01-28T21:35:47.750Z
Learning: In EternalCore, async operations using CompletableFuture should remain non-blocking. Avoid using .join() or similar blocking operations to maintain better performance and scalability.
eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateServiceImpl.java (1)
Learnt from: CitralFlo
PR: EternalCodeTeam/EternalCore#896
File: eternalcore-core/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatToggleServiceImpl.java:24-27
Timestamp: 2025-01-28T21:35:47.750Z
Learning: In EternalCore, async operations using CompletableFuture should remain non-blocking. Avoid using .join() or similar blocking operations to maintain better performance and scalability.
🔇 Additional comments (1)
eternalcore-api/src/main/java/com/eternalcode/core/feature/privatechat/toggle/PrivateChatStateService.java (1)

9-35: Well-designed async interface!

The interface is well structured with clear documentation and proper async patterns using CompletableFuture.

@CitralFlo CitralFlo merged commit 67101c8 into master Feb 14, 2025
3 checks passed
@CitralFlo CitralFlo deleted the msgtoggle branch February 14, 2025 16:05
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.

Add private message toggle.
5 participants