Compatibility with most plugin using wesjd anvil gui

This commit is contained in:
alexcrea 2024-09-22 20:12:56 +02:00
parent 74a211bc88
commit a915d5ad80
15 changed files with 267 additions and 1 deletions

View file

@ -0,0 +1,24 @@
package xyz.alexcrea.cuanvil.dependency.gui
import org.bukkit.inventory.InventoryView
interface ExternGuiTester {
val wesjdAnvilGuiName: String?
fun getContainerClass(inventory: InventoryView): Class<Any>?
fun testIfGui(inventory: InventoryView): Boolean {
val clazz = getContainerClass(inventory)
if(clazz == null) return false
val expectedWesjdGuiPath = "anvilgui.version.$wesjdAnvilGuiName"
val clazzName = clazz.name
val isWejdsGui = clazzName.contains(expectedWesjdGuiPath)
return isWejdsGui
}
}