Getting Started
The following guide will show you how to implement our API in your BungeeCord plugin.
Our API includes the ControllerApi and the PlayerApi class. The ControllerApi is used to interact with SimpleCloud’s groups, servers, and more, while the PlayerApi is used to interact with players.
Dependencies
First, we need to add the dependencies to your build.gradle or pom.xml:
Gradle (Kotlin)
Gradle (Groovy)
Maven
repositories {
maven("https://repo.simplecloud.app/snapshots")
maven("https://buf.build/gen/maven")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
}
dependencies {
compileOnly("app.simplecloud.api.platform:bungeecord:LATEST")
compileOnly("net.md-5:bungeecord-api:1.20-R0.1-SNAPSHOT")
}
repositories {
maven { url 'https://repo.simplecloud.app/snapshots' }
maven { url 'https://buf.build/gen/maven' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
compileOnly 'app.simplecloud.api.platform:bungeecord:LATEST'
compileOnly 'net.md-5:bungeecord-api:1.20-R0.1-SNAPSHOT'
}
<repositories>
<repository>
<id>simplecloud-snapshots</id>
<url>https://repo.simplecloud.app/snapshots</url>
</repository>
<repository>
<id>buf-maven</id>
<url>https://buf.build/gen/maven</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>app.simplecloud.api.platform</groupId>
<artifactId>bungeecord</artifactId>
<version>LATEST</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.20-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Please don’t compile our API into your plugin, just follow the next step, and
depend on the API.
Depend on the API
BungeeCord plugins can inherit from the SimpleCloud Cloud API plugin. This is useful if you want to use the SimpleCloud API in your plugin.
For this, you need to add a depend configuration to your plugin.yml file. Here is an example:
name: simplecloud-example-bungeecord
version: 1.0.0
main: app.simplecloud.examples.plugin.bungeecord.BungeeCordExamplePlugin
depend: [simplecloud-api]
After that, you can use the SimpleCloud API in your plugin:
import app.simplecloud.controller.api.ControllerApi
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import net.md_5.bungee.api.plugin.Plugin
class BungeeCordExamplePlugin : Plugin() {
private val controllerApi = ControllerApi.createCoroutineApi()
override fun onEnable() {
logger.info("Hello from BungeeCord!")
CoroutineScope(Dispatchers.IO).launch {
val groups = controllerApi.getGroups().getAllGroups()
logger.info("Groups: $groups")
}
}
}
import app.simplecloud.controller.api.ControllerApi;
import net.md_5.bungee.api.plugin.Plugin;
public class BungeeCordExamplePlugin extends Plugin {
private final ControllerApi.Future controllerApi = ControllerApi.createFutureApi();
@Override
public void onEnable() {
getLogger().info("Hello from BungeeCord!");
controllerApi.getGroups().getAllGroups().thenAccept(groups -> {
getLogger().info("Groups: " + groups);
});
}
}