Conversation
Seria uma boa. |
Pensando em exibir o tempo restante para o evento ser finalizado, como acha que deveria ficar? É possível não definir o valor em |
|
Tempo decorrido: {0}:{1}:{2}/{3}:{4}:{5} Horas, minutos e segundos(*) * talvez segundos seja desnecessário |
É obrigatório. |
same as super class
* Initial plan * Implement elapsed time display in /tb status command Co-authored-by: SrBedrock <51332006+SrBedrock@users.noreply.github.com> * Add remaining time display and improve code efficiency Co-authored-by: SrBedrock <51332006+SrBedrock@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: SrBedrock <51332006+SrBedrock@users.noreply.github.com> Co-authored-by: ThiagoROX <thiagokenis@live.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new /status command that displays the current game status, including elapsed time, maximum duration, remaining time, and either player count or group information depending on the game mode.
- Added permission definitions and configuration for the new
statuscommand - Implemented time tracking by recording battle start time in milliseconds
- Created utility method to format group participant information with counts
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/plugin.yml | Adds permission definition for titansbattle.status command |
| src/main/resources/language-pt_BR.yml | Adds Portuguese translations for status command messages |
| src/main/resources/language-en.yml | Adds English translations for status command messages |
| src/main/resources/config.yml | Registers the status command in configuration |
| src/main/java/me/roinujnosde/titansbattle/utils/Helper.java | Adds overloaded buildStringFrom method for formatting group participant data |
| src/main/java/me/roinujnosde/titansbattle/types/GameConfiguration.java | Removes unused methods (unrelated cleanup) |
| src/main/java/me/roinujnosde/titansbattle/managers/SimpleClansGroupManager.java | Updates string building to uppercase group IDs |
| src/main/java/me/roinujnosde/titansbattle/managers/GroupManager.java | Changes constructor visibility and reformats method |
| src/main/java/me/roinujnosde/titansbattle/commands/TBCommands.java | Implements the status command handler with time calculations |
| src/main/java/me/roinujnosde/titansbattle/BaseGame.java | Adds battle start time tracking field and initialization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/main/java/me/roinujnosde/titansbattle/commands/TBCommands.java
Outdated
Show resolved
Hide resolved
src/main/java/me/roinujnosde/titansbattle/commands/TBCommands.java
Outdated
Show resolved
Hide resolved
* Initial plan * Add time-format configuration option for /tb status command Co-authored-by: SrBedrock <51332006+SrBedrock@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: SrBedrock <51332006+SrBedrock@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
src/main/java/me/roinujnosde/titansbattle/commands/TBCommands.java
Outdated
Show resolved
Hide resolved
Refactored the /tb status command to better handle games with no expiration time by displaying 'N/A' for unlimited durations. Also updated time calculations and formatting for clarity and consistency.
Refactored the formatTime method from TBCommands to Helper as a static utility method. Updated TBCommands to use Helper.formatTime, improving code reuse and organization.
Refactored Helper.formatTime to support flexible duration patterns with tokens for days, hours, minutes, and seconds. Updated TBCommands to always use the formatted string, and expanded config.yml documentation to describe the new time-format options and supported tokens.
Added import for java.time.Duration to Helper.java, likely in preparation for using Duration-related functionality.
4eafe70 to
fa1d528
Compare
Changed the default time format in getTimeFormat() from 'HH:mm:ss' to '{HH}:{mm}:{ss}' to reflect the new formatting convention.
| # - "150 minutes" -> "{m} minutes" | ||
| # | ||
| # If the remaining time is inexistent or negative, "N/A" will be shown. | ||
| time-format: "{HH}:{mm}:{ss}" |
There was a problem hiding this comment.
Poderia mudar para "status-time-format" ou "duration-format", ou algo relacionado. Acho que não poderá ser reaproveitado por outros comandos/funções, certo? Sempre será sobre a duração de um evento.
| return sb.toString(); | ||
| } | ||
|
|
||
| public static @NotNull String buildStringFrom(@NotNull Map<Group, Integer> groupIntegerMap) { |
| * @param pattern the format pattern using the supported tokens | ||
| * @return the formatted duration string, or {@code "N/A"} if {@code totalSeconds < 0} | ||
| */ | ||
| public static @NotNull String formatTime(final long totalSeconds, final String pattern) { |
There was a problem hiding this comment.
mudar nome para formatDuration
No description provided.