Persistent and temporary skin changes
Choose whether a change survives reconnects before calling the applier.
SkinsRestorer 15.12.6Java plugins using API 15.12.6Reviewed
Player storage saves an identifier. Skin storage resolves that identifier to a signed property. The skin applier changes a live profile.
Persistent change
The complete plugin example performs these operations:
- Resolve input with
SkinStorage.findOrCreateSkinData(input). - Handle an empty result.
- Save
result.getIdentifier()withPlayerStorage.setSkinIdOfPlayer(uuid, identifier). - Apply
result.getProperty()to the live player with the platform's skin applier.
The saved identifier controls future resolution. Applying the already-resolved property avoids another lookup during the immediate refresh.
A storage write and a visual refresh are not one transaction. A player can disconnect after the selection saves. Keep that distinction in error messages.
Temporary change
applySkin(player, property) changes the live appearance without writing the selected identifier. The same is true of the identifier overload alone.
Use this for previews or temporary effects. On reconnect, normal saved selection and default rules apply again.
Apply the saved selection
applySkin(player) resolves the skin that would apply on join. It can throw DataRequestException because resolution can request account data.
Do not assume that every overload performs the same storage work or throws the same checked exceptions.
Generate a URL property
MineSkinAPI.genSkin(url, SkinVariant.CLASSIC) returns a generated property. It can throw DataRequestException and MineSkinException.
Applying that property directly is temporary. For a persistent URL selection, use the skin storage resolution path and save its identifier, as the tutorial does.
File and image generation overloads can also throw IOException. Inspect the release API signatures for the overload you use.
Read or create data
PlayerStorage.getSkinForPlayer(uuid, name) resolves a saved or fallback property and can throw DataRequestException.
SkinStorage.setCustomSkinData(name, property) stores a named custom entry. Preserve the signed value and signature together.
PropertyUtils.getSkinTextureUrl(property) extracts the skin URL. A texture URL alone is not a complete signed property.
Failure policy
Keep separate outcomes for missing input, service errors, storage errors, and disconnected players. Do not retry generation in a tight loop.
The API does not automatically apply the command layer's cooldowns, per-skin permissions, or URL restrictions. Your integration must enforce its intended policy.
For a proxy backend, configure shared API storage first.
Did this page help?
Last updated on