Now using worldOrException
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package net.axay.kspigot.particles
|
package net.axay.kspigot.particles
|
||||||
|
|
||||||
|
import net.axay.kspigot.extensions.geometry.worldOrException
|
||||||
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
|
||||||
@@ -15,7 +16,7 @@ data class KSpigotParticle(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun spawnAt(loc: Location) {
|
fun spawnAt(loc: Location) {
|
||||||
loc.world?.spawnParticle(
|
loc.worldOrException.spawnParticle(
|
||||||
particle,
|
particle,
|
||||||
loc,
|
loc,
|
||||||
amount,
|
amount,
|
||||||
@@ -25,7 +26,7 @@ data class KSpigotParticle(
|
|||||||
extra.toDouble(),
|
extra.toDouble(),
|
||||||
data,
|
data,
|
||||||
force
|
force
|
||||||
) ?: throw IllegalArgumentException("The world of the given location is null!")
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun spawnFor(player: Player) {
|
fun spawnFor(player: Player) {
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
package net.axay.kspigot.structures
|
package net.axay.kspigot.structures
|
||||||
|
|
||||||
import net.axay.kspigot.extensions.geometry.SimpleLocation2D
|
import net.axay.kspigot.extensions.geometry.SimpleLocation2D
|
||||||
|
import net.axay.kspigot.extensions.geometry.worldOrException
|
||||||
import net.axay.kspigot.particles.KSpigotParticle
|
import net.axay.kspigot.particles.KSpigotParticle
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
import org.bukkit.Material
|
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) {
|
class EntityCircle(radius: Number, val entityType: EntityType) : Circle(radius) {
|
||||||
override fun setAt(loc: Location) {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user