Skip to content

Commit

Permalink
show "Ending soon.." rather than negative time
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperdefined committed Jan 18, 2022
1 parent f93bb4f commit c80f070
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,19 @@ private void updateInvasionListGUI() {
String district = invasion.getDistrict();
String cogType = invasion.getCogType().replace("\u0003", ""); // remove the python char
String timeLeft;
long timeLeftSeconds;
String cogs;
if (invasion.megaInvasion) {
cogs = "Mega Invasion";
timeLeft = "Mega Invasion";
} else {
cogs = invasion.getCogsDefeated() + "/" + invasion.getCogsTotal();
timeLeft =
convertTime(
ChronoUnit.SECONDS.between(LocalDateTime.now(), invasion.endTime));
timeLeftSeconds = ChronoUnit.SECONDS.between(LocalDateTime.now(), invasion.endTime);
if (timeLeftSeconds <= 0) {
timeLeft = "Ending soon...";
} else {
timeLeft = convertTime(timeLeftSeconds);
}
}
data = new String[] {district, cogType, timeLeft, cogs};
invasionTableModel.addRow(data);
Expand Down

0 comments on commit c80f070

Please sign in to comment.