SpongeAPI

Adventure provides a platform for SpongeAPI 7 for Minecraft: Java Edition 1.12.

Warning

For SpongeAPI 8 and up (targeting Minecraft: Java Edition 1.16.4), Adventure is the native text library, so no platform adapter is needed. Sponge’s API interfaces directly extend Adventure’s rather than needing a SpongeAudiences adapter.

Declaring the dependency:

 <dependency>
    <groupId>net.kyori</groupId>
    <artifactId>adventure-platform-spongeapi</artifactId>
    <version>4.3.2</version>
 </dependency>
 repositories {
    mavenCentral()
 }

 dependencies {
    implementation "net.kyori:adventure-platform-spongeapi:4.3.2"
 }
 repositories {
    mavenCentral()
 }

 dependencies {
    implementation("net.kyori:adventure-platform-spongeapi:4.3.2")
 }

Need development/snapshot builds? Using Snapshot Builds

Usage

The SpongeAPI platform can either be created through Guice dependency injection, or created directly. We recommend using injection, since less boilerplate is required.

An example plugin is fairly straightforward:

@Plugin(/* [...] */)
public class MyPlugin {
  private final SpongeAudiences adventure;

  @Inject
  MyPlugin(final SpongeAudiences adventure) {
    this.adventure = adventure;
  }

  public @NonNull SpongeAudiences adventure() {
    return this.adventure;
  }
}

This sets up a SpongeAudiences instance that can provide audiences for players, or any MessageReceiver.