Fix #61 incorrect progress percentage

pull/63/head
trivernis 4 years ago
parent c2fad45c26
commit 928dfbf264

@ -22,7 +22,7 @@ idea {
} }
group "net.trivernis" group "net.trivernis"
version "1.0" version "1.0.1"
sourceCompatibility = 1.8 sourceCompatibility = 1.8

@ -1,15 +1,15 @@
package net.trivernis.chunkmaster package net.trivernis.chunkmaster
import io.papermc.lib.PaperLib import io.papermc.lib.PaperLib
import net.trivernis.chunkmaster.commands.* import net.trivernis.chunkmaster.commands.CommandChunkmaster
import net.trivernis.chunkmaster.lib.LanguageManager import net.trivernis.chunkmaster.lib.LanguageManager
import net.trivernis.chunkmaster.lib.generation.GenerationManager
import net.trivernis.chunkmaster.lib.SqliteManager import net.trivernis.chunkmaster.lib.SqliteManager
import net.trivernis.chunkmaster.lib.generation.GenerationManager
import org.bstats.bukkit.Metrics import org.bstats.bukkit.Metrics
import org.bukkit.plugin.java.JavaPlugin import org.bukkit.plugin.java.JavaPlugin
import org.bukkit.scheduler.BukkitTask import org.bukkit.scheduler.BukkitTask
import org.dynmap.DynmapAPI import org.dynmap.DynmapAPI
import java.lang.Exception import java.util.logging.Level
class Chunkmaster: JavaPlugin() { class Chunkmaster: JavaPlugin() {
lateinit var sqliteManager: SqliteManager lateinit var sqliteManager: SqliteManager
@ -26,6 +26,9 @@ class Chunkmaster: JavaPlugin() {
*/ */
override fun onEnable() { override fun onEnable() {
PaperLib.suggestPaper(this) PaperLib.suggestPaper(this)
logger.fine("LogLevel: FINE")
logger.finer("LogLevel: FINER")
logger.finest("LogLevel: FINEST")
configure() configure()
val metrics = Metrics(this) val metrics = Metrics(this)

@ -106,15 +106,15 @@ class GenerationTaskPaper(
* Checks if some chunks have been loaded and adds them to the loaded chunk set. * Checks if some chunks have been loaded and adds them to the loaded chunk set.
*/ */
private fun checkChunksLoaded() { private fun checkChunksLoaded() {
val completedEntrys = HashSet<CompletableFuture<Chunk>>() val completedEntries = HashSet<CompletableFuture<Chunk>>()
for (pendingChunk in pendingChunks) { for (pendingChunk in pendingChunks) {
if (pendingChunk.isDone) { if (pendingChunk.isDone) {
completedEntrys.add(pendingChunk) completedEntries.add(pendingChunk)
loadedChunks.add(pendingChunk.get()) loadedChunks.add(pendingChunk.get())
} else if (pendingChunk.isCompletedExceptionally || pendingChunk.isCancelled) { } else if (pendingChunk.isCompletedExceptionally || pendingChunk.isCancelled) {
completedEntrys.add(pendingChunk) completedEntries.add(pendingChunk)
} }
} }
pendingChunks.removeAll(completedEntrys) pendingChunks.removeAll(completedEntries)
} }
} }

@ -21,7 +21,8 @@ class Circle(center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int): Shape(
} }
override fun progress(): Double { override fun progress(): Double {
return (PI * r.toFloat().pow(2))/(PI* radius.toFloat().pow(2)) // TODO: Radius inner progress
return (count/(PI* radius.toFloat().pow(2))).coerceAtMost(100.0)
} }
override fun currentRadius(): Int { override fun currentRadius(): Int {

@ -14,7 +14,7 @@ class Spiral(center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int): Shape(
} }
override fun progress(): Double { override fun progress(): Double {
return (currentRadius()*2).toDouble().pow(2) / (radius * 2).toDouble().pow(2) return (count / (radius * 2).toDouble().pow(2)).coerceAtMost(100.0)
} }
override fun currentRadius(): Int { override fun currentRadius(): Int {

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

Loading…
Cancel
Save