-
Notifications
You must be signed in to change notification settings - Fork 0
Account
An account is something that represents how much money you have got. An account can be very abstract. There are different accounts types in XialotEcon, for example:
-
Bank account (how much money do you have in the bank?)
- You may have multiple personal bank accounts, in different currencies.
- If you can access team accounts, you will see them in your account list too.
- Cash account (how much money can you pay immediately? Think of an account as a "wallet" instead)
- If the Realistic Economy module is enabled, you have one cash account per wallet item.
-
Loan account (how much money do you owe? This amount will be show in negative.
- Each account represents one loan.
-
Shop account
- The money you earn from your shop is temporarily stored in the shop account for that shop.
- If you enable the Plot module:
- If you collect plot tolls, the collected fee
- The plot itself is stored as a "non-monetary account" in the database so that it is counted when your account is analyzed with /balance.
An account can be deleted from the database if it has not been directly accessed for a long time. Ways to directly access an account include:
- It shows up on the list of accounts when a transaction is initiated
- It is newly created
The time to be obsolete is 60 days by default. This can be changed in the account.obsolete-time
config.
When a player carries out a transaction, he may have multiple available accounts to do the transaction with. XialotEcon will check all these accounts, then guess which one the player wants to use by assigning a score to each account that indicates the likelihood of the player wanting to use it. If the best account has way higher priority than other accounts, it will get chosen automatically, unless the player ran the /choose-account
command before running this command.
The threshold for choosing an account automatically can be set in the account.default-distinction
config.
An account is uniquely identified by the accountId
, which is a XOID.
An account's value is defined by a balance
, which is a decimal number precise up to 1029 and precise to 10-5.
An account should only contain balance in one currency. If you have multiple currencies, create multiple accounts. The currency of the account is defined in the currency
column, which is a XOID reference to the currency.
To facilitate account classification, each account should have an account type (accountType
). The account type should be a dotname defined by the creator. For example, accounts created by XialotEcon's PlayerModule should have account types starting with xialotecon.player.
. When an event is fired for an account, an implementation should fully handle the event if the account's type is declared by that implementation.
To facilitate analysis of an account owner's financial state, accounts are also indexed by their owners. While some accounts are very volatile and do not stick to a certain owner closely (e.g. in the Realistic Economy module, wallet item accounts might change owner easily), the implementation should try to update the account owner as appropriate so as to facilitate the financial analysis.
The last time this account has been directly accessed, used for deleting obsolete accounts.