From 70e7476d458dd06c71fdcc5fc1155d9bcdfe6565 Mon Sep 17 00:00:00 2001 From: bluefireoly Date: Sat, 5 Sep 2020 20:09:26 +0200 Subject: [PATCH] Now using worldOrException --- .../kotlin/net/axay/kspigot/particles/KSpigotParticles.kt | 5 +++-- src/main/kotlin/net/axay/kspigot/structures/Circle.kt | 3 ++- 2 files changed, 5 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 3d04e2bb..7f76dbe2 100644 --- a/src/main/kotlin/net/axay/kspigot/particles/KSpigotParticles.kt +++ b/src/main/kotlin/net/axay/kspigot/particles/KSpigotParticles.kt @@ -1,5 +1,6 @@ package net.axay.kspigot.particles +import net.axay.kspigot.extensions.geometry.worldOrException import org.bukkit.Location import org.bukkit.Particle import org.bukkit.entity.Player @@ -15,7 +16,7 @@ data class KSpigotParticle( ) { fun spawnAt(loc: Location) { - loc.world?.spawnParticle( + loc.worldOrException.spawnParticle( particle, loc, amount, @@ -25,7 +26,7 @@ data class KSpigotParticle( extra.toDouble(), data, force - ) ?: throw IllegalArgumentException("The world of the given location is null!") + ) } fun spawnFor(player: Player) { diff --git a/src/main/kotlin/net/axay/kspigot/structures/Circle.kt b/src/main/kotlin/net/axay/kspigot/structures/Circle.kt index b572de27..fc01b758 100644 --- a/src/main/kotlin/net/axay/kspigot/structures/Circle.kt +++ b/src/main/kotlin/net/axay/kspigot/structures/Circle.kt @@ -3,6 +3,7 @@ package net.axay.kspigot.structures import net.axay.kspigot.extensions.geometry.SimpleLocation2D +import net.axay.kspigot.extensions.geometry.worldOrException import net.axay.kspigot.particles.KSpigotParticle import org.bukkit.Location import org.bukkit.Material @@ -87,6 +88,6 @@ class ParticleCircle(radius: Number, val particle: KSpigotParticle) : Circle(rad class EntityCircle(radius: Number, val entityType: EntityType) : Circle(radius) { override fun setAt(loc: Location) { - loc.world?.spawnEntity(loc, entityType) ?: throw IllegalArgumentException("The world of the given location is null!") + loc.worldOrException.spawnEntity(loc, entityType) } } \ No newline at end of file