-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Enhance channel and group formatting with display names and deb… #6
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
Conversation
…ug options Closes #5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances message formatting by introducing custom placeholders, channel display names, and per-group format strings, along with new debug and verbose startup options.
- Integrate a
PlaceholderManagerfor flexible placeholder resolution and add debug flags. - Extend
ChannelandGroupFormatmodels withdisplayNameandformatproperties. - Add
debugEnabled/verboseStartupoptions and verbose logging inConfigManager.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/config.yml | Define debug settings, custom placeholders, display-name and group formats |
| src/main/java/com/noximity/remmyChat/utils/PlaceholderManager.java | New class to load and resolve nested placeholders with recursion protection |
| src/main/java/com/noximity/remmyChat/services/FormatService.java | Revamped message formatting to support custom group formats, display names, and debug logs |
| src/main/java/com/noximity/remmyChat/models/GroupFormat.java | Added format field and getter |
| src/main/java/com/noximity/remmyChat/models/Channel.java | Added displayName and hasDisplayName methods |
| src/main/java/com/noximity/remmyChat/config/ConfigManager.java | Add debugEnabled, verboseStartup, and verbose logging for load methods |
| src/main/java/com/noximity/remmyChat/RemmyChat.java | Initialize and expose the new PlaceholderManager |
| pom.xml | Bump project version from 1.4.0 to 1.4.1 |
Comments suppressed due to low confidence (2)
src/main/java/com/noximity/remmyChat/services/FormatService.java:34
- [nitpick] The formatChatMessage method has grown very large with multiple duplicated branches; consider extracting helper methods (e.g., for custom formats, fallback logic, and hover building) to improve readability and reduce complexity.
public Component formatChatMessage(Player player, String channelName, String message) {
src/main/java/com/noximity/remmyChat/utils/PlaceholderManager.java:12
- The new
PlaceholderManagerintroduces recursive and dependency-based placeholder resolution without accompanying unit tests; consider adding tests for nested placeholders, circular references, and recursion-limit handling.
public class PlaceholderManager {
| * @param text The text containing placeholders to resolve | ||
| * @return The text with all placeholders replaced | ||
| */ | ||
| private String resolveAllPlaceholders(String text) { |
Copilot
AI
May 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Building a full dependency graph and resolving placeholders on every invocation may become costly for large texts; consider caching parsed placeholder patterns or memoizing resolved graphs when config doesn’t change.
|
|
||
| // Load debug settings first | ||
| this.debugEnabled = config.getBoolean("debug.enabled", false); | ||
| this.verboseStartup = !config.isSet("debug.verbose-startup") || config.getBoolean("debug.verbose-startup", true); |
Copilot
AI
May 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The logic for determining verboseStartup is a bit convoluted; consider simplifying to a single config.getBoolean("debug.verbose-startup", true) for clarity.
| this.verboseStartup = !config.isSet("debug.verbose-startup") || config.getBoolean("debug.verbose-startup", true); | |
| this.verboseStartup = config.getBoolean("debug.verbose-startup", true); |
|
|
||
| private final String name; | ||
| private final String nameStyle; | ||
| private final String prefix; |
Copilot
AI
May 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding Javadoc for the new format field (and its expected placeholder syntax) to clarify its purpose and usage.
| private final String prefix; | |
| private final String prefix; | |
| /** | |
| * The format string used to define the structure of group messages. | |
| * This string may include placeholders such as {name}, {prefix}, or {style} | |
| * that will be replaced with corresponding values at runtime. | |
| * Example: "[{prefix}] {name}: {message}" | |
| */ |
| private final String permission; | ||
| private final double radius; | ||
| private final String prefix; | ||
| private final String hover; |
Copilot
AI
May 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Add a brief Javadoc comment for displayName and hasDisplayName() to explain how channel display names differ from prefixes.
| private final String hover; | |
| private final String hover; | |
| /** | |
| * The full, user-friendly name of the channel, which may be displayed in the UI. | |
| * This differs from the {@code prefix}, which is a shorter identifier or symbol | |
| * used in chat messages. | |
| */ |
This pull request introduces several updates to the
remmychatproject, focusing on adding new features, improving configurability, and enhancing debugging capabilities. The most significant changes include the addition of aPlaceholderManager, new configuration options for debug and verbose startup settings, updates to theChannelandGroupFormatmodels, and improved logging for better transparency during startup and configuration reloads.New Features and Enhancements:
Added
PlaceholderManagerIntegration: Introduced aPlaceholderManagerto the project, initialized inRemmyChatand exposed via a getter method. This allows for more flexible placeholder handling throughout the application. (src/main/java/com/noximity/remmyChat/RemmyChat.java: [1] [2] [3] [4]Extended
ChannelandGroupFormatModels:displayNameproperty toChanneland corresponding getter and helper methods (hasDisplayName). This enables channels to have user-friendly display names. (src/main/java/com/noximity/remmyChat/models/Channel.java: [1] [2]formatproperty toGroupFormatfor more detailed group formatting options. (src/main/java/com/noximity/remmyChat/models/GroupFormat.java: [1] [2]Configuration Improvements:
debugEnabledandverboseStartupoptions to the configuration, allowing for more granular control over logging and debugging. These settings are loaded during both startup and configuration reload. (src/main/java/com/noximity/remmyChat/config/ConfigManager.java: [1] [2] [3] [4]loadTemplates,loadChannels, andloadGroupFormatsmethods to include verbose logging whenverboseStartupis enabled. (src/main/java/com/noximity/remmyChat/config/ConfigManager.java: [1] [2] [3] [4] [5] [6]Version Update:
pom.xmlfrom1.4.0to1.4.1to reflect the new changes. (pom.xml: pom.xmlL9-R9)