Dependencies and API lifecycle
Add the public API without bundling it and initialize after SkinsRestorer.
SkinsRestorer 15.12.6Java plugins using API 15.12.6Reviewed
Use net.skinsrestorer:skinsrestorer-api:15.12.6 as a compile-time dependency. The installed SkinsRestorer plugin supplies it at runtime.
Add to your build file
The first plugin tutorial contains a complete Maven project. For Gradle, use:
repositories {
maven("https://repo.codemc.org/repository/maven-public/")
}
dependencies {
compileOnly("net.skinsrestorer:skinsrestorer-api:15.12.6")
}Do not shade or relocate the API. Do not import net.skinsrestorer.shared or platform implementation classes.
Add SkinsRestorer as a dependency
For a Bukkit plugin that requires SkinsRestorer:
depend: [SkinsRestorer]For an optional Bukkit integration, use softdepend: [SkinsRestorer]. Check that SkinsRestorer is enabled before loading API-dependent integration classes.
BungeeCord uses depends or softDepends in bungee.yml. Velocity declares dependencies with @Dependency(id = "skinsrestorer", optional = true) inside the plugin annotation. Remove optional = true for a required dependency.
Getting the API instance
Call SkinsRestorerProvider.get() after SkinsRestorer initializes, usually in your enable callback. Do not call it from a static initializer or plugin constructor.
An installed JAR does not prove that the API initialized. The provider throws IllegalStateException when unavailable. Backend proxy API mode can require shared SQL storage.
Checking API version compatibility
VersionProvider.isCompatibleWith("15") checks major-version compatibility. It is not a test for “version 15 or newer.”
Pin the dependency version used by your build. Test your integration against the installed release before you change its dependency.
Error handling
Skin lookup and generation can perform blocking requests. Storage can also perform database I/O. Keep this work outside the platform's main or entity thread.
Schedule your own player operations with the platform's supported scheduler. The complete Bukkit example shows that boundary. A Bukkit scheduler example does not automatically work on Folia, Velocity, or BungeeCord.
Read storage operations before choosing an apply method.
Code examples
Start with the complete plugin tutorial. Then choose persistent or temporary changes for your integration.
Use the API on a proxy network
Follow proxy API setup before requesting the provider on a backend.
Did this page help?
Last updated on