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

Interest #14

Closed tastybento closed 3 years ago

tastybento commented 3 years ago

Fixes https://github.com/BentoBoxWorld/Bank/issues/12

Adds interest to bank account. The interest is the yearly interest rate because that is what is used in real life. Interest is compounded (calculated) on a daily period by default but interest is paid intermittently and triggered only by actions to avoid a long-running task timer and period mass updates of accounts that could cause lag. When the server is started, interest calculated for all accounts and accounts updated. Interest payment checks are made with every deposit or withdrawal by the player.

Example:

  1. Player deposits 10,000 to their account
  2. Player logs off
  3. One week passes, during which the server is rebooted 3 times.
  4. When the player logs on, they check their balance and see it is larger than 10,000
  5. The player checks their statement and sees they have at least 3 interest payments
  6. They make a withdrawal of 1,000 - at this time, if it has been more than a day since interest was paid, then any outstanding interest is paid before the withdrawal.
  7. The player sees they have more money than they expected.
  8. They look at their statement and see interest was just paid.

Players see interest in their account as a golden nugget as if it was deposited by the island owner. Deposits have a new icon - golden ingot.

As you can see, interest is actually quite complex and to make it scalable, it can be a little weird, but in the end, the players will get paid their due.

sonarcloud[bot] commented 3 years ago

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

75.4% 75.4% Coverage
0.0% 0.0% Duplication