Add Dependencies
Add the Cloud API to your build configuration. The version is fetched automatically from our Maven repository.Plugin Setup
Add the SimpleCloud API plugin as a dependency in your plugin descriptor:- Paper/Spigot (plugin.yml)
- Velocity (velocity-plugin.json)
- BungeeCord (bungee.yml)
Initialize the API
Default Configuration
When running inside a SimpleCloud server, the API auto-configures from environment variables:- Java
- Kotlin
Custom Configuration
For standalone applications or custom setups, provide configuration options:- Java
- Kotlin
Environment Variables
The API reads these environment variables by default:| Variable | Default | Description |
|---|---|---|
SIMPLECLOUD_NETWORK_ID | "default" | Your network identifier |
SIMPLECLOUD_NETWORK_SECRET | "" | Authentication secret |
SIMPLECLOUD_CONTROLLER_URL | "https://controller.platform.simplecloud.app" | Controller API endpoint |
SIMPLECLOUD_NATS_URL | "nats://platform.simplecloud.app:4222" | NATS server for events |
Inside SimpleCloud servers, these variables are set automatically. You only need to configure them for standalone applications or external services.
Best Practices
Use a single API instance
Use a single API instance
Create one
CloudApi instance and reuse it. Use dependency injection if your framework supports it.Handle async operations properly
Handle async operations properly
All API methods return
CompletableFuture. Don’t block on the main thread.Clean up event subscriptions
Clean up event subscriptions
Subscriptions implement
AutoCloseable. Close them when done.Troubleshooting
Dependency not found
Dependency not found
Symptom: Gradle/Maven can’t resolve
app.simplecloud.api:api.Solution:- Add both repositories:
https://repo.simplecloud.app/snapshotshttps://buf.build/gen/maven
- Refresh:
gradle --refresh-dependenciesormvn -U clean install - Check network access to repository URLs
NoClassDefFoundError at runtime
NoClassDefFoundError at runtime
Symptom: Plugin fails with
ClassNotFoundException for SimpleCloud classes.Cause: API shaded into JAR or plugin load order wrong.Solution:- Don’t shade the API - use
compileOnlyscope - Add
simplecloud-apito plugin descriptor dependencies - Verify SimpleCloud API plugin loads before yours
API initialization fails
API initialization fails
Symptom:
CloudApi.create() throws exception.If connection refused:- Verify server runs inside SimpleCloud
- Check environment variables are set
- For standalone apps, verify controller/NATS URLs
- Check
SIMPLECLOUD_NETWORK_IDis correct - Check
SIMPLECLOUD_NETWORK_SECRETmatches
Version conflicts
Version conflicts
Symptom: Errors about incompatible API versions.Solution:
- Use
compileOnlyscope (notimplementation) - Check other plugins for bundled API versions
- Match API version to your SimpleCloud installation