Repository navigation
Developer API
Add XPrisonArmors-2.1.0.jar to your compile classpath (provided scope) and XPrisonArmors to your depend / softdepend. Everything public lives under dev.drawethree.xprisonarmors.api and dev.drawethree.xprisonarmors.model.
import dev.drawethree.xprisonarmors.api.XPrisonArmorsAPI;
XPrisonArmorsAPI api = XPrisonArmorsAPI.get(); // IllegalStateException if the plugin is not enabled| Method | Returns |
|---|---|
Optional<ArmorSetState> getSetState(Player) |
The worn set's setId, tierId, level, xp and skinId — including XP earned but not yet written to the items. Empty when the player wears no set or a mixed set. |
WornSet getWornSet(Player) |
The worn pieces: isComplete(), isMixed(), wornCount(), piece(PieceSlot), state()
|
SetBoosts getBoosts(Player) |
What the worn set grants right now, in percent: currency(String id), pickaxeXp(), enchantProc(); SetBoosts.multiplier(percent) turns a percent into a factor |
ArmorLadder getLadder() |
The configured tiers in order: tiers(), byId(String), next(ArmorTier), isMaxed(ArmorSetState)
|
List<ArmorSkin> getSkins() |
Every skin, highest priority first |
All methods are main-thread only; getSetState and getBoosts read a cached snapshot and are cheap.
ArmorSetState state = api.getSetState(player).orElse(null);
if (state != null) {
ArmorTier tier = api.getLadder().byId(state.tierId());
double tokens = api.getBoosts(player).currency("tokens"); // e.g. 12.5
}| Event | Cancellable | Fired |
|---|---|---|
ArmorLevelUpEvent |
No | After a gain levelled the set. getPlayer(), getGain() (XpGain: from(), to(), levelsGained(), tiersReached(), reachedMax()) |
ArmorTierUpEvent |
No | After the set moved to a higher tier — once per tier crossed. getPreviousTier(), getNewTier(), getState()
|
ArmorSkinApplyEvent |
Yes | Before a skin is applied or removed. getSkin() is null when the default look is restored; cancel to keep the current look |
Package dev.drawethree.xprisonarmors.api.events.
With X-Prison installed, every XP gain fires the core's dev.drawethree.xprison.api.shared.events.PlayerProgressionXpGainEvent (X-PrisonAPI 1.10, core 2026.3.8.7+) with the progression key xprisonarmors:armor. Standalone (no X-Prison, since 2.1.0) the event does not exist, so nothing fires. Listen to it to scale or cancel armor XP without depending on XPrisonArmors at all — this is how the Events addon's Armor Training works.
@EventHandler
public void onArmorXp(PlayerProgressionXpGainEvent event) {
if (!event.getProgression().equalsIgnoreCase("xprisonarmors:armor")) {
return;
}
event.setAmount(event.getAmount() * 2); // <= 0 suppresses the gain; setCancelled(true) too
}The amount is already multiplied by the worn skin's xp-multiplier.
| Class | Notes |
|---|---|
ArmorSetState |
Record (UUID setId, String tierId, int level, long xp, String skinId); withProgress(...), withSkin(...), sameSet(other)
|
ArmorTier |
id(), displayName(), color(), levels(), xpCurve() (costOf(level), total()), boosts() (BoostTable), appearance()
|
BoostTable |
currencyPercent(id, level, maxLevel), pickaxeXpPercent(...), enchantProcPercent(...); Range(from, to)
|
ArmorSkin |
id(), displayName(), permission(), priority(), xpMultiplier(), currencyBoosts(), pickaxeXpBoost(), enchantProcBoost(), description(), color()
|
PieceSlot |
HELMET, CHESTPLATE, LEGGINGS, BOOTS — inventorySlot(), equipmentSlot()
|
ProgressionMath |
apply(ladder, state, amount) → XpGain; xpRequired(...), progress(...) — pure, no Bukkit |
Pieces carry persistent data under the xprisonarmors namespace: set_id, piece, tier, level, xp, skin, version. Prefer the API over reading them directly — the plugin keeps banked XP in memory between flushes, so the item can lag a few seconds behind getSetState.