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-903 Add seen command feature #918

Merged
merged 9 commits into from
Feb 16, 2025
Merged

GH-903 Add seen command feature #918

merged 9 commits into from
Feb 16, 2025

Conversation

imDMK
Copy link
Contributor

@imDMK imDMK commented Feb 15, 2025

Closes #903

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • On localhost server

Copy link
Contributor

coderabbitai bot commented Feb 15, 2025

Warning

Rate limit exceeded

@vLuckyyy has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 23 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 71b5dca and 99ad0d5.

📒 Files selected for processing (1)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/SeenCommand.java (1 hunks)

Walkthrough

This update adds a new command for checking a player's activity, implemented in a dedicated command class. The command determines if a player is currently online, has played before, or has never joined, and then sends the appropriate message. In addition to the command logic, the update extends the translation functionality by adding a new method to the translation interface and by introducing specific message fields in the English and Polish translation classes. A new messages interface is also added to standardize the notices related to a player's online status, and separate message classes for English and Polish have been created to provide localized content.


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: 0

🧹 Nitpick comments (3)
eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/SeenCommand.java (1)

32-69: Consider using a more precise duration format.

The duration formatting could be enhanced to show more granular time units for better readability.

Apply this diff to improve duration formatting:

-        Duration lastPlayedBetween = Duration.between(Instant.ofEpochMilli(lastPlayed), Instant.now());
-        String lastPlayedFormatted = DurationUtil.format(lastPlayedBetween, true);
+        Duration duration = Duration.between(Instant.ofEpochMilli(lastPlayed), Instant.now());
+        String lastPlayedFormatted = DurationUtil.format(duration, true);
eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java (1)

170-177: Make placeholder formatting consistent.

The placeholders should follow the same style across all messages.

Apply this diff to standardize placeholder formatting:

-        public Notice neverPlayedBefore = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} have not played before on this server.");
+        public Notice neverPlayedBefore = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} <white>have not played before on this server.");
-        public Notice lastSeen =  Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} was last seen {SEEN} ago.");
+        public Notice lastSeen =  Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} <white>was last seen <green>{SEEN} <white>ago.");
-        public Notice nowOnline = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} is now online!");
+        public Notice nowOnline = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} <white>is now online!");
eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/PLTranslation.java (1)

194-201: Keep formatting consistent with English translations.

Apply the same formatting improvements as suggested for English translations.

Apply this diff to maintain consistency:

-        public Notice neverPlayedBefore = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} nie grał nigdy na tym serwerze.");
+        public Notice neverPlayedBefore = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} <white>nie grał nigdy na tym serwerze.");
-        public Notice lastSeen =  Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} był ostatnio widziany {SEEN} temu.");
+        public Notice lastSeen =  Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} <white>był ostatnio widziany <green>{SEEN} <white>temu.");
-        public Notice nowOnline = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} jest aktualnie online!");
+        public Notice nowOnline = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} <white>jest aktualnie online!");
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 17e9e0c and 0b97152.

📒 Files selected for processing (4)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/SeenCommand.java (1 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 (2)
eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/SeenCommand.java (1)

19-30: Clean command setup!

Good use of dependency injection and proper permission definition.

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

230-237: Well-structured translation interface!

The new section follows the existing pattern and provides clear message definitions.

@imDMK imDMK force-pushed the feature/seen-command branch from 0b97152 to 183053e Compare February 15, 2025 14:29
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/translation/implementation/ENTranslation.java (1)

144-152: Messages follow a consistent format and provide clear placeholders.

Each message:

  • Uses consistent styling with <dark_gray> brackets and <dark_red> Seen text
  • Has clear descriptions for placeholders
  • Provides user-friendly feedback

However, consider these minor improvements:

-        public Notice neverPlayedBefore = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} have not played before on this server.");
+        public Notice neverPlayedBefore = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} has not played before on this server.");
eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/PLTranslation.java (1)

149-161: LGTM! Clean message implementation.

The messages:

  • Follow consistent formatting with other sections
  • Use clear placeholders
  • Maintain a consistent color scheme

One suggestion to consider:

-        public Notice neverPlayedBefore = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} nie grał nigdy na tym serwerze.");
-        public Notice lastSeen =  Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} był ostatnio widziany {SEEN} temu.");
-        public Notice nowOnline = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} jest aktualnie online!");
+        private static final String PREFIX = "<dark_gray>[<dark_red>Seen<dark_gray>] ";
+        public Notice neverPlayedBefore = Notice.chat(PREFIX + "<green>{PLAYER} nie grał nigdy na tym serwerze.");
+        public Notice lastSeen =  Notice.chat(PREFIX + "<green>{PLAYER} był ostatnio widziany {SEEN} temu.");
+        public Notice nowOnline = Notice.chat(PREFIX + "<green>{PLAYER} jest aktualnie online!");
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0b97152 and 183053e.

