pull/87/head^2
trivernis 4 years ago
parent 7ffada4100
commit aaa614f651

@ -98,8 +98,10 @@ class CmdGenerate(private val chunkmaster: Chunkmaster): Subcommand {
val allTasks = chunkmaster.generationManager.allTasks val allTasks = chunkmaster.generationManager.allTasks
return if (world != null && (allTasks.find { it.generationTask.world == world }) == null) { return if (world != null && (allTasks.find { it.generationTask.world == world }) == null) {
chunkmaster.generationManager.addTask(world, if (blockRadius > 0) blockRadius / 16 else -1, shape) chunkmaster.generationManager.addTask(world, if (blockRadius > 0) blockRadius / 16 else -1, shape)
sender.sendMessage(chunkmaster.langManager sender.sendMessage(
.getLocalized("TASK_CREATION_SUCCESS", chunkmaster.langManager
.getLocalized(
"TASK_CREATION_SUCCESS",
worldName, worldName,
if (blockRadius > 0) { if (blockRadius > 0) {
chunkmaster.langManager.getLocalized("TASK_UNIT_RADIUS", blockRadius) chunkmaster.langManager.getLocalized("TASK_UNIT_RADIUS", blockRadius)
@ -107,7 +109,8 @@ class CmdGenerate(private val chunkmaster: Chunkmaster): Subcommand {
chunkmaster.langManager.getLocalized("TASK_UNIT_WORLDBORDER") chunkmaster.langManager.getLocalized("TASK_UNIT_WORLDBORDER")
}, },
shape shape
)) )
)
true true
} else if (world == null) { } else if (world == null) {
sender.sendMessage(chunkmaster.langManager.getLocalized("WORLD_NOT_FOUND", worldName)); sender.sendMessage(chunkmaster.langManager.getLocalized("WORLD_NOT_FOUND", worldName));

@ -55,7 +55,14 @@ class CmdGetCenter(private val chunkmaster: Chunkmaster): Subcommand {
} }
center = Pair(world.spawnLocation.chunk.x, world.spawnLocation.chunk.z) center = Pair(world.spawnLocation.chunk.x, world.spawnLocation.chunk.z)
} }
sender.sendMessage(chunkmaster.langManager.getLocalized("CENTER_INFO", worldName, center.first, center.second)) sender.sendMessage(
chunkmaster.langManager.getLocalized(
"CENTER_INFO",
worldName,
center.first,
center.second
)
)
} }
} }
} }

@ -58,7 +58,9 @@ class CmdList(private val chunkmaster: Chunkmaster): Subcommand {
} else { } else {
genTask.count.toString() genTask.count.toString()
} }
return "\n" + chunkmaster.langManager.getLocalized("TASKS_ENTRY", return "\n" + chunkmaster.langManager.getLocalized(
task.id, genTask.world.name, genTask.state.toString(), count, percentage) "TASKS_ENTRY",
task.id, genTask.world.name, genTask.state.toString(), count, percentage
)
} }
} }

@ -1,7 +1,5 @@
package net.trivernis.chunkmaster.commands package net.trivernis.chunkmaster.commands
import net.md_5.bungee.api.ChatColor
import net.md_5.bungee.api.chat.ComponentBuilder
import net.trivernis.chunkmaster.Chunkmaster import net.trivernis.chunkmaster.Chunkmaster
import net.trivernis.chunkmaster.lib.Subcommand import net.trivernis.chunkmaster.lib.Subcommand
import org.bukkit.command.Command import org.bukkit.command.Command

@ -1,7 +1,5 @@
package net.trivernis.chunkmaster.commands package net.trivernis.chunkmaster.commands
import net.md_5.bungee.api.ChatColor
import net.md_5.bungee.api.chat.ComponentBuilder
import net.trivernis.chunkmaster.Chunkmaster import net.trivernis.chunkmaster.Chunkmaster
import net.trivernis.chunkmaster.lib.Subcommand import net.trivernis.chunkmaster.lib.Subcommand
import org.bukkit.command.Command import org.bukkit.command.Command

@ -1,7 +1,5 @@
package net.trivernis.chunkmaster.commands package net.trivernis.chunkmaster.commands
import net.md_5.bungee.api.ChatColor
import net.md_5.bungee.api.chat.ComponentBuilder
import net.trivernis.chunkmaster.Chunkmaster import net.trivernis.chunkmaster.Chunkmaster
import net.trivernis.chunkmaster.lib.Subcommand import net.trivernis.chunkmaster.lib.Subcommand
import org.bukkit.command.Command import org.bukkit.command.Command

