Add ETA to periodic reports

Closes #17
pull/20/head
Trivernis 5 years ago
parent 3d8c47aee2
commit a4115ebdf7

@ -215,16 +215,28 @@ class GenerationManager(private val chunkmaster: Chunkmaster, private val server
for (task in tasks) {
try {
val genTask = task.generationTask
val speed = task.generationSpeed!!
val percentage = if (genTask.stopAfter > 0) "(${"%.2f".format(
(genTask.count.toDouble() / genTask.stopAfter.toDouble()) * 100
)}%)" else ""
val eta = if (genTask.stopAfter > 0 && speed > 0) {
val etaSeconds = (genTask.stopAfter - genTask.count).toDouble()/speed
chunkmaster.logger.info(""+etaSeconds)
val hours: Int = (etaSeconds/3600).toInt()
val minutes: Int = ((etaSeconds % 3600) / 60).toInt()
val seconds: Int = (etaSeconds % 60).toInt()
", ETA: %d:%02d:%02d".format(hours, minutes, seconds)
} else {
""
}
chunkmaster.logger.info(chunkmaster.langManager.getLocalized(
"TASK_PERIODIC_REPORT",
task.id,
genTask.world.name,
genTask.count,
percentage,
task.generationSpeed!!,
eta,
speed,
genTask.lastChunk.x,
genTask.lastChunk.z))
chunkmaster.sqliteManager.executeStatement(

@ -5,7 +5,7 @@ TASK_LOAD_FAILED = \u00A7cFailed to load task #%d.
TASK_LOAD_SUCCESS = %d saved tasks loaded.
TASK_NOT_FOUND = \u00A7cTask %s not found!
CREATE_DELAYED_LOAD = Creating task to load chunk generation Tasks later...
TASK_PERIODIC_REPORT = Task #%d running for '%s'. Progress: %d chunks %s, Speed: %.1f ch/s, Last Chunk: %d, %d
TASK_PERIODIC_REPORT = Task #%d running for '%s'. Progress: %d chunks %s %s, Speed: %.1f ch/s, Last Chunk: %d, %d
TASK_SAVE_FAILED = \u00A7cException when saving tasks: %s
WORLD_NAME_REQUIRED = \u00A7cYou need to provide a world name!

@ -5,7 +5,7 @@ TASK_LOAD_FAILED = \u00A7cAufgabe #%d konnte nicht geladen werden.
TASK_LOAD_SUCCESS = %d gespeicherte Aufgaben wurden geladen.
TASK_NOT_FOUND = \u00A7cAufgabe %s konnte nicht gefunden werden!
CREATE_DELAYED_LOAD = Erstelle einen Bukkit-Task zum verz\u00f6gerten Laden von Aufgaben...
TASK_PERIODIC_REPORT = Aufgabe #%d f\u00fcr Welt '%s'. Fortschritt: %d chunks %s, Geschwindigkeit: %.1f ch/s, Letzer Chunk: %d, %d
TASK_PERIODIC_REPORT = Aufgabe #%d f\u00fcr Welt '%s'. Fortschritt: %d chunks %s %s, Geschwindigkeit: %.1f ch/s, Letzer Chunk: %d, %d
TASK_SAVE_FAILED = \u00A7cFehler beim Speichern der Aufgaben: %s
WORLD_NAME_REQUIRED = \u00A7cDu musst einen Weltennamen angeben!

@ -5,7 +5,7 @@ TASK_LOAD_FAILED = \u00A7cFailed to load task #%d.
TASK_LOAD_SUCCESS = %d saved tasks loaded.
TASK_NOT_FOUND = \u00A7cTask %s not found!
CREATE_DELAYED_LOAD = Creating task to load chunk generation Tasks later...
TASK_PERIODIC_REPORT = Task #%d running for '%s'. Progress: %d chunks %s, Speed: %.1f ch/s, Last Chunk: %d, %d
TASK_PERIODIC_REPORT = Task #%d running for '%s'. Progress: %d chunks %s %s, Speed: %.1f ch/s, Last Chunk: %d, %d
TASK_SAVE_FAILED = \u00A7cException when saving tasks: %s
WORLD_NAME_REQUIRED = \u00A7cYou need to provide a world name!

Loading…
Cancel
Save