EssentialsX

EssentialsX

2M Downloads

Withdrawing money from another plugin into Essentails that goes above max-money deletes the money

TomLewis opened this issue ยท 12 comments

commented

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

  1. Set max-money in Essentials to 250000
  2. Give yourself 240000 in Essentials
  3. Withdraw 15000 from your Crew bank from Simpleclans
  4. 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.

commented

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.

commented

Can you do /vault-info and share the output.

commented
[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]
commented

I can confirm over paying, puts players balance in the negative.

commented

image
image

commented

I have an open pull request which should fix this (#3975).

Please download jars from here and let me know if it fixes it!

commented

@JRoy are you handling the MaxMoneyException in that PR? I don't see it.

commented

@JRoy are you handling the MaxMoneyException in that PR? I don't see it.

Sorry for the delay but my most recent commit now properly handles this. Download the build to test here

commented

Sorry for the delay but my most recent commit now properly handles this. Download the build to test here

@TomLewis this should fix your problem.

commented

That's a 404, did it get added?

commented

Probably a bug in GitHub actions, try this:
https://github.com/EssentialsX/Essentials/actions/runs/785765546
Look for artifacts at the bottom

commented

That's a 404, did it get added?

make sure you're logged into github when you click it