mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Fix/neondevui (#59)
Fix incompatibility with plugin using neondevUI anvil gui
This commit is contained in:
commit
d8fbb034e5
1 changed files with 22 additions and 5 deletions
|
|
@ -9,15 +9,32 @@ interface ExternGuiTester {
|
|||
fun getContainerClass(inventory: InventoryView): Class<Any>?
|
||||
|
||||
fun testIfGui(inventory: InventoryView): Boolean {
|
||||
val clazz = getContainerClass(inventory)
|
||||
if(clazz == null) return false
|
||||
// this mean we are on test
|
||||
if(inventory.javaClass.name.endsWith("AnvilViewMock")) return false
|
||||
|
||||
val expectedWesjdGuiPath = "anvilgui.version.$wesjdAnvilGuiName"
|
||||
val clazz = getContainerClass(inventory) ?: return false
|
||||
|
||||
val clazzName = clazz.name
|
||||
val isWejdsGui = clazzName.contains(expectedWesjdGuiPath)
|
||||
if (expectWesjd(clazzName)) return true
|
||||
if (expectXenondevUI(clazzName)) return true
|
||||
|
||||
return isWejdsGui
|
||||
return false
|
||||
}
|
||||
|
||||
fun expectWesjd(name: String): Boolean {
|
||||
val expectedWesjdGuiPath = "anvilgui.version.$wesjdAnvilGuiName"
|
||||
|
||||
return name.contains(expectedWesjdGuiPath)
|
||||
}
|
||||
|
||||
private val XenondevUIPrefix: String
|
||||
get() = "xyz.xenondevs.inventoryaccess."
|
||||
private val XenondevUISufix: String
|
||||
get() = ".AnvilInventoryImpl"
|
||||
|
||||
fun expectXenondevUI(name: String): Boolean {
|
||||
return name.startsWith(XenondevUIPrefix)
|
||||
&& name.endsWith(XenondevUISufix)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue