
walkmc.shape.Line.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of walk-server Show documentation
Show all versions of walk-server Show documentation
A spigot fork to kotlin structure and news.
@file:UseContextualSerialization(Location::class)
package walkmc.shape
import kotlinx.serialization.*
import org.bukkit.*
import walkmc.extensions.*
/**
* Represents a line util class. This can be used to draw/display particles in a line.
*/
@Serializable
data class Line(
var start: Location,
var end: Location,
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 = start.generateLinePath(end, points)
this.path = path
return path
}
}
/**
* Creates a line representation with this location as center.
*/
fun Location.line(end: Location, points: Int) = Line(this, end, points)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy