Labels: critical, bug, economy, data-loss
Description
Money is deducted before the plugin confirms that the player's inventory can accept the complete purchase.
The implementation only checks player.inventory.first_empty, which is insufficient for bulk purchases. One empty slot does not mean the inventory can hold several stacks.
Impact
- Players can lose money without receiving all items.
- Bulk purchases may deliver only part of the requested quantity.
- The success message may report more items than were actually added.
Expected behavior
Before deducting money, calculate whether the inventory can accept the complete quantity.
The plugin must also check the result of add_item(). If item delivery fails after payment, the payment must be refunded.
Labels: critical, bug, economy, data-loss
Description
Money is deducted before the plugin confirms that the player's inventory can accept the complete purchase.
The implementation only checks
player.inventory.first_empty, which is insufficient for bulk purchases. One empty slot does not mean the inventory can hold several stacks.Impact
Expected behavior
Before deducting money, calculate whether the inventory can accept the complete quantity.
The plugin must also check the result of
add_item(). If item delivery fails after payment, the payment must be refunded.