Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
c975685995
Commit
9728341529
@ -22,9 +22,8 @@ package de.steamwar.bausystem.features.slaves.laufbau.states;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.Date;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public interface LaufbauState {
|
||||
|
||||
@ -35,7 +34,8 @@ public interface LaufbauState {
|
||||
void next();
|
||||
|
||||
default String eta(Player p, long start, int done, int total) {
|
||||
if (done == 0) return "";
|
||||
return new SimpleDateFormat(BauSystem.MESSAGE.parse("TIME", p)).format(Date.from(Instant.ofEpochMilli((System.currentTimeMillis() - start) / done * total)));
|
||||
if (total == 0) return "";
|
||||
long elapsed = System.currentTimeMillis() - start;
|
||||
return LocalTime.ofNanoOfDay((long) (elapsed / (done / (double) total) - elapsed) * 1000000).format(DateTimeFormatter.ofPattern(BauSystem.MESSAGE.parse("TIME", p)));
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren