
walkmc.shape.Circle.kt Maven / Gradle / Ivy
@file:UseContextualSerialization(Location::class)
package walkmc.shape
import kotlinx.serialization.*
import org.bukkit.*
import walkmc.extensions.*
/**
* Represents a circle util class. This can be used to draw/display particles in a circle.
*/
@Serializable
data class Circle(
var center: Location,
var radius: Double,
var points: Int,
) : Shape {
/**
* Returns the path of this shape.
*/
@Transient
override lateinit var path: List
/**
* Generates the [path] and updates their property.
*/
override fun generatePath(): List {
val path = center.generateCirclePath(radius, points)
this.path = path
return path
}
}
/**
* Creates a circle representation with this location as center.
*/
fun Location.circle(radius: Double, points: Int) = Circle(this, radius, points)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy