SteamWar/BauSystem2.0
Archiviert
12
0

Fix LaufbauState
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-01-17 18:13:32 +01:00
Ursprung ff6970deba
Commit 8b97ea0383

Datei anzeigen

@ -36,6 +36,13 @@ public interface LaufbauState {
default String eta(Player p, long start, int done, int total) { default String eta(Player p, long start, int done, int total) {
if (total == 0) return ""; if (total == 0) return "";
long elapsed = System.currentTimeMillis() - start; long elapsed = System.currentTimeMillis() - start;
return LocalTime.ofNanoOfDay((long) (elapsed / (done / (double) total) - elapsed) * 1000000).format(DateTimeFormatter.ofPattern(BauSystem.MESSAGE.parse("TIME", p))); long eta = (long) (elapsed / (done / (double) total) - elapsed);
if (eta > 86399999999999L) {
return LocalTime.ofNanoOfDay(86399999999999L).format(DateTimeFormatter.ofPattern(BauSystem.MESSAGE.parse("TIME", p)));
}
if (eta < 0) {
return LocalTime.ofNanoOfDay(0).format(DateTimeFormatter.ofPattern(BauSystem.MESSAGE.parse("TIME", p)));
}
return LocalTime.ofNanoOfDay(eta * 1000000).format(DateTimeFormatter.ofPattern(BauSystem.MESSAGE.parse("TIME", p)));
} }
} }