mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-21 14:55:17 +01:00
Added consume-seeds to replenish
This commit is contained in:
parent
ed4570d5ae
commit
f20aef3dec
@ -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
|
||||
|
@ -14,3 +14,4 @@ enchantable: true
|
||||
|
||||
conditions: [ ]
|
||||
|
||||
consume-seeds: true # If seeds should be consumed in replanting
|
||||
|
Loading…
Reference in New Issue
Block a user