命令按钮支持 IA HEAD
This commit is contained in:
@@ -5,14 +5,36 @@ import com.github.xbaimiao.shoppro.util.Util.replacePapi
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import taboolib.library.xseries.XMaterial
|
||||
import taboolib.platform.util.ItemBuilder
|
||||
import taboolib.platform.util.modifyLore
|
||||
import java.util.*
|
||||
|
||||
open class ItemImpl(
|
||||
override val material: Material, override val lore: List<String>, override val name: String,
|
||||
class ItemImpl(
|
||||
materialString: String, override val lore: List<String>, override val name: String,
|
||||
override val key: Char, override val vanilla: Boolean, override val commands: List<String>,
|
||||
override val shop: Shop
|
||||
) : Item {
|
||||
|
||||
override lateinit var material: Material
|
||||
|
||||
var custom: Int? = null
|
||||
var head: String? = null
|
||||
|
||||
init {
|
||||
if (materialString.startsWith("HEAD:")) {
|
||||
material = XMaterial.PLAYER_HEAD.parseMaterial()!!
|
||||
head = materialString.substring(5)
|
||||
} else if (materialString.startsWith("IA:")) {
|
||||
materialString.split(":").let { strings ->
|
||||
material = XMaterial.matchXMaterial(strings[1]).get().parseMaterial()!!
|
||||
custom = strings[2].toInt()
|
||||
}
|
||||
} else {
|
||||
material = XMaterial.matchXMaterial(materialString).get().parseMaterial()!!
|
||||
}
|
||||
}
|
||||
|
||||
override fun isCommodity(): Boolean {
|
||||
return false
|
||||
}
|
||||
@@ -21,6 +43,10 @@ open class ItemImpl(
|
||||
return taboolib.platform.util.buildItem(material) {
|
||||
this.name = this@ItemImpl.name
|
||||
this.lore.addAll(this@ItemImpl.lore)
|
||||
custom?.let { customModelData = it }
|
||||
head?.let {
|
||||
skullTexture = ItemBuilder.SkullTexture(it, UUID.randomUUID())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user