45 lines
997 B
C++
45 lines
997 B
C++
#include "plugin.h"
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
extern "C" {
|
|
|
|
|
|
bool hicmd(JNIEnv* env, CppPlugin* plugin, jobject sender, jobject cmd, std::string& label, std::vector<std::string>& args) {
|
|
std::cout << "HICMD::hi " << label << " argsize: " << args.size() << std::endl;
|
|
for(std::string& arg : args) {
|
|
std::cout << arg << std::endl;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
|
|
class CmdPlugin : public CppPlugin {
|
|
public:
|
|
virtual void onLoad(JNIEnv*);
|
|
virtual void onEnable(JNIEnv*);
|
|
virtual void onDisable(JNIEnv*);
|
|
//virtual std::map<std::string, eventfptr> getEvents();
|
|
};
|
|
|
|
void CmdPlugin::onLoad(JNIEnv*) {
|
|
std::cout << "CmdPlugin::onLoad();" << std::endl;
|
|
}
|
|
|
|
void CmdPlugin::onEnable(JNIEnv* env) {
|
|
std::cout << "CmdPlugin::onEnable();" << std::endl;
|
|
registerCmd(env, this, "hi", hicmd);
|
|
}
|
|
|
|
void CmdPlugin::onDisable(JNIEnv*) {
|
|
std::cout << "CmdPlugin::onDisable();" << std::endl;
|
|
}
|
|
|
|
CppPlugin* init() {
|
|
return new CmdPlugin();
|
|
}
|
|
|
|
}//extern "C"
|