com.skillw.pouvoir.internal.feature.handler.Native.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Pouvoir Show documentation
Show all versions of Pouvoir Show documentation
Bukkit Script Engine Plugin.
package com.skillw.pouvoir.internal.feature.handler
import com.skillw.asahi.api.script.linking.Invoker
import com.skillw.asahi.api.script.linking.NativeFunction
import com.skillw.pouvoir.internal.core.asahi.linking.js.NativeJSFunction
/**
* @className Native
*
* @author Glom
* @date 2023/1/22 22:00 Copyright 2024 Glom.
*/
fun Any.toInvoker(key: String, namespaces: Collection): Invoker? {
return when (this) {
is Map<*, *> -> {
val func = this as Map
when (func["type"].toString()) {
"js" -> NativeJSFunction.deserialize(key, func)
else -> NativeFunction.deserialize(key, func, *namespaces.toTypedArray())
}
}
is String -> {
NativeFunction.deserialize(key, this, *namespaces.toTypedArray())
}
else -> null
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy