You can find the Javadocs for the API here. If you know what you are doing, the Javadocs should be all you need to help you program.
In your plugin.yml you will need to add ServerAssistant as a dependency. After, your plugin.yml should look something like this:
name: <Plugin Name> author: '<Your Name>' main: <PluginMainClass> version: <Version> depend: [ServerAssistant]
This now means that your plugin will load after Server Assistant.
You will next need to add the 'ServerAssistant.jar' as a compile time dependency in your IDE/Dependency Management system.
Since Server Assistant isn't in a maven repository, you'll need to tell gradle to look for dependencies in the filesystem. Add the following to your gradle script:
repositories { flatDir { dirs 'C:/ServerAssistant/' } }
Make sure that the directory you specify (Eg. C:/ServerAssistant/) isn't part of the your code repository. You may not include ServerAssistant in any public code or maven repository.
Next, place your downloaded ServerAssistant JAR into the directory you specified in the script. The jar should be named something like 'ServerAssistant-1.0.jar'.
Finally, you will need to add the following to your gradle script
dependencies { compile name: 'ServerAssistant-1.0' }
Make sure that the name specified matches the name of your ServerAssistant JAR
ServerMonitorAPI api = ServerMonitorAPIProvider.getAPI();
Once you have an instance of the API, you can use the javadocs to find out what you are able to do.
For example, if you want to broadcast a message to the server when it is lagging:
api.getResponseManager().addResponder(new LagBroadcastResponder());LagBroadcastResponder class:
public class LagBroadcastResponder implements Responder { @Override public ServerEventType[] getListenedEvents() { return new ServerEventType[]{ServerEventType.LAG}; } @Override public void respond(ServerEvent event) { LagReport report = (LagReport) event.getReport(); Bukkit.broadcastMessage("The server is lagging! TPS is "+report.getTps()); } }