erikzimmermann / TradeSystem

A highly customizable, free and open-source Minecraft plugin for trading between players.
https://www.spigotmc.org/resources/trade-system-custom-layouts.58434/
MIT License
76 stars 48 forks source link

Vault Economy Max Balance Oversight #526

Open TheosisOfficial opened 2 months ago

TheosisOfficial commented 2 months ago

Describe the bug Most Vault economy provider plugins will have a configured maximum balance. If Vault's depositPlayer method would result in the player's balance exceeding the maximum, it should return an EconomyResponse object, whose ResponseType is ResponseType.FAILURE.

In testing, TradeSystem does not seem to check this before calling the depositPlayer method, meaning the money is not deposited into the player's account, but it is withdrawn from the other player's account, resulting in the money completely disappearing.

To Reproduce Steps to reproduce the behavior:

  1. Install Vault, a properly-coded Vault-based economy provider, and TradeSystem
  2. Set a player's balance to near the configured maximum balance
  3. Trade the player, and give them an amount of money that would result in their balance exceeding the configured maximum
  4. Observe as the money is deleted

Expected behavior TradeSystem should only complete trades if the EconomyResponse's ResponseType is ResponseType.SUCCESS

Discord contact: theosis