Custom anvil only work on nms menu

This commit is contained in:
alexcrea 2025-11-07 00:02:17 +01:00
parent 0993b007a0
commit 8afd54c94d
Signed by: alexcrea
GPG key ID: E346CD16413450E3
3 changed files with 16 additions and 6 deletions

View file

@ -18,7 +18,7 @@ plugins {
}
group = "xyz.alexcrea"
version = "1.15.3"
version = "1.15.4"
val effectiveVersion = "$version" +
(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
import org.bukkit.inventory.InventoryView
import xyz.alexcrea.cuanvil.dependency.util.PlatformUtil
interface ExternGuiTester {
object Const{
val cannonicalPaperAnvilMenu = "net.minecraft.world.inventory.AnvilMenu"
}
val wesjdAnvilGuiName: String?
fun getContainerClass(inventory: InventoryView): Class<Any>?
@ -16,12 +21,17 @@ interface ExternGuiTester {
val clazz = getContainerClass(inventory) ?: return false
val clazzName = clazz.name
//TODO maybe instead of testing non default, better to be testing we are default ?
if (expectWesjd(clazzName)) return true
if (expectXenondevUI(clazzName)) return true
if (expectVanePortal(clazzName)) return true
if(!PlatformUtil.isPaper){
// Blacklist gui causing issue
if (expectWesjd(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 {