GH-355 Add additional placeholder for combatNotification#355
GH-355 Add additional placeholder for combatNotification#355
Conversation
Signed-off-by: Michał Wojtas <wojtas.michal90@gmail.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the combat notification system by introducing a new placeholder that displays the remaining combat time in raw seconds. This provides greater flexibility for server administrators to tailor combat messages to their specific needs, offering an alternative to the existing formatted time placeholder. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new {SECONDS} placeholder for combat notifications, which is a useful addition for configuration flexibility. The implementation is mostly correct, but I've identified a potential inconsistency in how the new placeholder calculates time compared to the existing {TIME} placeholder. My feedback includes a specific code suggestion to align their behavior and prevent potential confusion for users.
| .player(player.getUniqueId()) | ||
| .notice(this.config.messagesSettings.combatNotification) | ||
| .placeholder("{TIME}", DurationUtil.format(remaining, this.config.messagesSettings.withoutMillis)) | ||
| .placeholder("{SECONDS}", String.valueOf(remaining.toSeconds())) |
There was a problem hiding this comment.
The use of remaining.toSeconds() truncates the duration, which can be inconsistent with the {TIME} placeholder that appears to round up. For example, a remaining time of 19.9 seconds would result in {SECONDS} being "19" while {TIME} could be "20s". This can be confusing.
To ensure consistency, it's better to round up the seconds for the {SECONDS} placeholder as well.
| .placeholder("{SECONDS}", String.valueOf(remaining.toSeconds())) | |
| .placeholder("{SECONDS}", String.valueOf((remaining.toMillis() + 999) / 1000)) |
imDMK
left a comment
There was a problem hiding this comment.
For me, this PR is not useful at the moment.
I think a better approach would be to introduce a customizable time formatting mechanism, similar to what I implemented in my project:
https://github.com/imDMK/AdvancedPlayTime/blob/main/playtime-core/src/main/java/com/github/imdmk/playtime/shared/time/DurationFormatStyle.java
This would allow players to change the time formatting style according to their needs.
Cool, would You like to implement it in EternalCombat? |

Uh oh!
There was an error while loading. Please reload this page.