@ -5,7 +5,6 @@ import net.trivernis.chunkmaster.lib.Subcommand
import org.bukkit.World import org.bukkit.World
import org.bukkit.command.Command import org.bukkit.command.Command
import org.bukkit.command.CommandSender import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
class CmdStats(private val chunkmaster: Chunkmaster) : Subcommand { class CmdStats(private val chunkmaster: Chunkmaster) : Subcommand {
override val name = "stats" override val name = "stats"
@ -23,8 +22,10 @@ class CmdStats(private val chunkmaster: Chunkmaster): Subcommand {
if (args.isNotEmpty()) { if (args.isNotEmpty()) {
val world = sender.server.getWorld(args[0]) val world = sender.server.getWorld(args[0])
if (world == null) { if (world == null) {
sender.sendMessage(chunkmaster.langManager.getLocalized("STATS_HEADER") + "\n" + sender.sendMessage(
chunkmaster.langManager.getLocalized("WORLD_NOT_FOUND", args[0])) chunkmaster.langManager.getLocalized("STATS_HEADER") + "\n" +
chunkmaster.langManager.getLocalized("WORLD_NOT_FOUND", args[0])
)
return false return false
} }
sender.sendMessage(getWorldStatsMessage(sender, world)) sender.sendMessage(getWorldStatsMessage(sender, world))
@ -53,10 +54,18 @@ class CmdStats(private val chunkmaster: Chunkmaster): Subcommand {
${chunkmaster.langManager.getLocalized("STATS_SERVER")} ${chunkmaster.langManager.getLocalized("STATS_SERVER")}
${chunkmaster.langManager.getLocalized("STATS_SERVER_VERSION", sender.server.version)} ${chunkmaster.langManager.getLocalized("STATS_SERVER_VERSION", sender.server.version)}
${chunkmaster.langManager.getLocalized("STATS_PLUGIN_VERSION", chunkmaster.description.version)} ${chunkmaster.langManager.getLocalized("STATS_PLUGIN_VERSION", chunkmaster.description.version)}
${chunkmaster.langManager.getLocalized("STATS_MEMORY", memUsed/1000000, runtime.maxMemory()/1000000, (memUsed.toFloat()/runtime.maxMemory().toFloat()) * 100)} ${chunkmaster.langManager.getLocalized(
"STATS_MEMORY",
memUsed / 1000000,
runtime.maxMemory() / 1000000,
(memUsed.toFloat() / runtime.maxMemory().toFloat()) * 100
)}
${chunkmaster.langManager.getLocalized("STATS_CORES", runtime.availableProcessors())} ${chunkmaster.langManager.getLocalized("STATS_CORES", runtime.availableProcessors())}
${chunkmaster.langManager.getLocalized("STATS_PLUGIN_LOADED_CHUNKS", chunkmaster.generationManager.loadedChunkCount)} ${chunkmaster.langManager.getLocalized(
"STATS_PLUGIN_LOADED_CHUNKS",
chunkmaster.generationManager.loadedChunkCount
)}
""".trimIndent() """.trimIndent()
for (world in sender.server.worlds) { for (world in sender.server.worlds) {
message += "\n\n" + getWorldStatsMessage(sender, world) message += "\n\n" + getWorldStatsMessage(sender, world)

@ -1,8 +1,6 @@
package net.trivernis.chunkmaster.commands package net.trivernis.chunkmaster.commands
import io.papermc.lib.PaperLib import io.papermc.lib.PaperLib
import net.md_5.bungee.api.ChatColor
import net.md_5.bungee.api.chat.ComponentBuilder
import net.trivernis.chunkmaster.Chunkmaster import net.trivernis.chunkmaster.Chunkmaster
import net.trivernis.chunkmaster.lib.Subcommand import net.trivernis.chunkmaster.lib.Subcommand
import org.bukkit.Material import org.bukkit.Material

@ -1,7 +1,5 @@
package net.trivernis.chunkmaster.commands package net.trivernis.chunkmaster.commands
import net.md_5.bungee.api.ChatColor
import net.md_5.bungee.api.chat.ComponentBuilder
import net.trivernis.chunkmaster.Chunkmaster import net.trivernis.chunkmaster.Chunkmaster
import net.trivernis.chunkmaster.lib.Subcommand import net.trivernis.chunkmaster.lib.Subcommand
import org.bukkit.Server import org.bukkit.Server

@ -1,8 +1,8 @@
package net.trivernis.chunkmaster.lib package net.trivernis.chunkmaster.lib
import net.trivernis.chunkmaster.Chunkmaster import net.trivernis.chunkmaster.Chunkmaster
import java.lang.Exception
import java.util.Properties
import java.io.* import java.io.*
import java.util.*
class LanguageManager(private val plugin: Chunkmaster) { class LanguageManager(private val plugin: Chunkmaster) {
private val langProps = Properties() private val langProps = Properties()
@ -20,12 +20,14 @@ class LanguageManager(private val plugin: Chunkmaster) {
val file = File(langFile) val file = File(langFile)
val loader = Thread.currentThread().contextClassLoader val loader = Thread.currentThread().contextClassLoader
val defaultStream = this.javaClass.getResourceAsStream("/i18n/DEFAULT.i18n.properties") val defaultStream = this.javaClass.getResourceAsStream("/i18n/DEFAULT.i18n.properties")
if (defaultStream != null) { if (defaultStream != null) {
langProps.load(getReaderForProperties(defaultStream)) langProps.load(getReaderForProperties(defaultStream))
defaultStream.close() defaultStream.close()
} else { } else {
plugin.logger.severe("Couldn't load default language properties.") plugin.logger.severe("Couldn't load default language properties.")
} }
if (file.exists()) { if (file.exists()) {
try { try {
val inputStream = loader.getResourceAsStream(langFile) val inputStream = loader.getResourceAsStream(langFile)

@ -37,7 +37,8 @@ class GenerationTasks(private val sqliteManager: SqliteManager) {
*/ */
fun addGenerationTask(world: String, center: ChunkCoordinates, radius: Int, shape: String): CompletableFuture<Int> { fun addGenerationTask(world: String, center: ChunkCoordinates, radius: Int, shape: String): CompletableFuture<Int> {
val completableFuture = CompletableFuture<Int>() val completableFuture = CompletableFuture<Int>()
sqliteManager.executeStatement(""" sqliteManager.executeStatement(
"""
INSERT INTO generation_tasks (center_x, center_z, last_x, last_z, world, radius, shape) INSERT INTO generation_tasks (center_x, center_z, last_x, last_z, world, radius, shape)
values (?, ?, ?, ?, ?, ?, ?)""", values (?, ?, ?, ?, ?, ?, ?)""",
hashMapOf( hashMapOf(

@ -2,7 +2,6 @@ package net.trivernis.chunkmaster.lib.database
import net.trivernis.chunkmaster.Chunkmaster import net.trivernis.chunkmaster.Chunkmaster
import org.apache.commons.lang.exception.ExceptionUtils import org.apache.commons.lang.exception.ExceptionUtils
import java.lang.Exception
import java.sql.Connection import java.sql.Connection
import java.sql.DriverManager import java.sql.DriverManager
import java.sql.ResultSet import java.sql.ResultSet
@ -59,8 +58,10 @@ class SqliteManager(private val chunkmaster: Chunkmaster) {
} }
try { try {
Class.forName("org.sqlite.JDBC") Class.forName("org.sqlite.JDBC")
this.connection = DriverManager.getConnection("jdbc:sqlite:${chunkmaster.dataFolder.absolutePath}/" + this.connection = DriverManager.getConnection(
"${chunkmaster.config.getString("database.filename")}") "jdbc:sqlite:${chunkmaster.dataFolder.absolutePath}/" +
"${chunkmaster.config.getString("database.filename")}"
)
return this.connection return this.connection
} catch (e: Exception) { } catch (e: Exception) {
chunkmaster.logger.severe(chunkmaster.langManager.getLocalized("DATABASE_CONNECTION_ERROR")) chunkmaster.logger.severe(chunkmaster.langManager.getLocalized("DATABASE_CONNECTION_ERROR"))
@ -147,7 +148,13 @@ class SqliteManager(private val chunkmaster: Chunkmaster) {
tableDef += "${column.first} ${column.second}," tableDef += "${column.first} ${column.second},"
} }
tableDef = tableDef.substringBeforeLast(",") + ");" tableDef = tableDef.substringBeforeLast(",") + ");"
chunkmaster.logger.finest(chunkmaster.langManager.getLocalized("CREATE_TABLE_DEFINITION", table, tableDef)) chunkmaster.logger.finest(
chunkmaster.langManager.getLocalized(
"CREATE_TABLE_DEFINITION",
table,
tableDef
)
)
executeStatement(tableDef, HashMap(), null) executeStatement(tableDef, HashMap(), null)
} catch (e: Exception) { } catch (e: Exception) {
chunkmaster.logger.severe(chunkmaster.langManager.getLocalized("TABLE_CREATE_ERROR", table)) chunkmaster.logger.severe(chunkmaster.langManager.getLocalized("TABLE_CREATE_ERROR", table))
@ -159,9 +166,21 @@ class SqliteManager(private val chunkmaster: Chunkmaster) {
val updateSql = "ALTER TABLE ${table.first} ADD COLUMN ${table.second.first} ${table.second.second}" val updateSql = "ALTER TABLE ${table.first} ADD COLUMN ${table.second.first} ${table.second.second}"
try { try {
executeStatement(updateSql, HashMap(), null) executeStatement(updateSql, HashMap(), null)
chunkmaster.logger.finest(chunkmaster.langManager.getLocalized("UPDATE_TABLE_DEFINITION", table.first, updateSql)) chunkmaster.logger.finest(
chunkmaster.langManager.getLocalized(
"UPDATE_TABLE_DEFINITION",
table.first,
updateSql
)
)
} catch (e: Exception) { } catch (e: Exception) {
chunkmaster.logger.severe(chunkmaster.langManager.getLocalized("UPDATE_TABLE_FAILED", table.first, updateSql)) chunkmaster.logger.severe(
chunkmaster.langManager.getLocalized(
"UPDATE_TABLE_FAILED",
table.first,
updateSql
)
)
chunkmaster.logger.severe(e.message) chunkmaster.logger.severe(e.message)
chunkmaster.logger.info(ExceptionUtils.getStackTrace(e)) chunkmaster.logger.info(ExceptionUtils.getStackTrace(e))
} }

@ -1,6 +1,5 @@
package net.trivernis.chunkmaster.lib.database package net.trivernis.chunkmaster.lib.database
import net.trivernis.chunkmaster.lib.generation.ChunkCoordinates
import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture
class WorldProperties(private val sqliteManager: SqliteManager) { class WorldProperties(private val sqliteManager: SqliteManager) {
@ -49,7 +48,8 @@ class WorldProperties(private val sqliteManager: SqliteManager) {
*/ */
private fun updateWorldProperties(worldName: String, center: Pair<Int, Int>): CompletableFuture<Void> { private fun updateWorldProperties(worldName: String, center: Pair<Int, Int>): CompletableFuture<Void> {
val completableFuture = CompletableFuture<Void>() val completableFuture = CompletableFuture<Void>()
sqliteManager.executeStatement("UPDATE world_properties SET center_x = ?, center_z = ? WHERE name = ?", sqliteManager.executeStatement(
"UPDATE world_properties SET center_x = ?, center_z = ? WHERE name = ?",
hashMapOf( hashMapOf(
1 to center.first, 1 to center.first,
2 to center.second, 2 to center.second,
@ -67,7 +67,8 @@ class WorldProperties(private val sqliteManager: SqliteManager) {
*/ */
private fun insertWorldProperties(worldName: String, center: Pair<Int, Int>): CompletableFuture<Void> { private fun insertWorldProperties(worldName: String, center: Pair<Int, Int>): CompletableFuture<Void> {
val completableFuture = CompletableFuture<Void>() val completableFuture = CompletableFuture<Void>()
sqliteManager.executeStatement("INSERT INTO world_properties (name, center_x, center_z) VALUES (?, ?, ?)", sqliteManager.executeStatement(
"INSERT INTO world_properties (name, center_x, center_z) VALUES (?, ?, ?)",
hashMapOf( hashMapOf(
1 to worldName, 1 to worldName,
2 to center.first, 2 to center.first,

@ -2,7 +2,6 @@ package net.trivernis.chunkmaster.lib.dynmap
import org.bukkit.Location import org.bukkit.Location
import org.dynmap.markers.AreaMarker import org.dynmap.markers.AreaMarker
import org.dynmap.markers.Marker
import org.dynmap.markers.MarkerSet import org.dynmap.markers.MarkerSet
import org.dynmap.markers.PolyLineMarker import org.dynmap.markers.PolyLineMarker
@ -46,7 +45,12 @@ class ExtendedMarkerSet(private val markerSet: MarkerSet) {
} }
fun creUpdatePolyLineMarker(id: String, label: String, edges: List<Location>, style: MarkerStyle?): PolyLineMarker? { fun creUpdatePolyLineMarker(
id: String,
label: String,
edges: List<Location>,
style: MarkerStyle?
): PolyLineMarker? {
var marker = markerSet.findPolyLineMarker(id) var marker = markerSet.findPolyLineMarker(id)
val xList = edges.map { it.x } val xList = edges.map { it.x }
val yList = edges.map { it.y } val yList = edges.map { it.y }
@ -54,7 +58,16 @@ class ExtendedMarkerSet(private val markerSet: MarkerSet) {
if (marker != null) { if (marker != null) {
marker.setCornerLocations(xList.toDoubleArray(), yList.toDoubleArray(), zList.toDoubleArray()) marker.setCornerLocations(xList.toDoubleArray(), yList.toDoubleArray(), zList.toDoubleArray())
} else { } else {
marker = markerSet.createPolyLineMarker(id, label, false, edges.first().world.name, xList.toDoubleArray(), yList.toDoubleArray(), zList.toDoubleArray(), true) marker = markerSet.createPolyLineMarker(
id,
label,
false,
edges.first().world.name,
xList.toDoubleArray(),
yList.toDoubleArray(),
zList.toDoubleArray(),
true
)
} }
if (style != null) { if (style != null) {
if (style.lineStyle != null) { if (style.lineStyle != null) {

@ -2,4 +2,9 @@ package net.trivernis.chunkmaster.lib.dynmap
import org.dynmap.markers.MarkerIcon import org.dynmap.markers.MarkerIcon
data class MarkerStyle(val icon: MarkerIcon?, val lineStyle: LineStyle?, val fillStyle: FillStyle?, val boostFlag: Boolean = false) data class MarkerStyle(
val icon: MarkerIcon?,
val lineStyle: LineStyle?,
val fillStyle: FillStyle?,
val boostFlag: Boolean = false
)

@ -2,11 +2,8 @@ package net.trivernis.chunkmaster.lib.generation
import net.trivernis.chunkmaster.Chunkmaster import net.trivernis.chunkmaster.Chunkmaster
import org.bukkit.Chunk import org.bukkit.Chunk
import java.lang.Exception
import java.util.* import java.util.*
import java.util.concurrent.*
import java.util.concurrent.locks.ReentrantReadWriteLock import java.util.concurrent.locks.ReentrantReadWriteLock
import kotlin.collections.HashSet
class ChunkUnloader(private val plugin: Chunkmaster) : Runnable { class ChunkUnloader(private val plugin: Chunkmaster) : Runnable {
private val maxLoadedChunks = plugin.config.getInt("generation.max-loaded-chunks") private val maxLoadedChunks = plugin.config.getInt("generation.max-loaded-chunks")

@ -4,7 +4,7 @@ import io.papermc.lib.PaperLib
import net.trivernis.chunkmaster.Chunkmaster import net.trivernis.chunkmaster.Chunkmaster
import net.trivernis.chunkmaster.lib.shapes.Shape import net.trivernis.chunkmaster.lib.shapes.Shape
import org.bukkit.World import org.bukkit.World
import java.util.concurrent.* import java.util.concurrent.ArrayBlockingQueue
class DefaultGenerationTask( class DefaultGenerationTask(
private val plugin: Chunkmaster, private val plugin: Chunkmaster,

@ -4,7 +4,6 @@ import net.trivernis.chunkmaster.Chunkmaster
import net.trivernis.chunkmaster.lib.dynmap.* import net.trivernis.chunkmaster.lib.dynmap.*
import net.trivernis.chunkmaster.lib.shapes.Shape import net.trivernis.chunkmaster.lib.shapes.Shape
import org.bukkit.World import org.bukkit.World
import java.util.concurrent.Semaphore
import kotlin.math.ceil import kotlin.math.ceil
/** /**
@ -75,12 +74,14 @@ abstract class GenerationTask(
TaskState.CORRECTING -> { TaskState.CORRECTING -> {
this.generateMissing() this.generateMissing()
} }
else -> { } else -> {
}
} }
if (!cancelRun && this.borderReached()) { if (!cancelRun && this.borderReached()) {
this.setEndReached() this.setEndReached()
} }
} catch (e: InterruptedException){} } catch (e: InterruptedException) {
}
isRunning = false isRunning = false
} }
@ -108,7 +109,8 @@ abstract class GenerationTask(
markerSet?.creUpdatePolyLineMarker( markerSet?.creUpdatePolyLineMarker(
markerAreaId, markerAreaId,
markerAreaName, markerAreaName,
this.shape.getShapeEdgeLocations().map { ChunkCoordinates(it.first, it.second).getCenterLocation(this.world) }, this.shape.getShapeEdgeLocations()
.map { ChunkCoordinates(it.first, it.second).getCenterLocation(this.world) },
markerAreaStyle markerAreaStyle
) )
} }

@ -1,6 +1,5 @@
package net.trivernis.chunkmaster.lib.generation package net.trivernis.chunkmaster.lib.generation
import net.trivernis.chunkmaster.lib.generation.ChunkCoordinates
import org.bukkit.Chunk import org.bukkit.Chunk
import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture

@ -1,6 +1,5 @@
package net.trivernis.chunkmaster.lib.generation.taskentry package net.trivernis.chunkmaster.lib.generation.taskentry
import io.papermc.lib.PaperLib
import net.trivernis.chunkmaster.lib.generation.GenerationTask import net.trivernis.chunkmaster.lib.generation.GenerationTask
class RunningTaskEntry( class RunningTaskEntry(

@ -1,14 +1,10 @@
package net.trivernis.chunkmaster.lib.shapes package net.trivernis.chunkmaster.lib.shapes
import net.trivernis.chunkmaster.lib.dynmap.ExtendedMarkerSet
import net.trivernis.chunkmaster.lib.dynmap.MarkerStyle
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
import kotlin.collections.HashSet import kotlin.collections.HashSet
import kotlin.math.PI import kotlin.math.PI
import kotlin.math.pow import kotlin.math.pow
import kotlin.math.sqrt
import kotlin.system.exitProcess
class Circle(center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int) : Shape(center, start, radius) { class Circle(center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int) : Shape(center, start, radius) {
private var r = 0 private var r = 0
@ -50,16 +46,19 @@ class Circle(center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int) : Shape
if (endReached()) { if (endReached()) {
return currentPos return currentPos
} }
if (count == 0 && currentPos != center) { if (count == 0 && currentPos != center) {
val tmpCircle = Circle(center, center, radius) val tmpCircle = Circle(center, center, radius)
while (tmpCircle.next() != currentPos && !tmpCircle.endReached()); while (tmpCircle.next() != currentPos && !tmpCircle.endReached());
this.count = tmpCircle.count this.count = tmpCircle.count
this.r = tmpCircle.r this.r = tmpCircle.r
} }
if (count == 0) { if (count == 0) {
count++ count++
return center return center
} }
if (coords.isEmpty()) { if (coords.isEmpty()) {
r++ r++
val tmpCoords = HashSet<Pair<Int, Int>>() val tmpCoords = HashSet<Pair<Int, Int>>()
@ -70,6 +69,7 @@ class Circle(center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int) : Shape
coords.addAll(tmpCoords) coords.addAll(tmpCoords)
previousCoords.addAll(tmpCoords) previousCoords.addAll(tmpCoords)
} }
count++ count++
val coord = coords.pop() val coord = coords.pop()
currentPos = Pair(coord.first + center.first, coord.second + center.second) currentPos = Pair(coord.first + center.first, coord.second + center.second)

@ -1,9 +1,5 @@
package net.trivernis.chunkmaster.lib.shapes package net.trivernis.chunkmaster.lib.shapes
import net.trivernis.chunkmaster.lib.dynmap.ExtendedMarkerSet
import net.trivernis.chunkmaster.lib.dynmap.MarkerStyle
import javax.xml.stream.Location
abstract class Shape(protected val center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int) { abstract class Shape(protected val center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int) {
protected var currentPos = start protected var currentPos = start
protected var radius = radius protected var radius = radius

@ -1,9 +1,7 @@
package net.trivernis.chunkmaster.lib.shapes package net.trivernis.chunkmaster.lib.shapes
import kotlin.math.PI
import kotlin.math.abs import kotlin.math.abs
import kotlin.math.pow import kotlin.math.pow
import kotlin.math.sqrt
class Spiral(center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int) : Shape(center, start, radius) { class Spiral(center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int) : Shape(center, start, radius) {
private var direction = 0 private var direction = 0

Loading…
Cancel
Save