Skip to content

GH-976 Fix chat clear logic to directly send empty messages. #1047

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

Merged
merged 2 commits into from
Jul 19, 2025

Conversation

vLuckyyy
Copy link
Member

Fixes: #976

@vLuckyyy vLuckyyy requested a review from a team as a code owner July 14, 2025 02:05
Copy link
Contributor

coderabbitai bot commented Jul 14, 2025

Walkthrough

The update increases the number of chat lines cleared by the /chat clear command from 128 to 256 in the configuration. The way the chat is cleared has also changed: instead of sending a notice with many newlines, the system now sends multiple empty messages to each player to clear their chat. The command class was updated to use this new approach, and some internal fields and methods were adjusted to support it.

Assessment against linked issues

Objective Addressed Explanation
Update linesToClear to 256 (#976)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes were found.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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

github-actions bot commented Jul 14, 2025

📦 Development Build Ready

Warning

Do not use this build in production. It is for testing purposes only and may be unstable.

👉 Click here to download the JAR

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

🧹 Nitpick comments (1)
eternalcore-core/src/main/java/com/eternalcode/core/configuration/implementation/PluginConfiguration.java (1)

196-196: Consider the performance impact of doubling the clear count.

Increasing from 128 to 256 lines means each player will receive 256 individual messages during chat clear. This could create network overhead, especially with many online players.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d46fd55 and 8cd0467.

📒 Files selected for processing (2)
  • eternalcore-core/src/main/java/com/eternalcode/core/configuration/implementation/PluginConfiguration.java (1 hunks)
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/chat/ChatCommand.java (2 hunks)
👮 Files not reviewed due to content moderation or server errors (2)
  • eternalcore-core/src/main/java/com/eternalcode/core/configuration/implementation/PluginConfiguration.java
  • eternalcore-core/src/main/java/com/eternalcode/core/feature/chat/ChatCommand.java
🧰 Additional context used
🧠 Learnings (1)
eternalcore-core/src/main/java/com/eternalcode/core/configuration/implementation/PluginConfiguration.java (1)
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.
🔇 Additional comments (12)
eternalcore-core/src/main/java/com/eternalcode/core/configuration/implementation/PluginConfiguration.java (2)

196-196: Configuration update looks good!

Doubling the clear count from 128 to 256 makes sense with the new direct message approach.


196-196: Configuration update looks good!

Doubling the lines to clear makes sense with the new empty message approach.

eternalcore-core/src/main/java/com/eternalcode/core/feature/chat/ChatCommand.java (10)

24-24: Clean import and constant additions!

The Server import and EMPTY_CHAT_STRING constant are well-implemented. Using a single space is smart to ensure messages are properly sent.

Also applies to: 31-31


36-36: Constructor updates follow good patterns!

Adding the Server dependency is the right approach for accessing online players. The injection pattern is consistent with existing code.

Also applies to: 46-46, 53-53


69-73: New clear implementation works as intended!

The logic correctly sends empty messages to all players. Just be aware this generates more network traffic than the previous approach (256 messages per player vs. one notice), but it achieves the desired direct messaging goal.


31-31: Good choice for the empty message content.

Using a single space ensures the message isn't completely empty while remaining minimally visible to players.


36-36: Proper dependency injection for accessing online players.

Adding the Server field is the right approach for the new chat clearing implementation.


46-46: Constructor properly updated for dependency injection.

The Server parameter addition follows good DI practices.


53-53: Standard field initialization.

Proper assignment of the injected dependency.


24-24: Good additions for the new approach!

The Server import and empty chat constant are clean implementations for the direct message strategy.

Also applies to: 31-31


36-36: Constructor changes are properly implemented!

Server dependency is correctly injected and stored following good practices.

Also applies to: 46-46, 53-53


69-73: Clean and effective implementation!

The new direct message approach is straightforward and correctly sends empty messages to all online players. Much simpler than the previous newline-based method.

@CitralFlo CitralFlo changed the title Fix chat clear logic to directly send empty messages. GH-1047 Fix chat clear logic to directly send empty messages. Jul 15, 2025
Copy link
Member

@CitralFlo CitralFlo left a comment

Choose a reason for hiding this comment

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

Looks good

@vLuckyyy vLuckyyy changed the title GH-1047 Fix chat clear logic to directly send empty messages. GH-976 Fix chat clear logic to directly send empty messages. Jul 19, 2025
@vLuckyyy vLuckyyy merged commit e072cbd into master Jul 19, 2025
3 of 4 checks passed
@vLuckyyy vLuckyyy deleted the fix-clear-command branch July 19, 2025 20:32
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.

Fix chat clearing. Set linesToClear to 256
3 participants