small changes

This commit is contained in:
mrbesen 2020-11-12 14:21:19 +01:00
parent 90e2de5ed9
commit 0fd3466b11
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
6 changed files with 23 additions and 23 deletions

View File

@ -23,4 +23,4 @@ cp target/Cppplugin-0.1-SNAPSHOT-final.jar testserver/plugins/
#start server
cd testserver
java -verbose:jni -jar spigot-1.12.2.jar
java -jar spigot-1.12.2.jar

View File

@ -299,7 +299,7 @@ JNIEXPORT jboolean JNICALL Java_de_mrbesen_cppplugins_CppPlugin_onCmd(JNIEnv* en
try {
result = cmdf(env, plugin, sender, cmd, clabel, cargs);
} 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;
}

View File

@ -10,10 +10,10 @@ extern "C" {
class SimplePlugin : public CppPlugin {
public:
virtual void onLoad(JNIEnv*);
virtual void onEnable(JNIEnv*);
virtual void onDisable(JNIEnv*);
//virtual std::map<std::string, eventfptr> getEvents();
virtual void onLoad(JNIEnv*);
virtual void onEnable(JNIEnv*);
virtual void onDisable(JNIEnv*);
//virtual std::map<std::string, eventfptr> getEvents();
};
void SimplePlugin::onLoad(JNIEnv*) {
@ -29,7 +29,7 @@ void SimplePlugin::onDisable(JNIEnv*) {
}
CppPlugin* init() {
return new SimplePlugin();
return new SimplePlugin();
}
}//extern "C"

View File

@ -10,10 +10,10 @@ extern "C" {
class EventsPlugin : public CppPlugin {
public:
virtual void onLoad(JNIEnv*);
virtual void onEnable(JNIEnv*);
virtual void onDisable(JNIEnv*);
virtual std::map<std::string, eventfptr> getEvents();
virtual void onLoad(JNIEnv*);
virtual void onEnable(JNIEnv*);
virtual void onDisable(JNIEnv*);
virtual std::map<std::string, eventfptr> getEvents();
};
void EventsPlugin::onLoad(JNIEnv*) {
@ -29,14 +29,14 @@ void EventsPlugin::onDisable(JNIEnv*) {
}
CppPlugin* init() {
return new EventsPlugin();
return new EventsPlugin();
}
void eventJoin(JNIEnv* env, CppPlugin* pl, Event* e) {
jstring msg = (jstring) e->getData(env, "joinMessage");
std::string jmsg(env->GetStringUTFChars(msg, 0));
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);
}

View File

@ -21,10 +21,10 @@ bool hicmd(JNIEnv* env, CppPlugin* plugin, jobject sender, jobject cmd, std::str
class CmdPlugin : public CppPlugin {
public:
virtual void onLoad(JNIEnv*);
virtual void onEnable(JNIEnv*);
virtual void onDisable(JNIEnv*);
//virtual std::map<std::string, eventfptr> getEvents();
virtual void onLoad(JNIEnv*);
virtual void onEnable(JNIEnv*);
virtual void onDisable(JNIEnv*);
//virtual std::map<std::string, eventfptr> getEvents();
};
void CmdPlugin::onLoad(JNIEnv*) {
@ -41,7 +41,7 @@ void CmdPlugin::onDisable(JNIEnv*) {
}
CppPlugin* init() {
return new CmdPlugin();
return new CmdPlugin();
}
}//extern "C"

View File

@ -22,10 +22,10 @@ bool throwcmd(JNIEnv* env, CppPlugin* plugin, jobject sender, jobject cmd, std::
class CmdPlugin : public CppPlugin {
public:
//virtual void onLoad(JNIEnv*);
virtual void onEnable(JNIEnv*);
//virtual void onDisable(JNIEnv*);
//virtual std::map<std::string, eventfptr> getEvents();
//virtual void onLoad(JNIEnv*);
virtual void onEnable(JNIEnv*);
//virtual void onDisable(JNIEnv*);
//virtual std::map<std::string, eventfptr> getEvents();
};
void CmdPlugin::onEnable(JNIEnv* env) {
@ -35,7 +35,7 @@ void CmdPlugin::onEnable(JNIEnv* env) {
CppPlugin* init() {
return new CmdPlugin();
return new CmdPlugin();
}
}//extern "C"