Skip to main content

âŒ¨ī¸ Developer API

MMOitemsUpgrade provides a stable API for developers to integrate upgrade logic into other plugins or read data.

đŸ› ī¸ Core API Methods​

1. Get Upgrade Level​

Read the current level of an item.

// Returns Int?, null if not an upgrade item
val level = UpgradeAPI.getUpgradeLevel(itemStack)

2. Restore Upgrade Stats​

If other plugins reset item attributes (e.g., by modifying NBT), call this to force-read the level and re-apply stats, effects, and abilities.

// Returns ItemStack with reconstructed bonuses
val newItem = UpgradeAPI.restoreUpgradeStats(itemStack)

3. Set Item Level​

Manual modification (no costs incurred).

UpgradeAPI.setUpgradeLevel(itemStack, 10)

🔑 Core UUID Constants​

Uses predefined UUIDs for StatModifiers to prevent conflicts:

  • NAME_SUFFIX_UUID: For name suffix ([+10]).
  • PERM_EFFECTS_UUID: For potion effects.
  • ABILITIES_UUID: For dynamic abilities.