Conversation
CHANGES: - Add console logging for regular chat messages (issue #10) - Prevent display of empty messages when set to "" - Update message handling to skip null messages completely Previously, only private messages were logged to console and empty messages would show as blank lines in the chat. Now all chat messages appear in the console log, and empty messages are completely skipped when configured as empty strings in messages.yml. Closes #10
There was a problem hiding this comment.
Pull Request Overview
This PR improves chat handling by fixing console logging for regular chat messages and preventing the display of empty messages in chat. Key changes include adding a console log for chat messages, introducing a null check for empty system messages, and updating the message toggle command to safely handle potential null responses.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/java/com/noximity/remmyChat/services/FormatService.java | Added a null check in formatSystemMessage to skip empty messages. |
| src/main/java/com/noximity/remmyChat/listeners/ChatListener.java | Introduced plain text logging for formatted chat messages. |
| src/main/java/com/noximity/remmyChat/commands/MsgToggleCommand.java | Wrapped system message sending with a null check. |
| README.md | Updated documentation to reflect the new version and features. |
| String message = plugin.getMessages().getMessage(path); | ||
|
|
||
| // Skip empty messages completely by returning null | ||
| if (message == null || message.trim().isEmpty()) { |
There was a problem hiding this comment.
Returning null here might lead to potential NullPointerExceptions if any caller forgets to perform a null check. Consider returning Component.empty() instead or explicitly documenting that null is a valid response.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CHANGES:
Previously, only private messages were logged to console and empty messages would show as blank lines in the chat. Now all chat messages appear in the console log, and empty messages are completely skipped when configured as empty strings in messages.yml.
Closes #10