Update KSpigot to 1.18.1

This commit is contained in:
Jakob K
2021-12-12 03:06:10 +01:00
parent c23b41e086
commit cc4d180902
10 changed files with 76 additions and 84 deletions

View File

@@ -9,7 +9,6 @@ import net.md_5.bungee.api.ChatMessageType
import org.bukkit.Location
import org.bukkit.Material
import org.bukkit.attribute.Attribute
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld
import org.bukkit.entity.*
import org.bukkit.inventory.EquipmentSlot
import org.bukkit.inventory.ItemStack
@@ -102,21 +101,15 @@ fun Player.showOnlinePlayers() {
onlinePlayers.filter { it != this }.forEach { this.showPlayer(PluginInstance, it) }
}
/**
* Kicks the player from the server.
*/
fun Player.kick(reason: String? = "You got kicked!") {
kickPlayer(reason)
}
/**
* Spawns an entity without any variations in color, type etc...
*/
@Deprecated("This function is unstable and it cannot be guaranteed that it will work at any time in the future.")
@NMS_General
fun Location.spawnCleanEntity(entityType: EntityType): Entity? {
val craftWorld = world as? CraftWorld ?: return null
val craftWorld = world as? org.bukkit.craftbukkit.v1_18_R1.CraftWorld ?: return null
return craftWorld.createEntity(this, entityType.entityClass)?.let {
craftWorld.handle.addEntity(it)
craftWorld.handle.addFreshEntity(it)
return@let it.bukkitEntity
}
}
@@ -135,6 +128,7 @@ fun Player.title(
stay: Int = 70,
fadeOut: Int = 20,
) {
@Suppress("DEPRECATION")
sendTitle(mainText, subText, fadeIn, stay, fadeOut)
}