Package nl.minetopiasdb.api.banking
Class Bankaccount
java.lang.Object
nl.minetopiasdb.api.banking.Bankaccount
The bankaccount object
-
Constructor Summary
ConstructorDescriptionBankaccount
(int id, BankAccountType type, double balance, String name, boolean frozen, HashMap<UUID, BankPermission> users) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.void
addUser
(UUID uuid, BankPermission permission) Add a user to this bankaccount and give him the provided permission.void
addUserFromCommand
(UUID user) Deprecated.This method does not take BankPermissions into account, and assumesBankPermission.ADMIN
by default, since that was the behaviour before the change.void
addUserSilent
(UUID uuid, BankPermission permission) Add a user to this bankaccount and give him the provided permission.Get a list of users who are authorised to use this bankaccount.double
Get the balance of this bankaccount.int
getId()
Get the ID of this bankaccountgetName()
Get the name of this bankaccountgetType()
Get the BankaccountType of this bankaccountgetUsers()
Return a Map of the users with their respective permission on this bankaccountboolean
hasPermission
(UUID uuid, BankPermission permission) Check if player has provided bankpermission.boolean
isFrozen()
Check if a bankaccount is frozenvoid
removeUser
(UUID uuid) Remove a user to this bankaccount.void
removeUserFromCommand
(UUID user) Deprecated.This method does not take BankPermissions into account, and assumesBankPermission.ADMIN
by default, since that was the behaviour before the change.void
removeUserSilent
(UUID uuid) void
setBalance
(double newBalance) Change the balance of this bankaccount.void
setBalanceSilent
(double newBalance) We can't just callsetBalance(double)
whilst updating balances from messagechannels, that would create an infinite loop, which is cool and all but not really useful.void
setBalanceWithoutChannels
(double newBalance) Deprecated.This method has been renamed tosetBalanceSilent(double)
to remain consistentvoid
setFrozen
(boolean frozen) Freeze a bank account.void
setFrozenSilent
(boolean frozen) We can't just callsetFrozen(boolean)
whilst updating frozen state from messagechannels, that would create an infinite loop, which is cool and all but not really useful.void
setFrozenWithoutChannels
(boolean frozen) Deprecated.This method has been renamed tosetFrozenSilent(boolean)
to remain consistentvoid
Change the name of this bankaccount.void
setNameSilent
(String name) Change the name of this bankaccount without communicating it through message channels.void
setNameWithoutChannels
(String name) Deprecated.This method has been renamed tosetNameSilent(String)
to remain consistent
-
Constructor Details
-
Bankaccount
public Bankaccount(int id, BankAccountType type, double balance, String name, boolean frozen, HashMap<UUID, BankPermission> users)
-
-
Method Details
-
getId
public int getId()Get the ID of this bankaccount- Returns:
- id of bankaccount
-
getName
Get the name of this bankaccount- Returns:
- name of bankaccount
-
getType
Get the BankaccountType of this bankaccount- Returns:
- type of bankaccount
-
getBalance
public double getBalance()Get the balance of this bankaccount.- Returns:
- balance of bankaccount
-
setBalance
public void setBalance(double newBalance) Change the balance of this bankaccount.- Parameters:
newBalance
- new balance of this bankaccount
-
setBalanceSilent
public void setBalanceSilent(double newBalance) We can't just callsetBalance(double)
whilst updating balances from messagechannels, that would create an infinite loop, which is cool and all but not really useful. This method is for internal use only.- Parameters:
newBalance
- The new balance.
-
isFrozen
public boolean isFrozen()Check if a bankaccount is frozen- Returns:
- true if frozen.
-
setFrozen
public void setFrozen(boolean frozen) Freeze a bank account.- Parameters:
frozen
- true if needs to be frozen.
-
setFrozenSilent
public void setFrozenSilent(boolean frozen) We can't just callsetFrozen(boolean)
whilst updating frozen state from messagechannels, that would create an infinite loop, which is cool and all but not really useful. This method is for internal use only.- Parameters:
frozen
- true if needs to be frozen.
-
getAuthorisedUsers
Get a list of users who are authorised to use this bankaccount.- Returns:
- list of authorised users.
-
getUsers
Return a Map of the users with their respective permission on this bankaccount- Returns:
- map of users
-
hasPermission
Check if player has provided bankpermission.- Parameters:
uuid
- uuid of playerpermission
- bankpermission- Returns:
- true if player has permission or has the permission admin
-
setName
Change the name of this bankaccount.- Parameters:
name
- new name of this bankaccount.
-
setNameSilent
Change the name of this bankaccount without communicating it through message channels. Please usesetName(String)
instead. This method is for internal use only.- Parameters:
name
- new name of this bankaccount.
-
addUser
Add a user to this bankaccount and give him the provided permission.- Parameters:
uuid
- uuid of playerpermission
- bankpermission
-
addUserSilent
Add a user to this bankaccount and give him the provided permission. Please useaddUser(UUID, BankPermission)
instead, since this add will be lost on the next reload/restart if you don't. This method is for internal use only.- Parameters:
uuid
- uuid of playerpermission
- bankpermission
-
removeUser
Remove a user to this bankaccount. Please callremoveUserFromCommand(UUID)
as well, since the remove will be lost on the next reload/restart if you don't. This method is for internal use only.- Parameters:
uuid
- uuid of user who needs to be removed.
-
removeUserSilent
-
addUser
Deprecated.This method does not take BankPermissions into account, and assumesBankPermission.ADMIN
by default, since that was the behaviour before the change.As of v2.3, the preferred way to do this is using
addUser(UUID, BankPermission)
oraddUserSilent(UUID, BankPermission)
.Add a user to this bankaccount. Please calladdUserFromCommand(UUID)
as well, since the add will be lost on the next reload/restart if you don't.- Parameters:
user
- user who needs to be added.
-
addUserFromCommand
Deprecated.This method does not take BankPermissions into account, and assumesBankPermission.ADMIN
by default, since that was the behaviour before the change.As of v2.3, the preferred way to do this is using
addUser(UUID, BankPermission)
.Add a user to this bankaccount and communicate the changes with the database & messagechannels (if applicable.)- Parameters:
user
- user who needs to be added.
-
removeUserFromCommand
Deprecated.This method does not take BankPermissions into account, and assumesBankPermission.ADMIN
by default, since that was the behaviour before the change.As of v2.3, the preferred way to do this is using
removeUser(UUID)
.Remove a user from this bankaccount and communicate the changes with the database & messagechannels (if applicable.)- Parameters:
user
- user who needs to be removed.
-
setNameWithoutChannels
Deprecated.This method has been renamed tosetNameSilent(String)
to remain consistentAs of v2.3, the preferred way to do this is using
setNameSilent(String)
.Change the name of this bankaccount without communicating it through message channels. Please usesetName(String)
instead.- Parameters:
name
- new name of this bankaccount.
-
setFrozenWithoutChannels
Deprecated.This method has been renamed tosetFrozenSilent(boolean)
to remain consistentAs of v2.3, the preferred way to do this is using
setFrozenSilent(boolean)
.We can't just callsetFrozen(boolean)
whilst updating frozen state from messagechannels, that would create an infinite loop, which is cool and all but not really useful.- Parameters:
frozen
- true if needs to be frozen.
-
setBalanceWithoutChannels
Deprecated.This method has been renamed tosetBalanceSilent(double)
to remain consistentAs of v2.3, the preferred way to do this is using
setBalanceSilent(double)
.We can't just callsetBalance(double)
whilst updating balances from messagechannels, that would create an infinite loop, which is cool and all but not really useful.- Parameters:
newBalance
- The new balance.
-
BankPermission.ADMIN
by default, since that was the behaviour before the change.