mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-02-15 04:21:20 +01:00
Fixed replenish
This commit is contained in:
parent
107227e828
commit
93ce5cccd2
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchants.impl
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin
|
||||
import com.willfp.ecoenchants.enchants.EcoEnchant
|
||||
import com.willfp.ecoenchants.target.EnchantLookup.hasEnchantActive
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.block.data.Ageable
|
||||
import org.bukkit.event.EventHandler
|
||||
@ -16,10 +17,11 @@ class EnchantmentReplenish(
|
||||
force = false
|
||||
) {
|
||||
init {
|
||||
this.registerListener(ReplenishHandler(plugin))
|
||||
this.registerListener(ReplenishHandler(this, plugin))
|
||||
}
|
||||
|
||||
private class ReplenishHandler(
|
||||
private val enchant: EcoEnchant,
|
||||
private val plugin: EcoEnchantsPlugin
|
||||
) : Listener {
|
||||
@EventHandler(
|
||||
@ -27,6 +29,11 @@ class EnchantmentReplenish(
|
||||
)
|
||||
fun handle(event: BlockBreakEvent) {
|
||||
val player = event.player
|
||||
|
||||
if (!player.hasEnchantActive(enchant)) {
|
||||
return
|
||||
}
|
||||
|
||||
val block = event.block
|
||||
val type = block.type
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user