42 lines
808 B
C++
42 lines
808 B
C++
|
#include "plugin.h"
|
||
|
|
||
|
#include <iostream>
|
||
|
#include <string>
|
||
|
#include <map>
|
||
|
#include <vector>
|
||
|
|
||
|
using namespace Plugin;
|
||
|
|
||
|
extern "C" {
|
||
|
|
||
|
void sub(CppPlugin* plugin) {
|
||
|
plugin->printStacktrace();
|
||
|
plugin->log("asdf");
|
||
|
throw std::string("Nope");
|
||
|
}
|
||
|
|
||
|
bool throwcmd(JNIEnv* env, CppPlugin* plugin, jobject sender, jobject cmd, std::string& label, std::vector<std::string>& args) {
|
||
|
sub(plugin);
|
||
|
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::onEnable(JNIEnv* env) {
|
||
|
log("CmdPlugin::onEnable();");
|
||
|
registerCmd(env, this, "throw", throwcmd);
|
||
|
}
|
||
|
|
||
|
|
||
|
CppPlugin* init() {
|
||
|
return new CmdPlugin();
|
||
|
}
|
||
|
|
||
|
}//extern "C"
|