mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
start of nms generalization
This commit is contained in:
parent
c94c85a3cf
commit
c166d2a78a
19 changed files with 63 additions and 421 deletions
|
|
@ -1,34 +0,0 @@
|
|||
package xyz.alexcrea.cuanvil.dependency.gui.version
|
||||
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView
|
||||
import org.bukkit.inventory.InventoryView
|
||||
import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
|
||||
|
||||
class v1_21R6_ExternGuiTester: ExternGuiTester {
|
||||
override val wesjdAnvilGuiName = "Wrapper1_21_R6"
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue