mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-24 00:26:16 +02:00
Merge branch 'feature/v2/itemType_group' into feature/v2/no-material
This commit is contained in:
commit
9803ca8e3a
4 changed files with 29 additions and 4 deletions
|
|
@ -27,6 +27,9 @@ repositories {
|
|||
// EcoEnchants
|
||||
maven(url = "https://repo.auxilor.io/repository/maven-public/")
|
||||
|
||||
// ExcellentEnchants
|
||||
maven(url = "https://repo.nightexpressdev.com/releases")
|
||||
|
||||
// ProtocoLib
|
||||
maven(url = "https://repo.dmulloy2.net/repository/public/")
|
||||
}
|
||||
|
|
@ -48,8 +51,9 @@ dependencies {
|
|||
compileOnly("com.willfp:eco:6.74.5")
|
||||
|
||||
// ExcellentEnchants
|
||||
compileOnly(files("libs/nightcore-2.7.3.jar"))
|
||||
compileOnly(files("libs/ExcellentEnchants-5.0.0.jar"))
|
||||
compileOnly("su.nightexpress.excellentenchants:Core:5.1.0") {
|
||||
exclude("org.spigotmc")
|
||||
}
|
||||
|
||||
// Disenchantment
|
||||
compileOnly(files("libs/Disenchantment-6.1.5.jar"))
|
||||
|
|
|
|||
BIN
libs/ExcellentEnchants-4.3.3-striped.jar
Normal file
BIN
libs/ExcellentEnchants-4.3.3-striped.jar
Normal file
Binary file not shown.
Binary file not shown.
|
|
@ -5,15 +5,18 @@ import com.jankominek.disenchantment.events.DisenchantClickEvent
|
|||
import com.jankominek.disenchantment.events.DisenchantEvent
|
||||
import com.jankominek.disenchantment.events.ShatterClickEvent
|
||||
import com.jankominek.disenchantment.events.ShatterEvent
|
||||
import com.jankominek.disenchantment.listeners.ShatterClickListener
|
||||
import io.delilaheve.CustomAnvil
|
||||
import org.bukkit.entity.HumanEntity
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.inventory.InventoryClickEvent
|
||||
import org.bukkit.event.inventory.PrepareAnvilEvent
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.inventory.view.AnvilView
|
||||
import xyz.alexcrea.cuanvil.listener.PrepareAnvilListener
|
||||
import xyz.alexcrea.cuanvil.util.AnvilXpUtil
|
||||
|
||||
import java.util.logging.Level
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@Suppress("unstableApiUsage")
|
||||
class DisenchantmentDependency {
|
||||
|
|
@ -24,7 +27,25 @@ class DisenchantmentDependency {
|
|||
|
||||
fun redirectListeners() {
|
||||
PrepareAnvilEvent.getHandlerList().unregister(Disenchantment.plugin)
|
||||
InventoryClickEvent.getHandlerList().unregister(Disenchantment.plugin)
|
||||
|
||||
// unregister only the feature click event and not all
|
||||
// This is to avoid the disenchantment gui breaking
|
||||
try {
|
||||
unregisterStaticDisenchantmentListener(ShatterClickListener::class)
|
||||
unregisterStaticDisenchantmentListener(InventoryClickEvent::class)
|
||||
} catch (e: Exception) {
|
||||
CustomAnvil.instance.logger.log(
|
||||
Level.SEVERE, "Could not initialize disenchantment support" +
|
||||
"please report this bug to the developer", e
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun unregisterStaticDisenchantmentListener(clazz: KClass<*>) {
|
||||
val field = clazz.java.getDeclaredField("listener")
|
||||
field.isAccessible = true
|
||||
val listener: Listener = field.get(null) as Listener
|
||||
InventoryClickEvent.getHandlerList().unregister(listener)
|
||||
}
|
||||
|
||||
fun testPrepareAnvil(event: PrepareAnvilEvent, player: HumanEntity): Boolean {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue