BentoBoxWorld / Bank

Allow your players to deposit and withdraw money from the island's bank! See island rankings!
Eclipse Public License 2.0
2 stars 6 forks source link

/is bank deposit/withdraw all #21

Closed PancakeCatsss closed 1 year ago

PancakeCatsss commented 2 years ago

Is your feature request related to a problem?

Pretty simple request, would be nice to be able to either tab complete your balance or add an "all" variable when you deposit or withdraw so you don't have to type the amount out if you just want to deposit or withdraw everything.

Describe the solution you'd like.

Adding /is bank withdraw all and /is bank deposit all

Describe alternatives you've considered.

Having it tab complete your balance or island balance would do the same thing pretty much.

Agreements

Other

Thanks.

tastybento commented 2 years ago

Check out 1.4 on the CI: https://ci.codemc.io/job/BentoBoxWorld/job/Bank/

PancakeCatsss commented 2 years ago

Perfect. Thank you.

PancakeCatsss commented 2 years ago

Noticed one slight issue, say i have a balance of "43790.85" when I go to tab it via the command it then shows as "43790.85999999999" which leads to the message that it has to be less than 10 digits. Maybe format the double to 1 decimal place?

Edit: This is only an issue with the deposit command, withdrawing is perfect

tastybento commented 2 years ago

The joys of double precision! There could be an issue with rounding, e.g. "43790.85999999999" will round to "43790.9" for 1 place, and "43790.86" for two, both of which is larger than the amount you have in your hand. Maybe for depositing I have to round down and do it to 2 decimal places. I'll try that.

PancakeCatsss commented 2 years ago

Hi, Just wondering if there is any examples of how to access an Addon such as the Bank (for adding/remove from a players island bank) through the API?

Thanks.

tastybento commented 2 years ago

If you are writing an Addon, then all the methods you need are in the BankManager class, and you can obtain the BankManager from the main class Bank. However, if you are writing a Plugin, then I'll need to migrate Bank to a Pladdon, which will enable you to access these classes. It's easy to make it a Pladdon so let me know what you are writing.

See: https://ci.codemc.io/job/BentoBoxWorld/job/Bank/ws/target/apidocs/world/bentobox/bank/BankManager.html https://ci.codemc.io/job/BentoBoxWorld/job/Bank/ws/target/apidocs/world/bentobox/bank/Bank.html#getBankManager--

PancakeCatsss commented 2 years ago

Thank you for the reply, Indeed it is for a plugin not an Addon.

HamtaBot commented 1 year ago

The joys of double precision! There could be an issue with rounding, e.g. "43790.85999999999" will round to "43790.9" for 1 place, and "43790.86" for two, both of which is larger than the amount you have in your hand. Maybe for depositing I have to round down and do it to 2 decimal places. I'll try that.

hey is it still on development ? we still have the message for the 10 digits