mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 10:15:52 +01:00
Updated SubAPI (markdown)
parent
e4926c35aa
commit
d9b23bbf11
18
SubAPI.md
18
SubAPI.md
@ -20,6 +20,7 @@ You may want to use Maven to handle the SubAPI dependency for you. If so, here's
|
||||
<groupId>net.ME1312.SubServers</groupId>
|
||||
<artifactId>SubServers.Bungee</artifactId>
|
||||
<version>00w00a</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
@ -62,22 +63,6 @@ This will show how to use SubAPI for SubServers.Bungee. For more detailed inform
|
||||
### Using SubAPI for Bungee
|
||||
Most of SubAPI can be accessed using this simple method `SubAPI.getInstance()`, however there's a bit more to it than just that. SubServers.Bungee works by extending BungeeCord classes to add more functionality, and overriding the methods to serve the extended classes. Knowing this, you can use it to your advantage.<br><br>
|
||||
|
||||
__SubAPI Status Listener:__<br>
|
||||
SubAPI isn't exactly ready for most calls when typical BungeeCord plugins are enabled. This is because SubServers allows you to add things like drivers before it finishes loading. So, if you need to start using SubAPI as soon as possible, then you should add a SubAPI listener:
|
||||
```java
|
||||
@Override
|
||||
public void onEnable() {
|
||||
SubAPI.getInstance().addListener(this::subEnable, this::subDisable);
|
||||
}
|
||||
public void subEnable() {
|
||||
// SubAPI has now ready to be called
|
||||
}
|
||||
public void subDisable() {
|
||||
// SubAPI is about to be disabled
|
||||
}
|
||||
```
|
||||
<br>
|
||||
|
||||
__Bungee ServerInfo:__<br>
|
||||
Just about any time you get a ServerInfo variable you can parse it to it's SubServers equivalent:
|
||||
```java
|
||||
@ -111,7 +96,6 @@ This will show how to use SubAPI for SubServers.Host. For more detailed informat
|
||||
* A Plugin Manager
|
||||
* An Event API
|
||||
* Configuration APIs
|
||||
* A Task Scheduler API
|
||||
|
||||
### Creating your plugin
|
||||
Plugin structure is pretty simple, all you need is a main class annotated with `@Plugin`:
|
||||
|
Loading…
Reference in New Issue
Block a user