public abstract class StorageEngine
extends java.lang.Object
| Constructor and Description |
|---|
StorageEngine() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
accountExist(java.lang.String name,
boolean bankAccount)
Checks if a account exist
|
abstract void |
cleanLog(java.sql.Timestamp timestamp)
Clear the logs before the timestamp given
|
abstract boolean |
deleteAccount(java.lang.String name,
boolean bankAccount)
Delete a account from the backend
|
abstract void |
deleteCurrency(Currency currency)
Delete a currency from the storage
|
abstract void |
disable()
Disable the storage engine.
|
Account |
getAccount(java.lang.String name,
boolean isBank)
Retrieve an account from the storage.
|
abstract Account |
getAccount(java.lang.String name,
boolean isBank,
boolean createDefault)
Retrieve an account from the storage.
|
abstract Account |
getAccount(java.util.UUID uuid)
Retrieve an account from the storage.
|
abstract java.util.List<java.lang.String> |
getAllAccounts(boolean bank)
Retrieve all account names
|
abstract java.util.List<Balance> |
getAllBalance(Account account)
Retrieve all the balance of an account
|
abstract java.util.Map<java.lang.String,Currency> |
getAllCurrencies()
Retrieve all currencies
|
abstract java.util.List<java.lang.String> |
getAllCurrencyNames()
Get the names of all the currencies in the system.
|
abstract java.util.List<Balance> |
getAllWorldBalance(Account account,
java.lang.String world)
Retrieve all balance from a world
|
abstract double |
getBalance(Account account,
Currency currency,
java.lang.String world)
Retrieve the balance of an account
|
abstract java.lang.String[] |
getBankAccountList(java.lang.String playerName)
Retrieve the list of bank account this player have access to
|
abstract java.lang.String |
getConfigEntry(java.lang.String name)
Retrieve the configuration value
|
abstract Currency |
getCurrency(java.lang.String name)
Retrieve a currency
|
abstract java.util.List<CurrencyRatesCommand.CurrencyRateEntry> |
getCurrencyExchanges()
Get the exchange rates of every currencies
|
abstract double |
getExchangeRate(Currency currency,
Currency otherCurrency)
Retrieve the exchange rate between 2 currencies
|
abstract java.util.List<LogCommand.LogEntry> |
getLog(Account user,
int page)
Get the logs of an account
|
abstract java.util.List<TopCommand.TopEntry> |
getTopEntry(int page,
Currency currency,
java.lang.String world)
Retrieve a list of the top accounts
|
abstract java.util.Map<java.lang.String,WorldGroup> |
getWorldGroups()
Get all the world groups in the system
|
abstract void |
removeWorldGroup(java.lang.String group)
Remove a world group from the system
|
abstract java.util.Map<java.lang.String,AccountACLValue> |
retrieveACL(Account account)
Retrieve the ACL listing for a bank account
|
abstract java.lang.String |
retrieveWorldGroupWorlds(java.lang.String name)
Get the raw value of the world list of a world group.
|
abstract AccountACLValue |
saveACL(Account account,
java.lang.String name,
boolean deposit,
boolean withdraw,
boolean acl,
boolean show,
boolean owner)
Save the ACL setting of a bank account
|
abstract void |
saveCurrency(java.lang.String oldName,
Currency currency)
Save a currency in the backend
|
abstract void |
saveImporterUsers(java.util.List<Converter.User> userList)
Save the converted accounts into the backend
|
abstract void |
saveLog(LogInfo info,
Cause cause,
java.lang.String causeReason,
Account account,
double amount,
Currency currency,
java.lang.String worldName)
Write a transaction to the Log.
|
abstract void |
saveLog(LogInfo info,
Cause cause,
java.lang.String causeReason,
Account account,
double amount,
Currency currency,
java.lang.String worldName,
java.sql.Timestamp timestamp) |
abstract void |
saveWorldGroup(java.lang.String name,
java.lang.String worldList)
Save a world group
|
abstract double |
setBalance(Account account,
double amount,
Currency currency,
java.lang.String world)
Set the balance of the account
|
abstract void |
setConfigEntry(java.lang.String name,
java.lang.String value)
Set a configuration value in the database
|
abstract void |
setDefaultBankCurrency(Currency currency)
Set the default bank creation currency.
|
abstract void |
setDefaultCurrency(Currency currency)
Set the default currency of the system
|
abstract void |
setExchangeRate(Currency currency,
Currency otherCurrency,
double amount)
Set the exchange between 2 currencies in the backend
|
abstract void |
setIgnoreACL(Account account,
boolean ignoreACL)
Set if the account must ignore the ACL
|
abstract void |
setInfiniteMoney(Account account,
boolean infinite)
Set if the account have infinite money
|
abstract void |
updateUsername(java.lang.String name,
java.util.UUID uuid)
Update the username in the account
|
abstract void |
updateUUID(java.lang.String name,
java.util.UUID uuid)
Set the UUID of the account if it exists
|
public abstract void disable()
public Account getAccount(java.lang.String name, boolean isBank)
name - The account nameisBank - If the account is a bank or notpublic abstract Account getAccount(java.lang.String name, boolean isBank, boolean createDefault)
name - The account nameisBank - If the account is a bank account or notcreateDefault - If it adds the default balance in or notpublic abstract Account getAccount(java.util.UUID uuid)
uuid - The UUID of the playerpublic abstract java.util.List<java.lang.String> getAllAccounts(boolean bank)
bank - If we want to retrieve the bank accounts or notpublic abstract void saveLog(LogInfo info, Cause cause, java.lang.String causeReason, Account account, double amount, Currency currency, java.lang.String worldName)
info - The type of transaction to log.cause - The cause of the transaction.causeReason - The reason of the causeaccount - The account being impacted by the changeamount - The amount of money in this transaction.currency - The currency associated with this transactionworldName - The world name associated with this transactionpublic abstract void saveLog(LogInfo info, Cause cause, java.lang.String causeReason, Account account, double amount, Currency currency, java.lang.String worldName, java.sql.Timestamp timestamp)
public abstract java.lang.String getConfigEntry(java.lang.String name)
name - The name of the valuepublic abstract void setConfigEntry(java.lang.String name,
java.lang.String value)
name - The name of the valuevalue - The actual valuepublic abstract java.util.List<Balance> getAllBalance(Account account)
account - The account to retrieve the balance frompublic abstract java.util.List<Balance> getAllWorldBalance(Account account, java.lang.String world)
account - The account to retrieve the balance fromworld - The world group to retrieve the balance frompublic abstract double getBalance(Account account, Currency currency, java.lang.String world)
account - The account to retrieve the balance fromcurrency - The currencyworld - The world grouppublic abstract double setBalance(Account account, double amount, Currency currency, java.lang.String world)
account - The account that the balance is set in.amount - The amount of money being placedcurrency - The Currencyworld - The world grouppublic abstract void setInfiniteMoney(Account account, boolean infinite)
account - The account to modifyinfinite - If the account have infinite money or notpublic abstract void setIgnoreACL(Account account, boolean ignoreACL)
account - The account to modifyignoreACL - If the account must ignore the ACL or notpublic abstract java.util.Map<java.lang.String,AccountACLValue> retrieveACL(Account account)
account - The bank accountpublic abstract AccountACLValue saveACL(Account account, java.lang.String name, boolean deposit, boolean withdraw, boolean acl, boolean show, boolean owner)
account - The accountname - The player namedeposit - If the player can depositwithdraw - If the player can withdrawacl - If the player can modify the ACLshow - If the player can show the balanceowner - If the player is the ownerpublic abstract double getExchangeRate(Currency currency, Currency otherCurrency) throws NoExchangeRate
currency - The currency to convert fromotherCurrency - The currency to convert toNoExchangeRate - If there's no exchange rate, this event is thrown.public abstract void setExchangeRate(Currency currency, Currency otherCurrency, double amount)
currency - The currency to convert fromotherCurrency - The currency to convert toamount - The exchange rate (Example: 1.3 will make 1 Currency transform to 1.3 otherCurrency)public abstract void saveCurrency(java.lang.String oldName,
Currency currency)
oldName - The name of the currency if overriding a existing currencycurrency - The currency to savepublic abstract void deleteCurrency(Currency currency)
currency - The currency to deletepublic abstract void updateUsername(java.lang.String name,
java.util.UUID uuid)
name - The name of the playeruuid - The UUID of the playerpublic abstract void updateUUID(java.lang.String name,
java.util.UUID uuid)
name - The player nameuuid - the UUID of the playerpublic abstract java.util.Map<java.lang.String,WorldGroup> getWorldGroups()
public abstract void removeWorldGroup(java.lang.String group)
group - The name of the world grouppublic abstract java.lang.String[] getBankAccountList(java.lang.String playerName)
playerName - The player namepublic abstract java.util.List<LogCommand.LogEntry> getLog(Account user, int page)
user - The account to retrieve the log frompage - The page number of the entry.public abstract java.util.List<TopCommand.TopEntry> getTopEntry(int page, Currency currency, java.lang.String world)
page - The page numbercurrency - The currencyworld - The world group.public abstract java.util.List<CurrencyRatesCommand.CurrencyRateEntry> getCurrencyExchanges()
public abstract void cleanLog(java.sql.Timestamp timestamp)
timestamp - The lowest date a log entry can havepublic abstract boolean deleteAccount(java.lang.String name,
boolean bankAccount)
name - The name of the accountbankAccount - If the account is a bank account or notpublic abstract boolean accountExist(java.lang.String name,
boolean bankAccount)
name - The name of the accountbankAccount - If the account is a bank account or notpublic abstract void saveWorldGroup(java.lang.String name,
java.lang.String worldList)
name - The name of the world group.worldList - The worlds being in this world group seperated by , .public abstract java.util.List<java.lang.String> getAllCurrencyNames()
public abstract void setDefaultCurrency(Currency currency)
currency - The currency to set as defaultpublic abstract void setDefaultBankCurrency(Currency currency)
currency - The currencypublic abstract Currency getCurrency(java.lang.String name)
name - The name of the currencypublic abstract java.util.Map<java.lang.String,Currency> getAllCurrencies()
public abstract java.lang.String retrieveWorldGroupWorlds(java.lang.String name)
name - The name of the world group.public abstract void saveImporterUsers(java.util.List<Converter.User> userList)
userList - The user list being converted