Skip to main content

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:
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")
}
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")
        }
    }

}