mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-02-16 04:31:22 +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.EventHandler
|
||||||
import org.bukkit.event.Listener
|
import org.bukkit.event.Listener
|
||||||
import org.bukkit.event.block.BlockBreakEvent
|
import org.bukkit.event.block.BlockBreakEvent
|
||||||
|
import org.bukkit.inventory.ItemStack
|
||||||
|
|
||||||
class EnchantmentReplenish(
|
class EnchantmentReplenish(
|
||||||
plugin: EcoEnchantsPlugin
|
plugin: EcoEnchantsPlugin
|
||||||
@ -55,6 +56,20 @@ class EnchantmentReplenish(
|
|||||||
return
|
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) {
|
if (data.age != data.maximumAge) {
|
||||||
event.isDropItems = false
|
event.isDropItems = false
|
||||||
event.expToDrop = 0
|
event.expToDrop = 0
|
||||||
|
@ -14,3 +14,4 @@ enchantable: true
|
|||||||
|
|
||||||
conditions: [ ]
|
conditions: [ ]
|
||||||
|
|
||||||
|
consume-seeds: true # If seeds should be consumed in replanting
|
||||||
|
Loading…
Reference in New Issue
Block a user