forked from OnfireNetwork/OnsetJavaPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaEnv.hpp
More file actions
32 lines (29 loc) · 730 Bytes
/
JavaEnv.hpp
File metadata and controls
32 lines (29 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
#include <cstring>
#include <jni.h>
#include <map>
#include <PluginSDK.h>
class JavaEnv
{
private:
JavaVM* vm;
JNIEnv* env;
std::map<int, Lua::LuaValue> luaFunctions;
jclass luaFunctionClass;
public:
JavaEnv(std::string classPath);
void Destroy() {
this->vm->DestroyJavaVM();
}
JavaVM* GetVM() {
return this->vm;
}
JNIEnv* GetEnv() {
return this->env;
}
Lua::LuaValue ToLuaValue(jobject object);
jobject ToJavaObject(lua_State* L, Lua::LuaValue value);
jobjectArray LuaFunctionCall(jobject instance, jobjectArray args);
void LuaFunctionClose(jobject instance);
jobject CallStatic(std::string className, std::string methodName, std::string signature, jobject* params, size_t paramsLength);
};