Loans Permissions Issue
theianspence opened this issue · 7 comments
Type of bug
Error in console, Other unexpected behaviour
/ess dump all
output
https://essentialsx.net/dump.html?id=06b4742153244f14844a2a722d6fd751
Error log (if applicable)
No response
Bug description
I'm using EssentialsX as my Eco and QuickShop to allow users to buy and sell items from each other. QuickShop allows me to create a tax account, using a fake player name. In our case, "Treasury."
All of that works well, on a $100 sale $10 goes to the Treasury and its hunky dory.
However, the server is just starting to get going, and I am loaning money from the Treasury account to our players, so the current balance of the Treasury is $-2000. I noticed that there is an issue where when the Treasury account is below zero, no money gets added to the account.
I talked with the QuickShop support, and we dug around a bit and found this error message:
[2022-01-17 02:00:31.010] {"success":false,"from":"00000000-0000-0000-0009-01fe53f930f2","to":"a811a16e-339e-4fa7-bda2-37d965459b22","currency":null,"tax":52.0,"taxAccount":"2c5f00ba-902c-411b-b9b9-9261cf43aee1","amount":520.0,"lastError":"Failed to deposit tax account: 52.0 error:Loan was not permitted!"}
We determined that it is the loan permission causing the problem. However, I am not sure how to circumvent this. I can't give that Treasury account the loan permission because it's not a real user. Giving it OP didn't work either.
Upon enabling /ess debug, when the transaction takes place, I see this in the console
[Essentials] checking if Tax has essentials.eco.loan - false
I then tried this with a real account, rather than a fake one created with QuickShop, and I'm experiencing the same issue with the loan permission.
Setting the user as an NPC does nothing to solve this.
This is related to the essentials.eco.loan but I'm not sure how to circumvent this.
Steps to reproduce
- Install QuickShop and EssentialsX
- Make sure tax is enabled and set to a fake account, in our case it's "Treasury"
- Ensure that the Treasury account has less than
$0 in it. e.g. $ -2000 - Have two people online, one to make a store and one to buy from the store
- Create a store and have the other player purchase something from the store
- Money transfers accounts and a tax should be collected (e.g. $5)
- Check balance of Treasury, it will still be
$-2000 rather than being $ -1995.
Expected behaviour
When the Treasury account is in the negatives, an incoming deposit in the form of a tax from QuickShop should increase the balance the Treasury account making it closer to zero.
Say we have an incoming tax of
Actual behaviour
When the Treasury account is in the negatives, an incoming tax deposit fails, and thus the balance of the Treasury remains unchanged.
Say we have an incoming tax of
Essentials/Essentials/src/main/java/com/earth2me/essentials/User.java
Lines 122 to 129 in a9585bb
Essentials/Essentials/src/main/java/com/earth2me/essentials/User.java
Lines 148 to 170 in a9585bb
npc: true
last-account-name: tax
money: '-1000.0'
teleportenabled: true
teleportauto: false
godmode: false
muted: false
jailed: false
ip-address: ''
afk: false
socialspy: false
powertoolsenabled: true
accepting-pay: true
baltop-exempt: false
timestamps:
lastteleport: 0
lastheal: 0
mute: 0
jail: 0
onlinejail: 0
logout: 0
login: 0
Interesting find!
So it’s always going to be false, as long as the player is offline?