支持1.12.2物品附加值
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@ taboolib {
|
||||
name("xbaimiao")
|
||||
}
|
||||
val bukkitNodes = bukkitNodes as MutableMap<Any, Any>
|
||||
bukkitNodes["update-info"] = "修复提示信息错误"
|
||||
bukkitNodes["update-info"] = "支持1.12.2物品附加值"
|
||||
}
|
||||
env {
|
||||
install(NMS_UTIL, UI)
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
group=com.github.xbaimiao.shoppro
|
||||
version=1.3.3-SNAPSHOT
|
||||
version=1.3.5-SNAPSHOT
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.github.xbaimiao.shoppro.core.database
|
||||
|
||||
import com.github.xbaimiao.shoppro.core.item.Item
|
||||
import com.github.xbaimiao.shoppro.core.item.ShopItem
|
||||
import com.github.xbaimiao.shoppro.core.item.impl.ItemsAdderShopItem
|
||||
import org.bukkit.entity.Player
|
||||
import taboolib.common.platform.function.submitAsync
|
||||
@@ -55,7 +56,7 @@ abstract class SqlDatabase : Database {
|
||||
|
||||
private fun Item.toCacheKey(): String {
|
||||
val item = this
|
||||
return "${item.key}-${item.material}-${if (item is ItemsAdderShopItem) item.custom else 0}"
|
||||
return "${item.key}-${item.material}-${if (item is ItemsAdderShopItem) item.custom else 0}-${if (item is ShopItem) item.data else 0}"
|
||||
}
|
||||
|
||||
override fun getPlayerAlreadyData(player: Player, item: Item): LimitData {
|
||||
|
||||
@@ -38,6 +38,7 @@ abstract class ItemLoader {
|
||||
lore = this.getStringList("lore").colored(),
|
||||
vanilla = this.getBoolean("vanilla", true),
|
||||
commands = this.getStringList("commands"),
|
||||
data = this.getInt("data"),
|
||||
shop = shop,
|
||||
script = this.getString("condition"),
|
||||
price = this.getDouble("price"),
|
||||
|
||||
@@ -28,7 +28,8 @@ abstract class ShopItem(
|
||||
private val limitPlayer: Long,
|
||||
private val limitPermissionMap: Map<String, Long>,
|
||||
val currency: Currency,
|
||||
override val enableRight: Boolean
|
||||
override val enableRight: Boolean,
|
||||
val data: Int,
|
||||
) : Item, KetherCondition {
|
||||
|
||||
constructor(itemSetting: ItemSetting) : this(
|
||||
@@ -48,7 +49,8 @@ abstract class ShopItem(
|
||||
itemSetting.limitPlayer,
|
||||
itemSetting.limitPermissionMap,
|
||||
itemSetting.currency,
|
||||
itemSetting.enableRight
|
||||
itemSetting.enableRight,
|
||||
itemSetting.data
|
||||
)
|
||||
|
||||
class ItemSetting(
|
||||
@@ -68,7 +70,8 @@ abstract class ShopItem(
|
||||
val limitPlayer: Long,
|
||||
val limitPermissionMap: Map<String, Long>,
|
||||
var currency: Currency,
|
||||
val enableRight: Boolean
|
||||
val enableRight: Boolean,
|
||||
val data: Int,
|
||||
)
|
||||
|
||||
override fun isCommodity(): Boolean {
|
||||
|
||||
@@ -29,10 +29,14 @@ class HeadShopItem(
|
||||
override fun vanillaItem(player: Player): ItemStack {
|
||||
return com.github.xbaimiao.shoppro.util.buildItem(material) {
|
||||
skullTexture = com.github.xbaimiao.shoppro.util.ItemBuilder.SkullTexture(head, UUID.randomUUID())
|
||||
damage = data
|
||||
}
|
||||
}
|
||||
|
||||
override fun equal(itemStack: ItemStack): Boolean {
|
||||
if (data != 0 && itemStack.durability.toInt() != data) {
|
||||
return false
|
||||
}
|
||||
return itemStack.itemMeta?.hasLore() == false && itemStack.type == item
|
||||
}
|
||||
|
||||
@@ -41,6 +45,7 @@ class HeadShopItem(
|
||||
this.name = this@HeadShopItem.name
|
||||
this.lore.addAll(this@HeadShopItem.lore)
|
||||
skullTexture = com.github.xbaimiao.shoppro.util.ItemBuilder.SkullTexture(head, UUID.randomUUID())
|
||||
damage = data
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,15 @@ import taboolib.platform.util.hasLore
|
||||
open class VanillaShopItem(itemSetting: ItemSetting) : ShopItem(itemSetting) {
|
||||
|
||||
override fun vanillaItem(player: Player): ItemStack {
|
||||
return com.github.xbaimiao.shoppro.util.buildItem(material)
|
||||
return com.github.xbaimiao.shoppro.util.buildItem(material) {
|
||||
damage = data
|
||||
}
|
||||
}
|
||||
|
||||
override fun equal(itemStack: ItemStack): Boolean {
|
||||
if (data != 0 && itemStack.durability.toInt() != data) {
|
||||
return false
|
||||
}
|
||||
return itemStack.type == material && !itemStack.hasLore()
|
||||
}
|
||||
|
||||
@@ -23,6 +28,7 @@ open class VanillaShopItem(itemSetting: ItemSetting) : ShopItem(itemSetting) {
|
||||
return com.github.xbaimiao.shoppro.util.buildItem(material) {
|
||||
this.name = this@VanillaShopItem.name
|
||||
this.lore.addAll(this@VanillaShopItem.lore)
|
||||
this.damage = data
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ items:
|
||||
# 您可在 currencys 里自定义货币
|
||||
currency: points
|
||||
name: '石头'
|
||||
# data为低版本特有的 data区分material
|
||||
# data: 1
|
||||
# 每日限购买
|
||||
limit: 5000
|
||||
# 每个玩家限购买
|
||||
|
||||
Reference in New Issue
Block a user