Compare commits
3 Commits
8ea402e70b
...
d2b861eb7f
Author | SHA1 | Date |
---|---|---|
mrbesen | d2b861eb7f | |
mrbesen | d844699afc | |
mrbesen | 86ec4be6fc |
|
@ -5,7 +5,7 @@
|
|||
|
||||
#define DEBUG 1
|
||||
|
||||
#ifdef DEBUG
|
||||
#if DEBUG == 1
|
||||
#define DEB(A) std::cout << A << std::endl
|
||||
#else
|
||||
#define DEB(A) ;
|
||||
|
|
|
@ -13,15 +13,13 @@ if [ "$?" -ne "0" ]; then
|
|||
echo "Error"
|
||||
exit 1
|
||||
fi
|
||||
sudo make install
|
||||
# sudo make install # or create a link to this lib once with: sudo ln -s $(realpath target/libplugin.so) /usr/lib
|
||||
|
||||
#build and install all testplugins
|
||||
make installplugins
|
||||
|
||||
#prepare server
|
||||
mkdir -p testserver/plugins/CppPlugins
|
||||
cp target/Cppplugin-0.1-SNAPSHOT-final.jar testserver/plugins/
|
||||
cp target/libplugin.so testserver/plugins/CppPlugins
|
||||
|
||||
#start server
|
||||
cd testserver
|
||||
|
|
|
@ -76,7 +76,7 @@ void load(JNIEnv* env, long data) {
|
|||
|
||||
if(((!CPPPLUGINCLASS) + (!EVENTCLASS) + (!MAPCLASS) + (!LISTENERCLASS) //wenn eins == nullptr ist -> wird zu 1 -> endergebniss != 0 -> fehler
|
||||
+ (!EVENTDATAF) + (!EVENTNAMEF) + (!PLUGINIDF)
|
||||
+ (!MAPGET) + (!MAPPUT) + (!MAPCLEAR) + (!LISTENERCONTR) + (!LISTENERSMALLCONTR)) == 0) {
|
||||
+ (!MAPGET) + (!MAPPUT) + (!MAPCLEAR) + (!LISTENERCONTR) + (!LISTENERSMALLCONTR)) != 0) {
|
||||
|
||||
DEB("Error loading a information: ");
|
||||
DEB("find classes: " << (!!CPPPLUGINCLASS) << (!!EVENTCLASS) << (!!MAPCLASS) << (!!LISTENERCLASS));
|
||||
|
|
|
@ -44,7 +44,7 @@ public class CppLoader implements PluginLoader {
|
|||
|
||||
@Override
|
||||
public Plugin loadPlugin(File file) throws InvalidPluginException, UnknownDependencyException {
|
||||
log.info("try to load: " + file.getName());
|
||||
log.info("Loading " + file.getName());
|
||||
return new CppPlugin(file, this);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,12 +54,8 @@ public class CppPlugin implements Plugin {
|
|||
}
|
||||
|
||||
protected boolean init() {
|
||||
File folder = CppPlugins.getInstance().getDataFolder();
|
||||
folder.mkdirs();
|
||||
String path = folder.getAbsolutePath() + "/libplugin.so";
|
||||
getLogger().info("load library from: " + path);
|
||||
try {
|
||||
System.load(path);
|
||||
System.loadLibrary("plugin"); //loads libplugin.so from System.getProperty("java.library.path")
|
||||
return init_();
|
||||
} catch(UnsatisfiedLinkError e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -15,7 +15,7 @@ public:
|
|||
};
|
||||
|
||||
void EventsPlugin::onLoad() {
|
||||
std::cout << "Events::onload();" << std::endl;
|
||||
std::cout << "Events::onLoad();" << std::endl;
|
||||
}
|
||||
|
||||
void EventsPlugin::onEnable() {
|
||||
|
@ -27,7 +27,6 @@ void EventsPlugin::onDisable() {
|
|||
}
|
||||
|
||||
CppPlugin* init() {
|
||||
std::cout << "init im plugin!" << std::endl;
|
||||
return new EventsPlugin();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,19 +15,18 @@ public:
|
|||
};
|
||||
|
||||
void SimplePlugin::onLoad() {
|
||||
std::cout << "onload();" << std::endl;
|
||||
std::cout << "SimplePLugin::onLoad();" << std::endl;
|
||||
}
|
||||
|
||||
void SimplePlugin::onEnable() {
|
||||
std::cout << "onEnable();" << std::endl;
|
||||
std::cout << "SimplePLugin::onEnable();" << std::endl;
|
||||
}
|
||||
|
||||
void SimplePlugin::onDisable() {
|
||||
std::cout << "onDisable();" << std::endl;
|
||||
std::cout << "SimplePLugin::onDisable();" << std::endl;
|
||||
}
|
||||
|
||||
CppPlugin* init() {
|
||||
std::cout << "init im plugin!" << std::endl;
|
||||
return new SimplePlugin();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue