mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Custom anvil only work on nms menu
This commit is contained in:
parent
0993b007a0
commit
8afd54c94d
3 changed files with 16 additions and 6 deletions
|
|
@ -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 "")
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue