-
-
Notifications
You must be signed in to change notification settings - Fork 4
Developer API
Moros edited this page Oct 28, 2024
·
17 revisions
The API artifact is published to the Maven Central repository:
<repositories>
<repository>
<id>sonatype-oss-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependency>
<groupId>me.moros</groupId>
<artifactId>bending-api</artifactId>
<version>3.10.0</version>
<scope>provided</scope>
</dependency>
repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots/") // For snapshots
}
dependencies {
compileOnly("me.moros:bending-api:3.10.0")
}
The root API interface is Game.
You can obtain it using the Bukkit ServicesManager
RegisteredServiceProvider<Game> provider = Bukkit.getServicesManager().getRegistration(Game.class);
if (provider != null) {
Game game = provider.getProvider();
// Do stuff with it
}
ServiceRegistration<Game> provider = Sponge.game().serviceProvider().registration(Game.class).orElse(null);
if (provider != null) {
Game game = provider.service();
// Do stuff with it
}
An instance of Game can also be obtained from the GameProvider class.
Game game = GameProvider.get(); // Throws IllegalStateException if Game isn't loaded
You can also check the addon system.