Withdrawing money from another plugin into Essentails that goes above max-money deletes the money
TomLewis opened this issue ยท 12 comments
Type of bug
Data loss
/ess version
output
[13:49:18] [Server thread/INFO]: Server version: 1.12.2-R0.1-SNAPSHOT git-Paper-1618 (MC: 1.12.2)
[13:49:18] [Server thread/INFO]: EssentialsX version: 2.18.2.0
[13:49:18] [Server thread/INFO]: PlaceholderAPI version: 2.10.0-DEV-68
[13:49:18] [Server thread/INFO]: LuckPerms version: 5.3.5
[13:49:18] [Server thread/INFO]: Vault version: 1.6.6-b${env.TRAVIS_BUILD_NUMBER}
[13:49:18] [Server thread/INFO]: EssentialsXGeoIP version: 2.18.2.0
[13:49:18] [Server thread/INFO]: EssentialsXSpawn version: 2.18.2.0
[13:49:18] [Server thread/INFO]: Citizens version: 2.0.27-SNAPSHOT (build 2232)
[13:49:18] [Server thread/INFO]: CMI version: 8.8.3.2
Server startup log
https://gist.github.com/TomLewis/b3f87828d63150ef4d92437e3d898136
EssentialsX config files
https://gist.github.com/TomLewis/76d4603cf51b8e52fcc59c3ee05c0899
Error log (if applicable)
No response
Bug description
When another plugin withdraws money from that plugin into Essentails Eco, if the total is above the players max-money, it deletes the money entirely.
My use case is; I'm using SimpleClans which has a /clan bank feature that players/clan leaders can deposit money into and withdraw. My max balance is set at 250000, I had a player with 220000 withdraw 60000 from their crew balance and it just vanished as there is nothing in place to tell SimpleClans that this would be maximum balance for a player.
I reported this to simpleclans back in Feb RoinujNosde/SimpleClans#123 (comment)
As this wouldn't only happen with SimpleClans but every single plugin, can there be a check made that can give the plugin feedback to fail the transaction if the players maximum balance would be reached from the transaction.
Steps to reproduce
- Set max-money in Essentials to 250000
- Give yourself 240000 in Essentials
- Withdraw 15000 from your Crew bank from Simpleclans
- money vanishes.
Expected behaviour
For Essentials to report back to the plugin that this would be over the maximum balance they are allowed, so then developers can trigger a message to the player to stop the transaction.
Actual behaviour
Money is lost.
Essentials has an Exception for when the max money will be exceeded, but it's being suppressed.
So Vault can't send back a failed status for the transaction.
You are probably suppressing it to not break any plugins depending on Essentials, but I think it's best to just throw the exception and let other plugins handle that, than to just make the exceeding money disappear.
If the plugin doesn't handle the exception (Vault probably will in a update), at least the player will get some feedback ("command error") and the money won't be lost.
[15:11:55] [Server thread/INFO]: [Vault] Vault v1.6.6-b${env.TRAVIS_BUILD_NUMBER} Information
[15:11:55] [Server thread/INFO]: [Vault] Economy: Essentials Economy [Essentials Economy]
[15:11:55] [Server thread/INFO]: [Vault] Permission: LuckPerms [LuckPerms, SuperPerms]
[15:11:55] [Server thread/INFO]: [Vault] Chat: LuckPerms [LuckPerms]
@JRoy are you handling the MaxMoneyException in that PR? I don't see it.
Probably a bug in GitHub actions, try this:
https://github.com/EssentialsX/Essentials/actions/runs/785765546
Look for artifacts at the bottom