Skip to content

Commit

Permalink
fix countdown
Browse files Browse the repository at this point in the history
  • Loading branch information
boiscljo committed Apr 2, 2022
1 parent 620d453 commit fd51d09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ public void run() {

if (!time.contains("0-1")) {
String[] units = time.split(":");
int seconds = Integer.parseInt(units[1]) + 1;
int seconds = Integer.parseInt(units[1]) + 1 + Integer.parseInt(units[0])*60;
if (buffer == seconds)
return;
buffer = seconds;
if (seconds <= 10) {
var message = LanguageService
.getInstance()
.get(MessageKeys.GAME_STARTS_IN_MESSAGE)
.replace("%seconds%", String.valueOf(seconds))
.replace("%seconds%", seconds <=60 ? String.valueOf(seconds): game.getFormattedTimeLeft())
.toString();

message = seconds == 1 ? message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ else if (game.getAvailableTeams().stream().allMatch(t -> t.getMaxPlayers() == 4)

if (game.countConnectedPlayers() >= game.getMinPlayers()
&& game.getStatus() == GameStatus.WAITING) {
final var time = ((org.screamingsandals.bedwars.game.Game) Main.getInstance().getGameByName(game.getName()))
.getFormattedTimeLeft();
final var gameImpl = ((org.screamingsandals.bedwars.game.Game) game);
final var time = gameImpl.getFormattedTimeLeft();
if (!time.contains("0-1")) {
final var units = time.split(":");
var seconds = Integer.parseInt(units[1]) + 1;
int seconds = Integer.parseInt(units[1]) + 1 + Integer.parseInt(units[0])*60;
state = LanguageService
.getInstance()
.get(MessageKeys.LOBBY_SCOREBOARD_STATE)
.replace("%countdown%", String.valueOf(seconds))
.replace("%countdown%", seconds <=60 ? String.valueOf(seconds): gameImpl.getFormattedTimeLeft())
.toString();
}
}
Expand Down

0 comments on commit fd51d09

Please sign in to comment.