Fix #61 incorrect progress percentage

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

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

@ -1,15 +1,15 @@
package net.trivernis.chunkmaster
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.generation.GenerationManager
import net.trivernis.chunkmaster.lib.SqliteManager
import net.trivernis.chunkmaster.lib.generation.GenerationManager
import org.bstats.bukkit.Metrics
import org.bukkit.plugin.java.JavaPlugin
import org.bukkit.scheduler.BukkitTask
import org.dynmap.DynmapAPI
import java.lang.Exception
import java.util.logging.Level
class Chunkmaster: JavaPlugin() {
lateinit var sqliteManager: SqliteManager
@ -26,6 +26,9 @@ class Chunkmaster: JavaPlugin() {
*/
override fun onEnable() {
PaperLib.suggestPaper(this)
logger.fine("LogLevel: FINE")
logger.finer("LogLevel: FINER")
logger.finest("LogLevel: FINEST")
configure()
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.
*/
private fun checkChunksLoaded() {
val completedEntrys = HashSet<CompletableFuture<Chunk>>()
val completedEntries = HashSet<CompletableFuture<Chunk>>()
for (pendingChunk in pendingChunks) {
if (pendingChunk.isDone) {
completedEntrys.add(pendingChunk)
completedEntries.add(pendingChunk)
loadedChunks.add(pendingChunk.get())
} 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 {
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 {

@ -14,7 +14,7 @@ class Spiral(center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int): Shape(
}
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 {

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

Loading…
Cancel
Save