Add some testing (#38)

This commit is contained in:
alexcrea 2024-11-18 07:29:51 +01:00 committed by GitHub
parent c42140a45a
commit ed58c9c107
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 1911 additions and 150 deletions

View file

@ -7,10 +7,28 @@ import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
class v1_21R1_ExternGuiTester: ExternGuiTester {
override val wesjdAnvilGuiName = "Wrapper1_21_R1"
var tested = false;
var possible = false;
override fun getContainerClass(view: InventoryView): Class<Any>? {
// In case we are in a test environment
if(!tested) testClassExist()
if(!possible) return null
if(view !is CraftInventoryView<*, *>) return null
val container = view.handle
return container.javaClass
}
fun testClassExist(){
tested = true;
try {
Class.forName("org.bukkit.craftbukkit.inventory.CraftInventoryView")
possible = true
} catch (e: ClassNotFoundException){
possible = false
}
}
}