Updated particle utils

This commit is contained in:
bluefireoly
2020-10-11 18:18:48 +02:00
parent f77b111822
commit 2810721fb6

View File

@@ -1,6 +1,7 @@
package net.axay.kspigot.particles package net.axay.kspigot.particles
import net.axay.kspigot.extensions.geometry.worldOrException import net.axay.kspigot.extensions.geometry.worldOrException
import net.axay.kspigot.kotlinextensions.apply
import org.bukkit.Location import org.bukkit.Location
import org.bukkit.Particle import org.bukkit.Particle
import org.bukkit.entity.Player import org.bukkit.entity.Player
@@ -64,23 +65,21 @@ data class KSpigotParticle(
* Accesses the particle builder. * Accesses the particle builder.
* @see KSpigotParticle * @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 * Accesses the particle builder and then immediately
* spawns the particle at the given location. * spawns the particle at the given location.
* @see KSpigotParticle * @see KSpigotParticle
* @see KSpigotParticle.spawnAt
*/ */
fun Location.particle(particle: Particle, builder: KSpigotParticle.() -> Unit) fun Location.particle(particle: Particle, builder: (KSpigotParticle.() -> Unit)?)
= KSpigotParticle(particle).apply(builder).spawnAt(this) = KSpigotParticle(particle).apply(builder).spawnAt(this)
/** /**
* Accesses the particle builder and then immediately * Accesses the particle builder and then immediately
* spawns the particle for the player. * spawns the particle for the player.
* @see KSpigotParticle * @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)