Cleanup DealerInventory and TNTLeagueConfig
This commit is contained in:
@@ -24,11 +24,9 @@ import org.bukkit.Material
|
||||
import org.bukkit.configuration.ConfigurationSection
|
||||
import org.bukkit.configuration.file.FileConfiguration
|
||||
import org.bukkit.enchantments.Enchantment
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.inventory.meta.BookMeta
|
||||
import org.bukkit.inventory.meta.Damageable
|
||||
import org.bukkit.inventory.meta.ItemMeta
|
||||
import java.util.UUID
|
||||
import java.util.*
|
||||
|
||||
data class TNTLeagueConfig(
|
||||
val startDelay: Int = 10,
|
||||
@@ -74,21 +72,17 @@ data class TNTLeagueConfig(
|
||||
ANGLES;
|
||||
}
|
||||
|
||||
enum class ItemExtra(val func: (item: ItemMeta) -> ItemMeta) {
|
||||
enum class ItemExtra(val func: (item: ItemMeta) -> Unit) {
|
||||
ONESHOT({
|
||||
if (it is Damageable) {
|
||||
it.damage = 384
|
||||
}
|
||||
|
||||
it
|
||||
}),
|
||||
FLAME({
|
||||
it.addEnchant(Enchantment.FLAME, 1, false)
|
||||
it
|
||||
}),
|
||||
UNBREAKING({
|
||||
it.addEnchant(Enchantment.UNBREAKING, 1, false)
|
||||
it
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ import org.bukkit.inventory.Inventory
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.persistence.PersistentDataType
|
||||
import java.util.*
|
||||
import kotlin.math.ceil
|
||||
|
||||
class DealerInventory(val player: Player): SWInventoryHolder() {
|
||||
|
||||
@@ -83,7 +82,7 @@ class DealerInventory(val player: Player): SWInventoryHolder() {
|
||||
}
|
||||
|
||||
team.coins -= price
|
||||
player.inventory.addItem(ItemStack.of(item.first.type, amount).also { item.second.extras.forEach { extra -> it.itemMeta = extra.func(it.itemMeta) } })
|
||||
player.inventory.addItem(ItemStack.of(item.first.type, amount).apply { item.second.extras.forEach { itemMeta = itemMeta.apply(it.func) } })
|
||||
}
|
||||
|
||||
private val items by lazy {
|
||||
|
||||
Reference in New Issue
Block a user