All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.carcadex.kotlinbukkitkit.extensions.ExLocation.kt Maven / Gradle / Ivy

The newest version!
/*
ORIGINAL PACKAGE: package br.com.devsrsouza.kotlinbukkitapi.extensions
ORIGINAL REPOSITORY: https://github.com/DevSrSouza/KotlinBukkitAPI
AUTHOR: https://github.com/DevSrSouza

Thanks DevSrSouza for KotlinBukkitAPI
 */

package tech.carcadex.kotlinbukkitkit.extensions

import org.bukkit.BlockChangeDelegate
import org.bukkit.Effect
import org.bukkit.Location
import org.bukkit.Sound
import org.bukkit.TreeType
import org.bukkit.block.Block
import org.bukkit.entity.Arrow
import org.bukkit.entity.Entity
import org.bukkit.entity.Item
import org.bukkit.entity.LightningStrike
import org.bukkit.inventory.ItemStack
import org.bukkit.util.Vector

public operator fun Location.component1(): Double = x
public operator fun Location.component2(): Double = y
public operator fun Location.component3(): Double = z
public operator fun Location.component4(): Float = yaw
public operator fun Location.component5(): Float = pitch

public operator fun Block.component1(): Int = x
public operator fun Block.component2(): Int = y
public operator fun Block.component3(): Int = z

public fun Location.dropItem(item: ItemStack): Item = world!!.dropItem(this, item)
public fun Location.dropItemNaturally(item: ItemStack): Item = world!!.dropItemNaturally(this, item)

public fun Location.spawnArrow(direction: Vector, speed: Float, spread: Float): Arrow = world!!.spawnArrow(this, direction, speed, spread)

public fun Location.generateTree(type: TreeType): Boolean = world!!.generateTree(this, type)
public fun Location.generateTree(type: TreeType, delegate: BlockChangeDelegate): Boolean = world!!.generateTree(this, type, delegate)

public fun Location.strikeLightning(): LightningStrike = world!!.strikeLightning(this)
public fun Location.strikeLightningEffect(): LightningStrike = world!!.strikeLightningEffect(this)

public fun Location.getNearbyEntities(x: Double, y: Double, z: Double): MutableCollection = world!!.getNearbyEntities(this, x, y, z)

public fun Location.createExplosion(power: Float): Boolean = world!!.createExplosion(this, power)
public fun Location.createExplosion(power: Float, setFire: Boolean): Boolean = world!!.createExplosion(this, power, setFire)

public inline fun  Location.spawn(): T = world!!.spawn(this)

public fun Location.playEffect(effect: Effect, data: Int): Unit = world!!.playEffect(this, effect, data)
public fun Location.playEffect(effect: Effect, data: Int, radius: Int): Unit = world!!.playEffect(this, effect, data, radius)
public fun  Location.playEffect(effect: Effect, data: T): Unit = world!!.playEffect(this, effect, data)
public fun  Location.playEffect(effect: Effect, data: T, radius: Int): Unit = world!!.playEffect(this, effect, data, radius)

public fun Location.playSound(sound: Sound, volume: Float, pitch: Float): Unit = world!!.playSound(this, sound, volume, pitch)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy