From bef6fb6ee4e0bf11c9f54545293af370d0224503 Mon Sep 17 00:00:00 2001 From: bluefireoly Date: Mon, 28 Sep 2020 23:35:28 +0200 Subject: [PATCH] Added documentation to KSpigotParticles --- .../kspigot/particles/KSpigotParticles.kt | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/net/axay/kspigot/particles/KSpigotParticles.kt b/src/main/kotlin/net/axay/kspigot/particles/KSpigotParticles.kt index d427d974..f2e16d24 100644 --- a/src/main/kotlin/net/axay/kspigot/particles/KSpigotParticles.kt +++ b/src/main/kotlin/net/axay/kspigot/particles/KSpigotParticles.kt @@ -23,6 +23,10 @@ data class KSpigotParticle( var force: Boolean = false ) { + /** + * Spawns the particle at the location. It + * will be visible for everyone near it. + */ fun spawnAt(loc: Location) { loc.worldOrException.spawnParticle( 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) { player.spawnParticle( particle, @@ -52,11 +60,27 @@ data class KSpigotParticle( } +/** + * Accesses the particle builder. + * @see KSpigotParticle + */ fun particle(particle: Particle, builder: KSpigotParticle.() -> Unit) = 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) = KSpigotParticle(particle).apply(builder).spawnFor(this) - -fun Location.particle(particle: Particle, builder: KSpigotParticle.() -> Unit) - = KSpigotParticle(particle).apply(builder).spawnAt(this) \ No newline at end of file