-
Notifications
You must be signed in to change notification settings - Fork 99
Plugin API
mat8913 edited this page Apr 18, 2012
·
2 revisions
This page is an unfinished migration from: http://www.mineserver.be/wiki/Plugin_API I'll finish it later, I have a life too you know.
Mineserver uses a C-plugin API which is described in this page.
You will need to include plugin_api.h to your project.
...write some more stuff here...
Example plugin structure:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <cstdlib>
#include <iostream>
#define MINESERVER_C_API
#include "../src/plugin_api.h"
#include "../src/logtype.h"
#define PLUGIN_VERSION 1.0
double pluginVersion = PLUGIN_VERSION;
#define PLUGIN_NAME "pressurplate"
const char* pluginName = PLUGIN_NAME;
const char* logSource = "plugin.screen";
mineserver_pointer_struct* mineserver;
PLUGIN_API_EXPORT void CALLCONVERSION pressurplate_init(mineserver_pointer_struct* mineserver_temp)
{
mineserver = mineserver_temp;
if (mineserver->plugin.getPluginVersion(pluginName) > 0)
{
mineserver->logger.log(LogType::LOG_INFO, logSource, "The " PLUGIN_NAME " plugin is already loaded");
return;
}
mineserver->logger.log(LogType::LOG_INFO, logSource, "Loaded " PLUGIN_NAME);
mineserver->plugin.setPluginVersion(pluginName, pluginVersion);
}
PLUGIN_API_EXPORT void CALLCONVERSION pressurplate_shutdown(void)
{
if (mineserver->plugin.getPluginVersion(pluginName) <= 0)
{
mineserver->logger.log(LogType::LOG_INFO, logSource, PLUGIN_NAME " is not loaded!");
return;
}
mineserver->logger.log(LogType::LOG_INFO, logSource, PLUGIN_NAME " has been unloaded!");
}
Function | Parameter name | Parameter type | Parameter info |
---|---|---|---|
sendmsgTo | user | const char* | Username in null Terminated char array |
msg | const char* | Message in null terminated char array | |
Return value | bool, telling it the user was found | ||
Sends a message to specified user |
Function | Parameter name | Parameter type | Parameter info |
---|---|---|---|
sendmsg | msg | const char* | Message in null terminated char array |
Return value | bool, telling it the user was found | ||
Sends a message to all players, except they are in DND mode |
Function | Parameter name | Parameter type | Parameter info |
---|---|---|---|
sendUserList | user | const char* | User in null terminated char array |
Return value | bool, telling it the user was found | ||
Sends the playerlist to user |