Skip to content

add simple status command#124

Open
SrBedrock wants to merge 22 commits intoRoinujNosde:masterfrom
SrBedrock:dev/status
Open

add simple status command#124
SrBedrock wants to merge 22 commits intoRoinujNosde:masterfrom
SrBedrock:dev/status

Conversation

@SrBedrock
Copy link
Collaborator

No description provided.

@SrBedrock SrBedrock linked an issue Oct 8, 2023 that may be closed by this pull request
@RoinujNosde
Copy link
Owner

Seria interessante informar o tempo decorrido e o tempo restante do evento.

Seria uma boa.
Coloca um campo LocalTime startTime = LocalTime.now();...

@SrBedrock
Copy link
Collaborator Author

SrBedrock commented Oct 13, 2023

Seria interessante informar o tempo decorrido e o tempo restante do evento.

Seria uma boa. Coloca um campo LocalTime startTime = LocalTime.now();...

Pensando em exibir o tempo restante para o evento ser finalizado, como acha que deveria ficar?

É possível não definir o valor em game.time.expiration:? se for algo obrigatório fica mais fácil

@RoinujNosde
Copy link
Owner

RoinujNosde commented Oct 13, 2023

Tempo decorrido: {0}:{1}:{2}/{3}:{4}:{5}

Horas, minutos e segundos(*)

* talvez segundos seja desnecessário

@RoinujNosde
Copy link
Owner

É possível não definir o valor em game.time.expiration:? se for algo obrigatório fica mais fácil

É obrigatório.

SrBedrock and others added 11 commits October 17, 2023 00:13
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>
@SrBedrock SrBedrock marked this pull request as ready for review November 10, 2025 14:57
Copilot AI review requested due to automatic review settings November 10, 2025 14:57
Copy link

Copilot AI left a 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 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 status command
  • 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.

Copilot AI and others added 2 commits November 10, 2025 12:18
* 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>
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.
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}"
Copy link
Owner

Choose a reason for hiding this comment

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

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) {
Copy link
Owner

Choose a reason for hiding this comment

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

Javadoc

* @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) {
Copy link
Owner

Choose a reason for hiding this comment

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

mudar nome para formatDuration

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.

GuerraStatus

4 participants