#pragma once #include #include #include #include #include "event.h" //fwd declr class CppPlugin; //function pointer typedef void (*eventfptr)(JNIEnv*, CppPlugin*, Event*); //event typedef CppPlugin* (*initfptr)(); //init // cmdsender cmd label args arglength typedef bool (*cmdfptr)(JNIEnv*, CppPlugin*, jobject, jobject, std::string&, std::vector&); class CppPlugin { public: void* handle; std::string name; int id; virtual void onLoad(JNIEnv*); virtual void onEnable(JNIEnv*); virtual void onDisable(JNIEnv*); virtual std::map getEvents(); virtual ~CppPlugin(); }; bool registerCmd(JNIEnv* env, CppPlugin* plugin, std::string& cname, cmdfptr function); inline bool registerCmd(JNIEnv* env, CppPlugin* plugin, const char* cname, cmdfptr function) { std::string n(cname); return registerCmd( env, plugin, n, function); }