From a3f97937109834ed97f89a18550d3ba464fda986 Mon Sep 17 00:00:00 2001 From: ME1312 Date: Wed, 19 Feb 2020 19:33:42 -0500 Subject: [PATCH] Updated SubAPI (markdown) --- SubAPI.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SubAPI.md b/SubAPI.md index e01883b..31175df 100644 --- a/SubAPI.md +++ b/SubAPI.md @@ -2,7 +2,7 @@ SubAPI is the way to access the server manager through custom plugins. This page ### SubAPI via Maven You may want to use Maven to handle the SubAPI dependency for you. If so, here's the code you need to make it happen. -``` +```xml ME1312.net @@ -26,7 +26,7 @@ You may want to use Maven to handle the SubAPI dependency for you. If so, here's A "Soft Dependancy" is where your plugin will use SubServers, but it is not required for your plugin to function properly. First, Make a method to see if SubServers v2.11.2a+ is available using reflection: -``` +```java public boolean isSubServers2() { try { net.ME1312.SubServers.Bungee.SubAPI api = net.ME1312.SubServers.Bungee.SubAPI.class.cast(net.ME1312.SubServers.Bungee.SubAPI.class.getMethod("getInstance").invoke(null)); @@ -58,7 +58,7 @@ Most of SubAPI can be accessed using this simple method `SubAPI.getInstance()`, __SubAPI Status Listener:__
If you need to listen to the status of SubAPI, you can do so like this: -``` +```java @Override public void onEnable() { SubAPI.getInstance().addListener(this::subEnable, this::subDisable); @@ -73,7 +73,7 @@ public void subDisable() { __Bungee ServerInfo:__
Just about any time you get a ServerInfo variable you can parse it to the SubServers equivalent if it exists. -``` +```java Server server = (serverinfo instanceof Server)?(Server)serverinfo:null; // This will get you the SubServers wrapped version of a server if that server has been registered within SubServers @@ -105,7 +105,7 @@ So, you're going to have to import GalaxiAPI to have SubServers.Host load your p ### Creating your plugin Plugin structure is pretty simple, all you need is a main class annotated with `@Plugin`: -``` +```java import net.ME1312.Galaxi.Event.GalaxiStartEvent; import net.ME1312.Galaxi.Event.GalaxiStopEvent; import net.ME1312.Galaxi.Plugin.Plugin;