📒 Files selected for processing (4)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/SeenCommand.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/translation/Translation.java (2 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)
🚧 Files skipped from review as they are similar to previous changes (2)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/SeenCommand.java
  • eternalcore-core/src/main/java/com/eternalcode/core/translation/Translation.java
🔇 Additional comments (2)
eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java (1)

134-138: LGTM! Well-documented section.

The section description clearly indicates its purpose for the /seen command.

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

143-147: LGTM! Well-documented section.

The new section for the /seen command is properly documented with clear descriptions.

Copy link
Member

@Jakubk15 Jakubk15 left a comment

Choose a reason for hiding this comment

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

Make sure to apply Lucky's suggestion

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 183053e and 4128379.

📒 Files selected for processing (7)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/SeenCommand.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/EnSeenMessages.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/PLSeenMessages.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/SeenMessages.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/translation/Translation.java (2 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java (2 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/PLTranslation.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • 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
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/SeenCommand.java
🔇 Additional comments (3)
eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/SeenMessages.java (1)

5-11: Nice and clean interface design!

The interface is simple and clearly defines the three possible player states we need to handle.

eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/EnSeenMessages.java (1)

14-22: Great message formatting!

The messages are well-formatted with:

  • Clear descriptions of placeholders
  • Consistent color scheme
  • Easy-to-read text
eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/PLSeenMessages.java (1)

12-23: Perfect match with the English version!

The Polish messages follow the same structure and formatting as the English ones, making the code very consistent.

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/seen/messages/EnSeenMessages.java (1)

14-21: Consider making the message fields final.

Since these messages are set once and shouldn't change, adding the final keyword would make this clearer.

-    public Notice neverPlayedBefore = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} has not played before on this server.");
+    public final Notice neverPlayedBefore = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} has not played before on this server.");

-    public Notice lastSeen =  Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} was last seen {SEEN} ago.");
+    public final Notice lastSeen =  Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} was last seen {SEEN} ago.");

-    public Notice nowOnline = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} is now online!");
+    public final Notice nowOnline = Notice.chat("<dark_gray>[<dark_red>Seen<dark_gray>] <green>{PLAYER} is now online!");
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4128379 and d6202df.

📒 Files selected for processing (1)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/EnSeenMessages.java (1 hunks)
🔇 Additional comments (2)
eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/EnSeenMessages.java (2)

1-8: Looking good! All imports are clean and necessary.


9-12: Great job implementing the SeenMessages interface!

The annotations look good and you've already addressed the previous review 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 (2)
eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/ENSeenMessages.java (2)

9-11: Consider making the fields final for better immutability.

Since these messages are configuration values that shouldn't change at runtime, marking them as final would be safer.


14-21: Small formatting fix needed in the lastSeen field.

There's an extra space after the equals sign in the lastSeen field initialization.

-    public Notice lastSeen =  Notice.chat("<green>{PLAYER} was last seen {SEEN} ago.");
+    public Notice lastSeen = Notice.chat("<green>{PLAYER} was last seen {SEEN} ago.");
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d6202df and 71b5dca.

📒 Files selected for processing (4)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/SeenCommand.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/ENSeenMessages.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/PLSeenMessages.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/PLSeenMessages.java
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/SeenCommand.java
  • eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java
🔇 Additional comments (2)
eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/ENSeenMessages.java (2)

1-8: Looking good! All imports are clean and necessary.


12-12:

✅ Verification successful

Verify the SeenMessages interface implementation.

Let's make sure the interface exists and this class implements all required methods.


🏁 Script executed:

#!/bin/bash
# Search for SeenMessages interface definition
ast-grep --pattern 'interface SeenMessages {
  $$$
}'

Length of output: 55


Let's run a broader search with a different tool to be sure the interface exists. Please run the following script:

Once you have the output from this command, review if the interface is defined in your codebase. If the command still returns no output, please verify manually that the SeenMessages interface exists.


🏁 Script executed:

#!/bin/bash
# A broader search for the SeenMessages interface using ripgrep
rg "interface\s+SeenMessages" -n .

Length of output: 164


Interface verification complete: SeenMessages exists and is implemented correctly.

  • The file ./eternalcore-core/src/main/java/com/eternalcode/core/feature/seen/messages/SeenMessages.java confirms the interface definition.
  • The ENSeenMessages class properly implements this interface.

@vLuckyyy vLuckyyy merged commit 615022b into master Feb 16, 2025
3 checks passed
@vLuckyyy vLuckyyy deleted the feature/seen-command branch February 16, 2025 14:46
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.

Seen command.
5 participants