Package me.playernguyen.opteco.account
Class SQLAccountDatabase
java.lang.Object
me.playernguyen.opteco.OptEcoImplementation
me.playernguyen.opteco.account.SQLAccountDatabase
- All Implemented Interfaces:
IAccountDatabase
,IOptEcoAccountDatabase
- Direct Known Subclasses:
MySQLAccountDatabase
,SQLiteAccountDatabase
public abstract class SQLAccountDatabase extends OptEcoImplementation implements IOptEcoAccountDatabase
-
Constructor Summary
Constructors Constructor Description SQLAccountDatabase(SQLEstablish establish)
-
Method Summary
Modifier and Type Method Description boolean
addBalance(java.util.UUID uuid, double amount)
Add the point into player balanceAccount
getAccountIdentify(java.util.UUID who)
Get the account which must be existed in database.double
getBalance(java.util.UUID uuid)
Get the balance of playerSQLEstablish
getEstablish()
Establish of SQL databoolean
hasAccount(java.util.UUID uuid)
Check whether the account contain or notAccount
requestAccountInformation(java.util.UUID who)
Get account via uuid.boolean
save(Account account)
Save account into storage locationboolean
setBalance(java.util.UUID uuid, double amount)
Set balance of player.boolean
takeBalance(java.util.UUID uuid, double amount)
Take the point of player balancejava.util.List<Account>
topPlayer(int limit)
Get the top player as pointsboolean
update(Account account)
Methods inherited from class me.playernguyen.opteco.OptEcoImplementation
getAccountDatabase, getAccountManager, getConfigurationLoader, getDebugger, getLanguageLoader, getLogger, getPlugin, getStorageType, getTransactionManager
-
Constructor Details
-
Method Details
-
getEstablish
Establish of SQL data- Returns:
SQLEstablish
class
-
requestAccountInformation
Description copied from interface:IAccountDatabase
Get account via uuid. Whether not found player, create one- Specified by:
requestAccountInformation
in interfaceIAccountDatabase
- Parameters:
who
-UUID
the uuid if storage player- Returns:
Account
account of player
-
getAccountIdentify
Description copied from interface:IAccountDatabase
Get the account which must be existed in database. Whether not will return null- Specified by:
getAccountIdentify
in interfaceIAccountDatabase
- Parameters:
who
-UUID
the uuid to get- Returns:
- the account or null value
-
save
Description copied from interface:IAccountDatabase
Save account into storage location- Specified by:
save
in interfaceIAccountDatabase
- Parameters:
account
-Account
to save- Returns:
- The state of saving account
-
update
-
hasAccount
public boolean hasAccount(java.util.UUID uuid)Description copied from interface:IAccountDatabase
Check whether the account contain or not- Specified by:
hasAccount
in interfaceIAccountDatabase
- Parameters:
uuid
-UUID
the uuid which want to check- Returns:
- true or false
-
setBalance
public boolean setBalance(java.util.UUID uuid, double amount)Description copied from interface:IAccountDatabase
Set balance of player. This method can be use forOfflinePlayer.getUniqueId()
andEntity.getUniqueId()
.
Please use
IAccountDatabase.takeBalance(UUID, double)
to minus player balance orIAccountDatabase.addBalance(UUID, double)
to add player point.- Specified by:
setBalance
in interfaceIAccountDatabase
- Parameters:
uuid
-UUID
you want to setamount
-Double
the amount to set- Returns:
- the state which set or not
-
getBalance
public double getBalance(java.util.UUID uuid)Description copied from interface:IAccountDatabase
Get the balance of player- Specified by:
getBalance
in interfaceIAccountDatabase
- Parameters:
uuid
-UUID
player you want to set- Returns:
- the point amount of player
-
takeBalance
public boolean takeBalance(java.util.UUID uuid, double amount)Description copied from interface:IAccountDatabase
Take the point of player balance- Specified by:
takeBalance
in interfaceIAccountDatabase
- Parameters:
uuid
- who you want to takeamount
- amount- Returns:
- the state of taken or not
-
addBalance
public boolean addBalance(java.util.UUID uuid, double amount)Description copied from interface:IAccountDatabase
Add the point into player balance- Specified by:
addBalance
in interfaceIAccountDatabase
- Parameters:
uuid
- who you want to addamount
- amount- Returns:
- the state of added or not
-
topPlayer
Description copied from interface:IAccountDatabase
Get the top player as points- Specified by:
topPlayer
in interfaceIAccountDatabase
- Parameters:
limit
- the limitation of searching query- Returns:
- the
Account
list which performed by search
-