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 booleanaddBalance(java.util.UUID uuid, double amount)Add the point into player balanceAccountgetAccountIdentify(java.util.UUID who)Get the account which must be existed in database.doublegetBalance(java.util.UUID uuid)Get the balance of playerSQLEstablishgetEstablish()Establish of SQL databooleanhasAccount(java.util.UUID uuid)Check whether the account contain or notAccountrequestAccountInformation(java.util.UUID who)Get account via uuid.booleansave(Account account)Save account into storage locationbooleansetBalance(java.util.UUID uuid, double amount)Set balance of player.booleantakeBalance(java.util.UUID uuid, double amount)Take the point of player balancejava.util.List<Account>topPlayer(int limit)Get the top player as pointsbooleanupdate(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:
SQLEstablishclass
-
requestAccountInformation
Description copied from interface:IAccountDatabaseGet account via uuid. Whether not found player, create one- Specified by:
requestAccountInformationin interfaceIAccountDatabase- Parameters:
who-UUIDthe uuid if storage player- Returns:
Accountaccount of player
-
getAccountIdentify
Description copied from interface:IAccountDatabaseGet the account which must be existed in database. Whether not will return null- Specified by:
getAccountIdentifyin interfaceIAccountDatabase- Parameters:
who-UUIDthe uuid to get- Returns:
- the account or null value
-
save
Description copied from interface:IAccountDatabaseSave account into storage location- Specified by:
savein interfaceIAccountDatabase- Parameters:
account-Accountto save- Returns:
- The state of saving account
-
update
-
hasAccount
public boolean hasAccount(java.util.UUID uuid)Description copied from interface:IAccountDatabaseCheck whether the account contain or not- Specified by:
hasAccountin interfaceIAccountDatabase- Parameters:
uuid-UUIDthe uuid which want to check- Returns:
- true or false
-
setBalance
public boolean setBalance(java.util.UUID uuid, double amount)Description copied from interface:IAccountDatabaseSet 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:
setBalancein interfaceIAccountDatabase- Parameters:
uuid-UUIDyou want to setamount-Doublethe amount to set- Returns:
- the state which set or not
-
getBalance
public double getBalance(java.util.UUID uuid)Description copied from interface:IAccountDatabaseGet the balance of player- Specified by:
getBalancein interfaceIAccountDatabase- Parameters:
uuid-UUIDplayer you want to set- Returns:
- the point amount of player
-
takeBalance
public boolean takeBalance(java.util.UUID uuid, double amount)Description copied from interface:IAccountDatabaseTake the point of player balance- Specified by:
takeBalancein 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:IAccountDatabaseAdd the point into player balance- Specified by:
addBalancein interfaceIAccountDatabase- Parameters:
uuid- who you want to addamount- amount- Returns:
- the state of added or not
-
topPlayer
Description copied from interface:IAccountDatabaseGet the top player as points- Specified by:
topPlayerin interfaceIAccountDatabase- Parameters:
limit- the limitation of searching query- Returns:
- the
Accountlist which performed by search
-