Custom anvil only work on nms menu (#97)

Meaning compatibility with most plugin using anvil menu and not only
some selected should be restored !
still need some manual testing
This commit is contained in:
alexcrea 2025-11-10 21:51:24 +01:00 committed by GitHub
commit bc8107ca44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 6 deletions

View file

@ -18,7 +18,7 @@ plugins {
} }
group = "xyz.alexcrea" group = "xyz.alexcrea"
version = "1.15.3" version = "1.15.4"
val effectiveVersion = "$version" + val effectiveVersion = "$version" +
(if (System.getenv("SMALL_COMMIT_HASH") != null) "-dev-${System.getenv("SMALL_COMMIT_HASH")!!}" else "") (if (System.getenv("SMALL_COMMIT_HASH") != null) "-dev-${System.getenv("SMALL_COMMIT_HASH")!!}" else "")

View file

@ -1,9 +1,14 @@
package xyz.alexcrea.cuanvil.dependency.gui package xyz.alexcrea.cuanvil.dependency.gui
import org.bukkit.inventory.InventoryView import org.bukkit.inventory.InventoryView
import xyz.alexcrea.cuanvil.dependency.util.PlatformUtil
interface ExternGuiTester { interface ExternGuiTester {
object Const{
val cannonicalPaperAnvilMenu = "net.minecraft.world.inventory.AnvilMenu"
}
val wesjdAnvilGuiName: String? val wesjdAnvilGuiName: String?
fun getContainerClass(inventory: InventoryView): Class<Any>? fun getContainerClass(inventory: InventoryView): Class<Any>?
@ -16,12 +21,17 @@ interface ExternGuiTester {
val clazz = getContainerClass(inventory) ?: return false val clazz = getContainerClass(inventory) ?: return false
val clazzName = clazz.name val clazzName = clazz.name
//TODO maybe instead of testing non default, better to be testing we are default ? if(!PlatformUtil.isPaper){
if (expectWesjd(clazzName)) return true // Blacklist gui causing issue
if (expectXenondevUI(clazzName)) return true if (expectWesjd(clazzName)) return true
if (expectVanePortal(clazzName)) return true if (expectXenondevUI(clazzName)) return true
if (expectVanePortal(clazzName)) return true
return false return false
}
// Only allow cannonical anvil menu class
return !Const.cannonicalPaperAnvilMenu.equals(clazzName, true)
} }
fun expectWesjd(name: String): Boolean { fun expectWesjd(name: String): Boolean {