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

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

There is a newer version: 1.0.1.0
Show 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.Bukkit
import org.bukkit.Effect
import org.bukkit.Instrument
import org.bukkit.Material
import org.bukkit.Note
import org.bukkit.OfflinePlayer
import org.bukkit.Sound
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.PlayerInventory

public fun PlayerInventory.clearArmor() {
    setArmorContents(arrayOf(null, null, null, null))
}

public fun PlayerInventory.clearAll() {
    clear()
    clearArmor()
}

public val Player.hasItemInHand: Boolean get() = itemInHand != null && itemInHand.type != Material.AIR

public fun Player.playSound(sound: Sound, volume: Float, pitch: Float): Unit = playSound(location, sound, volume, pitch)
public fun Player.playNote(instrument: Instrument, note: Note): Unit = playNote(location, instrument, note)
public fun  Player.playEffect(effect: Effect, data: T? = null): Unit = playEffect(location, effect, data)

public fun CommandSender.msg(message: List): Unit = message.forEach { msg(it) }

public fun Player.resetWalkSpeed() {
    walkSpeed = 0.2f
}

public fun Player.resetFlySpeed() {
    flySpeed = 0.1f
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy