Added documentation to KSpigotParticles

This commit is contained in:
bluefireoly
2020-09-28 23:35:28 +02:00
parent 2dde989aa4
commit bef6fb6ee4

View File

@@ -23,6 +23,10 @@ data class KSpigotParticle(
var force: Boolean = false var force: Boolean = false
) { ) {
/**
* Spawns the particle at the location. It
* will be visible for everyone near it.
*/
fun spawnAt(loc: Location) { fun spawnAt(loc: Location) {
loc.worldOrException.spawnParticle( loc.worldOrException.spawnParticle(
particle, particle,
@@ -37,6 +41,10 @@ data class KSpigotParticle(
) )
} }
/**
* Spawns the particle at the location of the
* player. It will be only visible for the player.
*/
fun spawnFor(player: Player) { fun spawnFor(player: Player) {
player.spawnParticle( player.spawnParticle(
particle, particle,
@@ -52,11 +60,27 @@ data class KSpigotParticle(
} }
/**
* Accesses the particle builder.
* @see KSpigotParticle
*/
fun particle(particle: Particle, builder: KSpigotParticle.() -> Unit) fun particle(particle: Particle, builder: KSpigotParticle.() -> Unit)
= KSpigotParticle(particle).apply(builder) = KSpigotParticle(particle).apply(builder)
/**
* Accesses the particle builder and then immediately
* spawns the particle at the given location.
* @see KSpigotParticle
* @see KSpigotParticle.spawnAt
*/
fun Location.particle(particle: Particle, builder: KSpigotParticle.() -> Unit)
= KSpigotParticle(particle).apply(builder).spawnAt(this)
/**
* Accesses the particle builder and then immediately
* spawns the particle for the player.
* @see KSpigotParticle
* @see KSpigotParticle.spawnFor
*/
fun Player.particle(particle: Particle, builder: KSpigotParticle.() -> Unit) fun Player.particle(particle: Particle, builder: KSpigotParticle.() -> Unit)
= KSpigotParticle(particle).apply(builder).spawnFor(this) = KSpigotParticle(particle).apply(builder).spawnFor(this)
fun Location.particle(particle: Particle, builder: KSpigotParticle.() -> Unit)
= KSpigotParticle(particle).apply(builder).spawnAt(this)