small changes
This commit is contained in:
parent
90e2de5ed9
commit
0fd3466b11
|
@ -23,4 +23,4 @@ cp target/Cppplugin-0.1-SNAPSHOT-final.jar testserver/plugins/
|
||||||
|
|
||||||
#start server
|
#start server
|
||||||
cd testserver
|
cd testserver
|
||||||
java -verbose:jni -jar spigot-1.12.2.jar
|
java -jar spigot-1.12.2.jar
|
||||||
|
|
|
@ -299,7 +299,7 @@ JNIEXPORT jboolean JNICALL Java_de_mrbesen_cppplugins_CppPlugin_onCmd(JNIEnv* en
|
||||||
try {
|
try {
|
||||||
result = cmdf(env, plugin, sender, cmd, clabel, cargs);
|
result = cmdf(env, plugin, sender, cmd, clabel, cargs);
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
std::cout << CRED << "Error while executing Command " << clabel << " in plugin: " << plugin->name << CRESET << std::endl;
|
std::cout << CRED << "Error while executing Command " << clabel << " in plugin: " << plugin->name << CRESET << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@ extern "C" {
|
||||||
|
|
||||||
class SimplePlugin : public CppPlugin {
|
class SimplePlugin : public CppPlugin {
|
||||||
public:
|
public:
|
||||||
virtual void onLoad(JNIEnv*);
|
virtual void onLoad(JNIEnv*);
|
||||||
virtual void onEnable(JNIEnv*);
|
virtual void onEnable(JNIEnv*);
|
||||||
virtual void onDisable(JNIEnv*);
|
virtual void onDisable(JNIEnv*);
|
||||||
//virtual std::map<std::string, eventfptr> getEvents();
|
//virtual std::map<std::string, eventfptr> getEvents();
|
||||||
};
|
};
|
||||||
|
|
||||||
void SimplePlugin::onLoad(JNIEnv*) {
|
void SimplePlugin::onLoad(JNIEnv*) {
|
||||||
|
@ -29,7 +29,7 @@ void SimplePlugin::onDisable(JNIEnv*) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CppPlugin* init() {
|
CppPlugin* init() {
|
||||||
return new SimplePlugin();
|
return new SimplePlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
}//extern "C"
|
}//extern "C"
|
|
@ -10,10 +10,10 @@ extern "C" {
|
||||||
|
|
||||||
class EventsPlugin : public CppPlugin {
|
class EventsPlugin : public CppPlugin {
|
||||||
public:
|
public:
|
||||||
virtual void onLoad(JNIEnv*);
|
virtual void onLoad(JNIEnv*);
|
||||||
virtual void onEnable(JNIEnv*);
|
virtual void onEnable(JNIEnv*);
|
||||||
virtual void onDisable(JNIEnv*);
|
virtual void onDisable(JNIEnv*);
|
||||||
virtual std::map<std::string, eventfptr> getEvents();
|
virtual std::map<std::string, eventfptr> getEvents();
|
||||||
};
|
};
|
||||||
|
|
||||||
void EventsPlugin::onLoad(JNIEnv*) {
|
void EventsPlugin::onLoad(JNIEnv*) {
|
||||||
|
@ -29,14 +29,14 @@ void EventsPlugin::onDisable(JNIEnv*) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CppPlugin* init() {
|
CppPlugin* init() {
|
||||||
return new EventsPlugin();
|
return new EventsPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void eventJoin(JNIEnv* env, CppPlugin* pl, Event* e) {
|
void eventJoin(JNIEnv* env, CppPlugin* pl, Event* e) {
|
||||||
jstring msg = (jstring) e->getData(env, "joinMessage");
|
jstring msg = (jstring) e->getData(env, "joinMessage");
|
||||||
std::string jmsg(env->GetStringUTFChars(msg, 0));
|
std::string jmsg(env->GetStringUTFChars(msg, 0));
|
||||||
pl->log("join " + e->getName() + " old join message: " + jmsg);
|
pl->log("join " + e->getName() + " old join message: " + jmsg);
|
||||||
jstring newmsg = env->NewStringUTF("Ein Spieler ist dem Spiel beigetreten!");
|
jstring newmsg = env->NewStringUTF((std::string("Ein ") + Plugin::DARK_BLUE + "Spieler " + Plugin::DARK_GREEN + "ist dem Spiel beigetreten!").c_str());
|
||||||
e->setData("joinMessage", newmsg);
|
e->setData("joinMessage", newmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,10 @@ bool hicmd(JNIEnv* env, CppPlugin* plugin, jobject sender, jobject cmd, std::str
|
||||||
|
|
||||||
class CmdPlugin : public CppPlugin {
|
class CmdPlugin : public CppPlugin {
|
||||||
public:
|
public:
|
||||||
virtual void onLoad(JNIEnv*);
|
virtual void onLoad(JNIEnv*);
|
||||||
virtual void onEnable(JNIEnv*);
|
virtual void onEnable(JNIEnv*);
|
||||||
virtual void onDisable(JNIEnv*);
|
virtual void onDisable(JNIEnv*);
|
||||||
//virtual std::map<std::string, eventfptr> getEvents();
|
//virtual std::map<std::string, eventfptr> getEvents();
|
||||||
};
|
};
|
||||||
|
|
||||||
void CmdPlugin::onLoad(JNIEnv*) {
|
void CmdPlugin::onLoad(JNIEnv*) {
|
||||||
|
@ -41,7 +41,7 @@ void CmdPlugin::onDisable(JNIEnv*) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CppPlugin* init() {
|
CppPlugin* init() {
|
||||||
return new CmdPlugin();
|
return new CmdPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
}//extern "C"
|
}//extern "C"
|
|
@ -22,10 +22,10 @@ bool throwcmd(JNIEnv* env, CppPlugin* plugin, jobject sender, jobject cmd, std::
|
||||||
|
|
||||||
class CmdPlugin : public CppPlugin {
|
class CmdPlugin : public CppPlugin {
|
||||||
public:
|
public:
|
||||||
//virtual void onLoad(JNIEnv*);
|
//virtual void onLoad(JNIEnv*);
|
||||||
virtual void onEnable(JNIEnv*);
|
virtual void onEnable(JNIEnv*);
|
||||||
//virtual void onDisable(JNIEnv*);
|
//virtual void onDisable(JNIEnv*);
|
||||||
//virtual std::map<std::string, eventfptr> getEvents();
|
//virtual std::map<std::string, eventfptr> getEvents();
|
||||||
};
|
};
|
||||||
|
|
||||||
void CmdPlugin::onEnable(JNIEnv* env) {
|
void CmdPlugin::onEnable(JNIEnv* env) {
|
||||||
|
@ -35,7 +35,7 @@ void CmdPlugin::onEnable(JNIEnv* env) {
|
||||||
|
|
||||||
|
|
||||||
CppPlugin* init() {
|
CppPlugin* init() {
|
||||||
return new CmdPlugin();
|
return new CmdPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
}//extern "C"
|
}//extern "C"
|
||||||
|
|
Loading…
Reference in New Issue