πŸ“¦ API

1. Getting the API instance

// Inside *your* plugin or addon
ClothesPlus clothes = (ClothesPlus) Bukkit.getPluginManager().getPlugin("ClothesPlus");
OverlayAPI overlay = clothes.getOverlayAPI();

OverlayAPI is singleton-style – grab it once and reuse it.


2. Basic concepts

Term

Description

overlay id

Path relative to plugins/ClothesPlus/overlays/, e.g. hairs/bob, jackets/leather.

folder prefix

Everything before the first β€œ/”. Two overlays in the same folder are exclusive (only one).

duration (ticks)

20 ticks = 1 second. Pass null to make the overlay permanent until removed.

permission

wardrobeclothes.overlay.<overlay id with / replaced by .>
wardrobeclothes.overlay.*

return type

Every mutating call returns CompletableFuture<Boolean> (async).


3. Wear overlays

// 3.1 Simple wear – stays until you unwear or replace the same folder
overlay.wear(player, List.of("hairs/bob", "eyes/green"));
// 3.2 Temporary wear – auto-remove after 60 s (20 * 60 ticks)
overlay.wear(player, List.of("jackets/leather"), 20 * 60)
.thenAccept(ok -> {
if (!ok) player.sendMessage("Sorry, could not add that jacket.");
});

Rules applied automatically


4. Un-wear overlays

// 4.1 Strip everything
overlay.unwear(player);
// 4.2 Remove specific items only
overlay.unwear(player, List.of("hairs/bob", "eyes/green"));

unwear also returns a CompletableFuture<Boolean> so you can .thenAccept(...) if needed.


5. Read-only helpers

// 5.1 Full immutable list
List<String> worn = overlay.getWornOverlays(player);
// 5.2 Quick check (exact match or folder prefix)
if (overlay.isWearing(player, "hats/")) {
player.sendMessage("You already have a hat on!");
}

6. Typical integration patterns


7. Error handling

All mutating methods resolve to false when

Always attach a thenAccept(Boolean ok) (or similar) if you need to guarantee success.


8. Threading notes

All wear / unwear calls run the heavy lifting asynchronously.
You may call them from the main thread without blocking TPS.

Published with Nuclino