Added Progress percentage to periodical task status

pull/1/head
Trivernis 5 years ago
parent 52ba24390f
commit 726e4ba34c

@ -172,8 +172,10 @@ class GenerationManager(private val chunkmaster: Chunkmaster, private val server
for (task in tasks) {
try {
val genTask = task.generationTask
server.consoleSender.sendMessage("Task #${task.id} running for \"${genTask.world.name}\". " +
"Progress ${task.generationTask.count} chunks. Last Chunk: ${genTask.lastChunk.x}, ${genTask.lastChunk.z}")
server.consoleSender.sendMessage("""Task #${task.id} running for "${genTask.world.name}".
|Progress ${task.generationTask.count} chunks
|${if (task.generationTask.stopAfter > 0)"(${(task.generationTask.count.toDouble()/task.generationTask.stopAfter.toDouble())*100}%)." else ""}
|Last Chunk: ${genTask.lastChunk.x}, ${genTask.lastChunk.z}""".trimMargin("|").replace('\n', ' '))
val updateStatement = chunkmaster.sqliteConnection.prepareStatement("""
UPDATE generation_tasks SET last_x = ?, last_z = ?
WHERE id = ?

@ -7,8 +7,8 @@ import org.bukkit.scheduler.BukkitRunnable
import org.bukkit.scheduler.BukkitTask
class GenerationTask(private val plugin: Chunkmaster, val world: World,
private val centerChunk: Chunk, private val startChunk: Chunk,
private val stopAfter: Int = -1): Runnable {
centerChunk: Chunk, private val startChunk: Chunk,
val stopAfter: Int = -1): Runnable {
private val spiral: Spiral = Spiral(Pair(centerChunk.x, centerChunk.z), Pair(startChunk.x, startChunk.z))
private val loadedChunks: HashSet<Chunk> = HashSet()
private val chunkSkips = plugin.config.getInt("generation.chunks-skips-per-step")

@ -1,6 +1,6 @@
main: net.trivernis.chunkmaster.Chunkmaster
name: Chunkmaster
version: '1.0 SNAPSHOT'
version: '0.10-beta-SNAPSHOT'
description: Chunk commands plugin.
author: Trivernis
website: trivernis.net

Loading…
Cancel
Save