Economy withdrawPlayer does not check balance
bloodmc opened this issue ยท 3 comments
Information
Full output of /ess version
:
[23:39:15 INFO]: Server version: 1.15.2-R0.1-SNAPSHOT git-Paper-271 (MC: 1.15.2)
[23:39:15 INFO]: EssentialsX version: 2.17.0.5
[23:39:15 INFO]: LuckPerms version: 5.1.29
[23:39:15 INFO]: Vault version: 1.7.2-b107
[23:39:15 INFO]: You are running an unsupported server version!
Server log: Not relevant.
EssentialsX config: config untouched.
Details
Description
Calling economy.withdrawPlayer(player, funds)
blindly withdraws from player without checking to make sure they have enough funds.
Steps to reproduce
- Set a player with 100 balance.
- Call
economy.withdrawPlayer(player, 200)
. - Player will end up with -100 balance.
Expected behavior
The funds should not be withdrawn unless the player has enough in balance. The EconomyResponse should also return a failed result.
Screenshots
https://i.imgur.com/s8CZQ8k.png
This is vault api and not essentials API. Could be related to #3344
Cannot reproduce - Essentials throws NoLoanPermittedException
s and these are caught by Vault and returned as a failure response.
Server version: 1.15.2-R0.1-SNAPSHOT git-Paper-318 (MC: 1.15.2)
EssentialsX version: 2.17.2.109
LuckPerms version: 5.1.32
Vault version: 1.7.2-b107
Are you sure you don't have essentials.eco.loan
? Users with this permission can have their balance drop below 0, and EssentialsX won't throw a NoLoanPermittedException
if this happens. See the test output below (using custom test case plugin + LuckPerms verbose mode):
Also as a side note, 2.17.0.5
is quite an old version that we don't support any more. Since then we've refactored added User
and UUID
methods, but this shouldn't impact the Vault provider.