Added consume-seeds to replenish

This commit is contained in:
Auxilor 2022-10-09 17:53:56 +01:00
parent ed4570d5ae
commit f20aef3dec
2 changed files with 16 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import org.bukkit.block.data.Ageable
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.block.BlockBreakEvent
import org.bukkit.inventory.ItemStack
class EnchantmentReplenish(
plugin: EcoEnchantsPlugin
@ -55,6 +56,20 @@ class EnchantmentReplenish(
return
}
if (enchant.config.getBool("consume-seeds")) {
val item = ItemStack(
if (type == Material.WHEAT) {
Material.WHEAT_SEEDS
} else type
)
val hasSeeds = player.inventory.removeItem(item).isEmpty()
if (!hasSeeds) {
return
}
}
if (data.age != data.maximumAge) {
event.isDropItems = false
event.expToDrop = 0

View File

@ -14,3 +14,4 @@ enchantable: true
conditions: [ ]
consume-seeds: true # If seeds should be consumed in replanting