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) { for (task in tasks) {
try { try {
val genTask = task.generationTask val genTask = task.generationTask
server.consoleSender.sendMessage("Task #${task.id} running for \"${genTask.world.name}\". " + server.consoleSender.sendMessage("""Task #${task.id} running for "${genTask.world.name}".
"Progress ${task.generationTask.count} chunks. Last Chunk: ${genTask.lastChunk.x}, ${genTask.lastChunk.z}") |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(""" val updateStatement = chunkmaster.sqliteConnection.prepareStatement("""
UPDATE generation_tasks SET last_x = ?, last_z = ? UPDATE generation_tasks SET last_x = ?, last_z = ?
WHERE id = ? WHERE id = ?

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

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

Loading…
Cancel
Save