可选关闭一次性出售或购买一组
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
group=com.github.xbaimiao.shoppro
|
group=com.github.xbaimiao.shoppro
|
||||||
version=1.2.4
|
version=1.2.5
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ interface Item {
|
|||||||
val vanilla: Boolean
|
val vanilla: Boolean
|
||||||
val commands: List<String>
|
val commands: List<String>
|
||||||
val shop: Shop
|
val shop: Shop
|
||||||
|
val enableRight: Boolean
|
||||||
|
|
||||||
fun isCommodity(): Boolean
|
fun isCommodity(): Boolean
|
||||||
fun buildItem(player: Player): ItemStack
|
fun buildItem(player: Player): ItemStack
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ abstract class ItemLoader {
|
|||||||
conditionIcon = this.getString("condition-icon")?.parseToMaterial(),
|
conditionIcon = this.getString("condition-icon")?.parseToMaterial(),
|
||||||
conditionLore = this.getStringList("condition-lore"),
|
conditionLore = this.getStringList("condition-lore"),
|
||||||
conditionName = this.getString("condition-name"),
|
conditionName = this.getString("condition-name"),
|
||||||
limitPermissionMap = limitMap
|
limitPermissionMap = limitMap,
|
||||||
|
enableRight = this.getBoolean("right_click", true)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ abstract class ShopItem(
|
|||||||
val limitServer: Long,
|
val limitServer: Long,
|
||||||
private val limitPlayer: Long,
|
private val limitPlayer: Long,
|
||||||
private val limitPermissionMap: Map<String, Long>,
|
private val limitPermissionMap: Map<String, Long>,
|
||||||
val currency: Currency
|
val currency: Currency,
|
||||||
|
override val enableRight: Boolean
|
||||||
) : Item, KetherCondition {
|
) : Item, KetherCondition {
|
||||||
|
|
||||||
constructor(itemSetting: ItemSetting) : this(
|
constructor(itemSetting: ItemSetting) : this(
|
||||||
@@ -46,7 +47,8 @@ abstract class ShopItem(
|
|||||||
itemSetting.limitServer,
|
itemSetting.limitServer,
|
||||||
itemSetting.limitPlayer,
|
itemSetting.limitPlayer,
|
||||||
itemSetting.limitPermissionMap,
|
itemSetting.limitPermissionMap,
|
||||||
itemSetting.currency
|
itemSetting.currency,
|
||||||
|
itemSetting.enableRight
|
||||||
)
|
)
|
||||||
|
|
||||||
class ItemSetting(
|
class ItemSetting(
|
||||||
@@ -65,7 +67,8 @@ abstract class ShopItem(
|
|||||||
val limitServer: Long,
|
val limitServer: Long,
|
||||||
val limitPlayer: Long,
|
val limitPlayer: Long,
|
||||||
val limitPermissionMap: Map<String, Long>,
|
val limitPermissionMap: Map<String, Long>,
|
||||||
var currency: Currency
|
var currency: Currency,
|
||||||
|
val enableRight: Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun isCommodity(): Boolean {
|
override fun isCommodity(): Boolean {
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ class ItemImpl(
|
|||||||
override val key: Char,
|
override val key: Char,
|
||||||
override val vanilla: Boolean,
|
override val vanilla: Boolean,
|
||||||
override val commands: List<String>,
|
override val commands: List<String>,
|
||||||
override val shop: Shop
|
override val shop: Shop,
|
||||||
|
override val enableRight: Boolean
|
||||||
) : Item {
|
) : Item {
|
||||||
|
|
||||||
override lateinit var material: Material
|
override lateinit var material: Material
|
||||||
@@ -82,7 +83,8 @@ class ItemImpl(
|
|||||||
char,
|
char,
|
||||||
section.getBoolean("vanilla", true),
|
section.getBoolean("vanilla", true),
|
||||||
section.getStringList("commands"),
|
section.getStringList("commands"),
|
||||||
shop
|
shop,
|
||||||
|
section.getBoolean("right_click", true)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import com.github.xbaimiao.shoppro.core.item.KetherCondition
|
|||||||
import com.github.xbaimiao.shoppro.core.item.ShopItem
|
import com.github.xbaimiao.shoppro.core.item.ShopItem
|
||||||
import com.github.xbaimiao.shoppro.util.Util.howManyItems
|
import com.github.xbaimiao.shoppro.util.Util.howManyItems
|
||||||
import com.github.xbaimiao.shoppro.util.Util.replacePapi
|
import com.github.xbaimiao.shoppro.util.Util.replacePapi
|
||||||
import io.lumine.xikage.mythicmobs.utils.adventure.text.minimessage.MiniMessage
|
|
||||||
import io.lumine.xikage.mythicmobs.utils.adventure.text.minimessage.MiniMessageImpl
|
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import org.bukkit.configuration.Configuration
|
import org.bukkit.configuration.Configuration
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
@@ -110,7 +108,7 @@ class ShopImpl(private val configuration: Configuration) : Shop() {
|
|||||||
}
|
}
|
||||||
val amount = when (event.clickEvent().click) {
|
val amount = when (event.clickEvent().click) {
|
||||||
org.bukkit.event.inventory.ClickType.LEFT -> 1
|
org.bukkit.event.inventory.ClickType.LEFT -> 1
|
||||||
org.bukkit.event.inventory.ClickType.RIGHT -> 64
|
org.bukkit.event.inventory.ClickType.RIGHT -> if (item.enableRight) 64 else 1
|
||||||
else -> return@onClick
|
else -> return@onClick
|
||||||
}
|
}
|
||||||
checkBuyLimit(amount, item, player)
|
checkBuyLimit(amount, item, player)
|
||||||
@@ -124,11 +122,9 @@ class ShopImpl(private val configuration: Configuration) : Shop() {
|
|||||||
if (event.clickType != ClickType.CLICK) {
|
if (event.clickType != ClickType.CLICK) {
|
||||||
return@onClick
|
return@onClick
|
||||||
}
|
}
|
||||||
val amount : Int
|
val amount = when (event.clickEvent().click) {
|
||||||
if (configuration.getBoolean("items.${item.key}.right_click")){
|
|
||||||
amount = when (event.clickEvent().click) {
|
|
||||||
org.bukkit.event.inventory.ClickType.LEFT -> 1
|
org.bukkit.event.inventory.ClickType.LEFT -> 1
|
||||||
org.bukkit.event.inventory.ClickType.RIGHT -> 64
|
org.bukkit.event.inventory.ClickType.RIGHT -> if (item.enableRight) 64 else 1
|
||||||
org.bukkit.event.inventory.ClickType.SHIFT_RIGHT -> {
|
org.bukkit.event.inventory.ClickType.SHIFT_RIGHT -> {
|
||||||
player.inventory.howManyItems {
|
player.inventory.howManyItems {
|
||||||
item.equal(it)
|
item.equal(it)
|
||||||
@@ -137,18 +133,7 @@ class ShopImpl(private val configuration: Configuration) : Shop() {
|
|||||||
|
|
||||||
else -> return@onClick
|
else -> return@onClick
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
amount = when (event.clickEvent().click) {
|
|
||||||
org.bukkit.event.inventory.ClickType.LEFT -> 1
|
|
||||||
org.bukkit.event.inventory.ClickType.SHIFT_RIGHT -> {
|
|
||||||
player.inventory.howManyItems {
|
|
||||||
item.equal(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> return@onClick
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSellLimit(amount, item, player)
|
checkSellLimit(amount, item, player)
|
||||||
event.currentItem?.let {
|
event.currentItem?.let {
|
||||||
|
|||||||
Reference in New Issue
Block a user