mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
fix issue with EnchantmentSquared
This commit is contained in:
parent
253ea5f46b
commit
cf022cf36c
3 changed files with 17 additions and 1 deletions
|
|
@ -16,7 +16,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "xyz.alexcrea"
|
group = "xyz.alexcrea"
|
||||||
version = "1.9.0"
|
version = "1.9.1"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// EcoEnchants
|
// EcoEnchants
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -2,9 +2,11 @@ package xyz.alexcrea.cuanvil.dependency
|
||||||
|
|
||||||
import io.delilaheve.CustomAnvil
|
import io.delilaheve.CustomAnvil
|
||||||
import me.athlaeos.enchantssquared.enchantments.CustomEnchant
|
import me.athlaeos.enchantssquared.enchantments.CustomEnchant
|
||||||
|
import me.athlaeos.enchantssquared.listeners.AnvilListener
|
||||||
import me.athlaeos.enchantssquared.managers.CustomEnchantManager
|
import me.athlaeos.enchantssquared.managers.CustomEnchantManager
|
||||||
import org.bukkit.Material
|
import org.bukkit.Material
|
||||||
import org.bukkit.NamespacedKey
|
import org.bukkit.NamespacedKey
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent
|
||||||
import org.bukkit.event.inventory.PrepareAnvilEvent
|
import org.bukkit.event.inventory.PrepareAnvilEvent
|
||||||
import org.bukkit.inventory.ItemStack
|
import org.bukkit.inventory.ItemStack
|
||||||
import org.bukkit.plugin.Plugin
|
import org.bukkit.plugin.Plugin
|
||||||
|
|
@ -33,6 +35,20 @@ class EnchantmentSquaredDependency(private val enchantmentSquaredPlugin: Plugin)
|
||||||
|
|
||||||
fun disableAnvilListener(){
|
fun disableAnvilListener(){
|
||||||
PrepareAnvilEvent.getHandlerList().unregister(this.enchantmentSquaredPlugin)
|
PrepareAnvilEvent.getHandlerList().unregister(this.enchantmentSquaredPlugin)
|
||||||
|
|
||||||
|
// Find the anvil click event
|
||||||
|
var toRemove: AnvilListener? = null
|
||||||
|
for (registered in InventoryClickEvent.getHandlerList().registeredListeners) {
|
||||||
|
val listener = registered.listener
|
||||||
|
if(listener is AnvilListener) {
|
||||||
|
toRemove = listener
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(toRemove != null)
|
||||||
|
InventoryClickEvent.getHandlerList().unregister(toRemove)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun registerEnchantments(){
|
fun registerEnchantments(){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue