Upgrade Flow
When a player runs /itemupgrader, the plugin evaluates the held item before any inventory menu opens.
- Wait for configured addon items to finish loading.
- Check the optional menu permission and allowed-world list.
- Reject an empty hand or a material missing from
upgradable-items. - Match the held material and display name to a recipe’s
fromitem. - Reject source items containing a configured disallowed enchantment.
- Check required ingredients and the source stack amount.
- Remove the recipe’s source amount from the main hand while the protected preview menu is open.
- Check the player’s Vault balance when the result is clicked.
- Open the confirmation menu when enabled.
- Recheck ingredients and the Vault balance immediately before the attempt.
- Roll a random number from 1 through 100 and compare it with
chance.
Success
Section titled “Success”The configured result is placed into the player’s main hand or inventory, the Vault price is withdrawn, the success message and sound play, and required ingredients are removed when required-items.remove-on-success is enabled.
Failure
Section titled “Failure”The reserved source item is lost, no result is given, and the failure message and sound play. Required ingredients are removed only when required-items.remove-on-failure is enabled. The configured coin price is not withdrawn on failure.
Closing a Menu
Section titled “Closing a Menu”Closing or cancelling before a roll returns the reserved source amount. The menu tracks its handoff to the confirmation screen to avoid double restoration. Returned items merge into the hand or main inventory; overflow drops at the player location. Reload and plugin disable also close active upgrade menus so their close handlers can restore reserved items.